diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index bde2d9e..2998aa2 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -25,4 +25,4 @@ jobs: - uses: actions/checkout@v4 - name: tests run: | - make run-all-integration-test + make run-all-integration-tests diff --git a/Makefile b/Makefile index 7aed263..fdbd0bf 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ SRCS=$(filter-out %_test.go, $(wildcard *.go */*.go)) +include integration/makefile.mk .PHONY: all all: gofail @@ -18,24 +19,6 @@ verify-gofmt: test: go test -v --race -cpu=1,2,4 ./code/ ./runtime/ -# run all integration tests -.PHONY: run-all-integration-test -run-all-integration-test: run-integration-test-sleep - -.PHONY: build-integration-test -build-integration-test: gofail - -.PHONY: cleanup-integration-test -cleanup-integration-test: clean - -# run integration test - sleep -.PHONY: run-integration-test-sleep -run-integration-test-sleep: build-integration-test execute-integration-test-sleep cleanup-integration-test - -.PHONY: execute-integration-test-sleep -execute-integration-test-sleep: - ./integration/sleep/execute.sh - fix: fix-gofmt .PHONY: fix-gofmt diff --git a/integration/makefile.mk b/integration/makefile.mk new file mode 100644 index 0000000..4d3bdf9 --- /dev/null +++ b/integration/makefile.mk @@ -0,0 +1,24 @@ +GOFAIL_BINARY = $(shell pwd)/gofail + +# run all integration tests +.PHONY: run-all-integration-tests +run-all-integration-tests: run-integration-test-sleep + +# run integration test - sleep +.PHONY: run-integration-test-sleep +run-integration-test-sleep: build-gofail execute-integration-test-sleep remove-gofail + +.PHONY: execute-integration-test-sleep +execute-integration-test-sleep: + @echo "GOFAIL_BINARY = ${GOFAIL_BINARY}" + cd ./integration/sleep/failpoints && ${GOFAIL_BINARY} enable && cd .. && go build -o integration_test_sleep . && cd failpoints && ${GOFAIL_BINARY} disable + cd ./integration/sleep && ./integration_test_sleep && rm integration_test_sleep + +# helper: build/remove gofail binaries +.PHONY: build-gofail +build-gofail: + make clean && make gofail + +.PHONY: remove-gofail +remove-gofail: + make clean diff --git a/integration/sleep/execute.sh b/integration/sleep/execute.sh deleted file mode 100755 index ebed810..0000000 --- a/integration/sleep/execute.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -GOFAIL_BINARY="$(pwd)/gofail" - -cd $(dirname $0) - -pushd failpoints -$GOFAIL_BINARY enable -popd - -go build -o integration_test_sleep . - -pushd failpoints -$GOFAIL_BINARY disable -popd - -./integration_test_sleep -rm integration_test_sleep