2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-24 13:47:42 +00:00

Add integration tests

This commit is contained in:
Alexander Neumann 2015-05-11 21:09:32 +02:00
parent 61f8169fa0
commit aebfaec9c7
3 changed files with 15 additions and 13 deletions

2
.gitignore vendored
View File

@ -1,5 +1,7 @@
/.gopath
/restic
/restic.debug
/dirdiff
cmd/dirdiff/dirdiff
cmd/gentestdata/gentestdata
cmd/restic/restic

View File

@ -11,6 +11,9 @@ GOTESTFLAGS ?= -v
GOX_OS ?= linux darwin openbsd freebsd
SFTP_PATH ?= /usr/lib/ssh/sftp-server
CMDS=$(patsubst cmd/%,%,$(wildcard cmd/*))
CMDS_DEBUG=$(patsubst %,%.debug,$(CMDS))
export GOPATH GOX_OS
all: restic
@ -19,16 +22,16 @@ all: restic
mkdir -p .gopath/src/github.com/restic
ln -sf ../../../.. .gopath/src/github.com/restic/restic
restic: .gopath
%: cmd/% .gopath
cd $(BASEPATH) && \
go build -a -ldflags "-s" -o restic ./cmd/restic
go build -a -ldflags "-s" -o $@ ./$<
restic.debug: .gopath
%.debug: cmd/% .gopath
cd $(BASEPATH) && \
go build -a -tags debug -o restic ./cmd/restic
go build -a -tags debug -ldflags "-s" -o $@ ./$<
clean:
rm -rf .gopath restic *.cov restic_*
rm -rf .gopath $(CMDS) $(CMDS_DEBUG) *.cov restic_*
go clean ./...
test: .gopath
@ -43,7 +46,11 @@ gox: .gopath
cd $(BASEPATH) && \
gox -verbose -os "$(GOX_OS)" ./cmd/restic
test-integration: .gopath
test-integration: .gopath restic restic.debug dirdiff
# run testsuite
PATH=.:$(PATH) ./testsuite.sh
# run sftp integration tests
cd $(BASEPATH)/backend && \
go test $(GOTESTFLAGS) -test.sftppath $(SFTP_PATH) ./...

View File

@ -2,18 +2,11 @@
# tempdir for binaries
export BASEDIR="$(mktemp --tmpdir --directory restic-testsuite-XXXXXX)"
export BINDIR="${BASEDIR}/bin"
export PATH="${BINDIR}:$PATH"
export DEBUG_LOG="${BASEDIR}/restic.log"
export TZ=UTC
echo "restic testsuite basedir ${BASEDIR}"
# build binaries
go build -a -o "${BINDIR}/restic" ./cmd/restic
go build -a -tags debug -o "${BINDIR}/restic.debug" ./cmd/restic
go build -a -o "${BINDIR}/dirdiff" ./cmd/dirdiff
# run tests
testsuite/run.sh "$@"