diff --git a/.github/workflows/unit_test-linux-x64.yml b/.github/workflows/unit_test-linux-x64.yml index c6f56b76c..f7197794f 100644 --- a/.github/workflows/unit_test-linux-x64.yml +++ b/.github/workflows/unit_test-linux-x64.yml @@ -5,6 +5,7 @@ on: push jobs: build: strategy: + max-parallel: 4 matrix: go-version: [1.16.x, 1.17.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x, 1.22.x] runs-on: [self-hosted, X64] @@ -28,9 +29,15 @@ jobs: restore-keys: | ${{ runner.os }}-go- + - name: Data Race + run: | + ./scripts/test_race.sh + - name: PCSP Test run: python3 ./scripts/test_pcsp.py + + - name: Unit Test run: | go test -race -covermode=atomic -coverprofile=coverage.txt ./... diff --git a/decoder/decoder_test.go b/decoder/decoder_test.go index 882aa7990..138b1d127 100644 --- a/decoder/decoder_test.go +++ b/decoder/decoder_test.go @@ -21,7 +21,6 @@ import ( `runtime` `runtime/debug` `strings` - `sync` `testing` `time` @@ -46,40 +45,6 @@ func TestMain(m *testing.M) { m.Run() } -func TestGC(t *testing.T) { - if debugSyncGC { - return - } - var w interface{} - out, err := decode(TwitterJson, &w, true) - if err != nil { - t.Fatal(err) - } - if out != len(TwitterJson) { - t.Fatal(out) - } - wg := &sync.WaitGroup{} - N := 10000 - for i:=0; i test_race.log || true + +if ! grep -q "WARNING: DATA RACE" ./test_race.log; then + echo "TEST FAILED: should data race here" + exit 1 +fi + +go test -v -run=TestRaceDecode -race -count=100 ./issue_test > test_race.log || true + +if ! grep -q "WARNING: DATA RACE" ./test_race.log; then + echo "TEST FAILED: should data race here" + exit 1 +fi + +mv ./issue_test/race_test.go ./issue_test/race_test_go \ No newline at end of file