From 7ae323ff2ac7cd9ebf7a2a352f3121875df5d16e Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Fri, 31 Aug 2018 11:38:38 +0200 Subject: [PATCH] tests: add whitelist --- tests/init_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/init_test.go b/tests/init_test.go index 26e919d24b..f86db409f2 100644 --- a/tests/init_test.go +++ b/tests/init_test.go @@ -91,6 +91,7 @@ type testMatcher struct { failpat []testFailure skiploadpat []*regexp.Regexp skipshortpat []*regexp.Regexp + whitelistpat *regexp.Regexp } type testConfig struct { @@ -121,6 +122,9 @@ func (tm *testMatcher) fails(pattern string, reason string) { tm.failpat = append(tm.failpat, testFailure{regexp.MustCompile(pattern), reason}) } +func (tm *testMatcher) whitelist(pattern string){ + tm.whitelistpat = regexp.MustCompile(pattern) +} // config defines chain config for tests matching the pattern. func (tm *testMatcher) config(pattern string, cfg params.ChainConfig) { tm.configpat = append(tm.configpat, testConfig{regexp.MustCompile(pattern), cfg}) @@ -208,6 +212,11 @@ func (tm *testMatcher) runTestFile(t *testing.T, path, name string, runTest inte if r, _ := tm.findSkip(name); r != "" { t.Skip(r) } + if tm.whitelistpat != nil{ + if !tm.whitelistpat.MatchString(name){ + t.Skip("Skipped by whitelist") + } + } t.Parallel() // Load the file as map[string].