From 559f5705f6780382e10dbea898109b85534e20b8 Mon Sep 17 00:00:00 2001 From: Shengqi Chen Date: Sun, 12 Jan 2025 15:51:20 +0800 Subject: [PATCH] ci: rename all coverage files to .gcov, ignore them in git Signed-off-by: Shengqi Chen --- .github/workflows/tunasync.yml | 18 +++++++++--------- .gitignore | 2 ++ Makefile | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/tunasync.yml b/.github/workflows/tunasync.yml index 4e4b38b..58ad456 100644 --- a/.github/workflows/tunasync.yml +++ b/.github/workflows/tunasync.yml @@ -76,7 +76,7 @@ jobs: run: | make build-test-worker sudo mkdir /sys/fs/cgroup/tunasync - sudo ./worker.test -test.v=true -test.coverprofile profile2.cov -test.run TestCgroup + sudo ./worker.test -test.v=true -test.coverprofile profile2.gcov -test.run TestCgroup sudo rmdir /sys/fs/cgroup/tunasync touch /tmp/dummy_exec chmod +x /tmp/dummy_exec @@ -85,7 +85,7 @@ jobs: shift argv0="$1" shift - (TESTREEXEC="$case" TERM=xterm-256color exec -a "$argv0" ./worker.test -test.v=true -test.coverprofile "profile5_$case.cov" -test.run TestReexec -- "$@") + (TESTREEXEC="$case" TERM=xterm-256color exec -a "$argv0" ./worker.test -test.v=true -test.coverprofile "profile5_$case.gcov" -test.run TestReexec -- "$@") } run_test_reexec 1 tunasync-exec __dummy__ run_test_reexec 2 tunasync-exec /tmp/dummy_exec @@ -201,8 +201,8 @@ jobs: cgcreate -a "$CUSER" -t "$CUSER" -g cpu:tunasync cgcreate -a "$CUSER" -t "$CUSER" -g memory:tunasync TERM=xterm-256color ./worker.test -test.v=true -test.coverprofile \ - profile3.cov -test.run TestCgroup - cgexec -g "*:/" bash -c "echo 0 > /sys/fs/cgroup/systemd/tasks; exec sudo -u $CUSER env USECURCGROUP=1 TERM=xterm-256color cgexec -g cpu,memory:tunasync ./worker.test -test.v=true -test.coverprofile profile4.cov -test.run TestCgroup" + profile3.gcov -test.run TestCgroup + cgexec -g "*:/" bash -c "echo 0 > /sys/fs/cgroup/systemd/tasks; exec sudo -u $CUSER env USECURCGROUP=1 TERM=xterm-256color cgexec -g cpu,memory:tunasync ./worker.test -test.v=true -test.coverprofile profile4.gcov -test.run TestCgroup" EOF - name: Stop Uml @@ -227,15 +227,15 @@ jobs: - name: Combine coverage files run : | CUSER="$(id --user --name)" - "${HOME}/go/bin/gocovmerge" profile.cov profile2.cov \ - "umlrootfs/home/${CUSER}/profile3.cov" \ - "umlrootfs/home/${CUSER}/profile4.cov" \ - profile5_*.cov > profile-all.cov + "${HOME}/go/bin/gocovmerge" profile.cov profile2.gcov \ + "umlrootfs/home/${CUSER}/profile3.gcov" \ + "umlrootfs/home/${CUSER}/profile4.gcov" \ + profile5_*.gcov > profile-all.gcov - name: Convert coverage to lcov uses: jandelgado/gcov2lcov-action@v1 with: - infile: profile-all.cov + infile: profile-all.gcov outfile: coverage.lcov - name: Coveralls diff --git a/.gitignore b/.gitignore index 7e6d811..75c7e00 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /build /build-* +worker.test +profile* \ No newline at end of file diff --git a/Makefile b/Makefile index 28f63d4..e401687 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,10 @@ $(BUILDBIN:%=build-$(ARCH)/%) : build-$(ARCH)/% : cmd/% GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -o $@ -ldflags ${LDFLAGS} github.com/tuna/tunasync/$< test: - go test -v -covermode=count -coverprofile=profile.cov ./... + go test -v -covermode=count -coverprofile=profile.gcov ./... build-test-worker: - CGO_ENABLED=0 go test -c -covermode=count ./worker + CGO_ENABLED=0 go test -c -covermode=count github.com/tuna/tunasync/worker clean: rm -rf build-$(ARCH)