aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/csource/csource_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2021-12-21 14:23:50 +0100
committerDmitry Vyukov <dvyukov@google.com>2021-12-21 18:52:46 +0100
commitad097c94a04025c865b3956566ea5da7670ed437 (patch)
tree12a7efa8c65fa8fef91f33fb12d34d8f8f2023d7 /pkg/csource/csource_test.go
parentc6f13480f3e562921f700b3e4f878ca5d54d958f (diff)
pkg/testutil: add package
Add package with RaceEnabled const that can be used in test to skip long tests in race mode. Switch existing tests to use the new package. Update #2886
Diffstat (limited to 'pkg/csource/csource_test.go')
-rw-r--r--pkg/csource/csource_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/csource/csource_test.go b/pkg/csource/csource_test.go
index fc3b21573..91bd2cccf 100644
--- a/pkg/csource/csource_test.go
+++ b/pkg/csource/csource_test.go
@@ -14,11 +14,25 @@ import (
"testing"
"time"
+ "github.com/google/syzkaller/pkg/testutil"
"github.com/google/syzkaller/prog"
_ "github.com/google/syzkaller/sys"
"github.com/google/syzkaller/sys/targets"
)
+func init() {
+ // csource tests consume too much memory under race detector (>1GB),
+ // and periodically timeout on Travis. So we skip them.
+ if testutil.RaceEnabled {
+ for _, arg := range os.Args[1:] {
+ if strings.Contains(arg, "-test.short") {
+ fmt.Printf("skipping race testing in short mode\n")
+ os.Exit(0)
+ }
+ }
+ }
+}
+
func TestGenerate(t *testing.T) {
t.Parallel()
checked := make(map[string]bool)