File tree Expand file tree Collapse file tree 3 files changed +90
-0
lines changed Expand file tree Collapse file tree 3 files changed +90
-0
lines changed Original file line number Diff line number Diff line change 6666 go build -v ./...
6767 go test -v ./... -coverpkg=./... -coverprofile=ocr2_decryptionplugin_coverage.txt
6868
69+ - name : Race test OCR2 plugin
70+ working-directory : ./go/ocr2/decryptionplugin
71+ run : |
72+ go test -race -v ./... -coverpkg=./... -coverprofile=ocr2_decryptionplugin_race_coverage.txt
73+
6974 - name : Download npm deps
7075 working-directory : ./js/tdh2
7176 run : npm install
7580 run : |
7681 go build -v ./...
7782 go test -v ./... -coverpkg=./... -coverprofile=tdh_coverage.txt
83+
84+ - name : Build and test TDH2
85+ working-directory : ./go/tdh2
86+ run : |
87+ go test -race -v ./... -coverpkg=./... -coverprofile=tdh_race_coverage.txt
7888
7989 - name : Upload Go test reports
8090 if : always()
8393 name : go-test-results
8494 path : |
8595 ./go/ocr2/decryptionplugin/ocr2_decryptionplugin_coverage.txt
96+ ./go/ocr2/decryptionplugin/ocr2_decryptionplugin_race_coverage.txt
8697 ./go/tdh2/tdh_coverage.txt
98+ ./go/tdh2/tdh_race_coverage.txt
8799
88100
89101 sonar-scan :
Original file line number Diff line number Diff line change 1+ package decryptionplugin
2+
3+ import (
4+ "errors"
5+ "os"
6+ "sync"
7+ "testing"
8+ )
9+
10+ func TestFail (t * testing.T ) {
11+ if testing .Short () {
12+ t .Skip ()
13+ }
14+ t .Fatal ("fake failure" )
15+ }
16+
17+ func TestRace (t * testing.T ) {
18+ var v int
19+ var wg sync.WaitGroup
20+ wg .Add (100 )
21+ for i := 0 ; i < 100 ; i ++ {
22+ go func () {
23+ defer wg .Done ()
24+ v ++
25+ v --
26+ }()
27+ }
28+ wg .Wait ()
29+ t .Log (v )
30+ }
31+
32+ func TestLint (t * testing.T ) {
33+ const ALL_CAPS = 10 // should be AllCaps
34+ err := os .ErrNotExist
35+ if err == os .ErrNotExist { // should use errors.Is
36+ err := errors .New ("fake error" ) // shadowed variable
37+ t .Log (err )
38+ }
39+ }
Original file line number Diff line number Diff line change 1+ package tdh2
2+
3+ import (
4+ "errors"
5+ "os"
6+ "sync"
7+ "testing"
8+ )
9+
10+ func TestFail (t * testing.T ) {
11+ if testing .Short () {
12+ t .Skip ()
13+ }
14+ t .Fatal ("fake failure" )
15+ }
16+
17+ func TestRace (t * testing.T ) {
18+ var v int
19+ var wg sync.WaitGroup
20+ wg .Add (100 )
21+ for i := 0 ; i < 100 ; i ++ {
22+ go func () {
23+ defer wg .Done ()
24+ v ++
25+ v --
26+ }()
27+ }
28+ wg .Wait ()
29+ t .Log (v )
30+ }
31+
32+ func TestLint (t * testing.T ) {
33+ const ALL_CAPS = 10 // should be AllCaps
34+ err := os .ErrNotExist
35+ if err == os .ErrNotExist { // should use errors.Is
36+ err := errors .New ("fake error" ) // shadowed variable
37+ t .Log (err )
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments