diff --git a/.gitignore b/.gitignore index 0173fa4f4..6beaeb895 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ /.gopath /restic +/restic.debug +/dirdiff cmd/dirdiff/dirdiff cmd/gentestdata/gentestdata cmd/restic/restic diff --git a/Makefile b/Makefile index afd9ff830..7b8bfa24c 100644 --- a/Makefile +++ b/Makefile @@ -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) ./... diff --git a/testsuite.sh b/testsuite.sh index 00b343531..0e3b9511c 100755 --- a/testsuite.sh +++ b/testsuite.sh @@ -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 "$@"