diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6cd5a906..99579ea2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -135,11 +135,11 @@ jobs: - name: Run tests if: ${{ matrix.target_arch == matrix.host_arch && matrix.target_os == matrix.host_os }} - run: make tests GINKGO_EXTRA_OPTS=--procs=2 GINKGO_PKG=./pkg/... + run: make tests - - name: Run tests requiring root privileges + - name: Run integration tests if: ${{ matrix.target_arch == matrix.host_arch && matrix.target_os == matrix.host_os && matrix.host_os == 'linux' }} - run: sudo --preserve-env env "PATH=$PATH" make tests GINKGO_PKG=./test/... + run: sudo --preserve-env env "PATH=$PATH" make tests-integration - name: Upload logs an packet captures as artifacts if: ${{ always() && matrix.target_arch == matrix.host_arch && matrix.target_os == matrix.host_os && matrix.host_os == 'linux' }} diff --git a/Makefile b/Makefile index 774dc76f..c44f36ad 100644 --- a/Makefile +++ b/Makefile @@ -14,19 +14,16 @@ ifeq ($(GOOS),linux) PKGS += ./test/... endif -GINKGO_PKG ?= ./... -GINKGO_OPTS += --compilers=2 \ +GINKGO_OPTS = --compilers=2 \ --keep-going \ --timeout=15m \ --trace \ --cover \ --coverpkg=./... \ - --coverprofile=coverprofile.out \ --keep-separate-coverprofiles \ - --output-dir=./test/logs \ --randomize-all \ --randomize-suites \ - $(GINKGO_EXTRA_OPTS) $(GINKGO_PKG) -- $(GINKGO_TEST_OPTS) + $(GINKGO_EXTRA_OPTS) all: wice @@ -35,12 +32,16 @@ wice: go build -o $@ -ldflags="$(LDFLAGS)" ./cmd/wice tests: - ginkgo run $(GINKGO_OPTS) + ginkgo run $(GINKGO_OPTS) --procs=2 --coverprofile=coverprofile.out ./pkg/... + +tests-integration: + mkdir -p test/logs + ginkgo run $(GINKGO_OPTS) --output-dir=./test/logs --coverprofile=coverprofile_integration.out ./test coverprofile_merged.out: $(shell find . -name "*.out" -type f) gocov-merger -o $@ $^ -lcov_merged.info: coverprofile_merged.out +lcov.info: coverprofile_merged.out gcov2lcov > $@ < $^ coverage: lcov.info @@ -65,6 +66,7 @@ install-deps: go install github.com/jandelgado/gcov2lcov@latest clean: - rm -f *.out wice lcov.info + find . -name "*.out" -exec rm {} \; + rm -rf wice lcov.info test/logs/ .PHONY: all wice tests tests-watch coverage clean vet staticcheck install-deps \ No newline at end of file