Skip to content

Commit 99f2103

Browse files
fix: disable race check for go tests
1 parent 2d2aa11 commit 99f2103

File tree

5 files changed

+24
-27
lines changed

5 files changed

+24
-27
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: |
3434
go mod download
3535
- name: Build and run tests
36-
run: ./scripts/run-unit-tests.sh ALL
36+
run: ./scripts/run-unit-tests.sh
3737
- name: Install goveralls
3838
run: go install github.com/mattn/goveralls@latest
3939
- name: Send coverage

.github/workflows/test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ jobs:
2323
run: |
2424
go mod download
2525
- name: Build and run tests
26-
run: ./scripts/run-unit-tests.sh ALL
26+
run: ./scripts/run-unit-tests.sh
2727
- name: Install goveralls
2828
run: go install github.com/mattn/goveralls@latest
2929
- name: Send coverage
3030
env:
3131
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
32-
run: goveralls -coverprofile=./testTarget/unit/cover.out -service=github
32+
run: goveralls -coverprofile=./testTarget/unit/cover.final.out -service=github
3333
- uses: actions/upload-artifact@v4
3434
with:
3535
name: libtokenizers.a

hugot_go_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build GO || ALL
2+
13
package hugot
24

35
import (

scripts/run-unit-tests-container.sh

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,25 @@ cd /build && \
66
mkdir -p /test/unit && \
77
go run ./testData/downloadModels.go
88

9-
echo HUGOT_BUILD_TAG is "$HUGOT_BUILD_TAG"
9+
gotestsum --junitfile=/test/unit/unit-onnx.xml \
10+
--jsonfile=/test/unit/unit-onnx.json \
11+
-- tags=ORT -coverprofile=/test/unit/cover-onnx.out -coverpkg ./... -timeout 60m -race -covermode=atomic ./...
1012

11-
if [[ -n $HUGOT_BUILD_TAG ]]; then
12-
echo "running with -tags=ALL"
13-
gotestsum --junitfile=/test/unit/unit.xml --jsonfile=/test/unit/unit.json -- -tags=ALL -coverprofile=/test/unit/cover.out.pre -coverpkg ./... -timeout 60m -race -covermode=atomic ./...
14-
else
15-
echo "running without build tags"
16-
gotestsum --junitfile=/test/unit/unit.xml --jsonfile=/test/unit/unit.json -- -coverprofile=/test/unit/cover.out.pre ./... -timeout 60m -race -covermode=atomic ./...
17-
fi
13+
gotestsum --junitfile=/test/unit/unit-xla.xml \
14+
--jsonfile=/test/unit/unit-xla.json \
15+
-- -tags=XLA -coverprofile=/test/unit/cover-xla.out -coverpkg ./... -timeout 60m -race -covermode=atomic ./...
1816

19-
grep -v "downloadModels.go" /test/unit/cover.out.pre > /test/unit/cover.out && rm /test/unit/cover.out.pre
17+
gotestsum --junitfile=/test/unit/unit-go.xml \
18+
--jsonfile=/test/unit/unit-go.json \
19+
-- -tags=GO -coverprofile=/test/unit/cover-go.out -coverpkg ./... -timeout 60m -covermode=atomic ./...
2020

21-
echo Done.
21+
# Merge coverage files manually
22+
head -n 1 /test/unit/cover-onnx.out > /test/unit/cover.out
23+
tail -n +2 /test/unit/cover-onnx.out >> /test/unit/cover.out
24+
tail -n +2 /test/unit/cover-xla.out >> /test/unit/cover.out
25+
tail -n +2 /test/unit/cover-go.out >> /test/unit/cover.out
26+
27+
# Optionally, remove downloadModels.go lines
28+
grep -v "downloadModels.go" /test/unit/cover.out > /test/unit/cover.final.out
29+
30+
echo Done.

scripts/run-unit-tests.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,6 @@ mkdir -p "$test_folder"
1515
host_uid=$(id -u "$USER")
1616
export host_uid
1717

18-
if [ $# -eq 0 ]; then
19-
echo "running without build tags"
20-
export HUGOT_BUILD_TAG=""
21-
else
22-
first_arg=$1
23-
if [[ $first_arg == "ALL" ]]; then
24-
echo "running with build tag ALL"
25-
export HUGOT_BUILD_TAG="ALL"
26-
else
27-
echo "build tag $first_arg is not supported"
28-
exit 1
29-
fi
30-
fi
31-
3218
# build with compose
3319
docker compose -f "$src_dir/compose-test.yaml" build hugot && \
3420
docker compose -f "$src_dir/compose-test.yaml" build hugot-test

0 commit comments

Comments
 (0)