tests: remove whitelist feature (#23297)

This commit is contained in:
baptiste-b-pegasys 2021-07-29 20:23:37 +02:00 committed by GitHub
parent 860184d542
commit 85afdeef37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,6 @@ type testMatcher struct {
failpat []testFailure failpat []testFailure
skiploadpat []*regexp.Regexp skiploadpat []*regexp.Regexp
slowpat []*regexp.Regexp slowpat []*regexp.Regexp
whitelistpat *regexp.Regexp
} }
type testConfig struct { type testConfig struct {
@ -124,10 +123,6 @@ func (tm *testMatcher) fails(pattern string, reason string) {
tm.failpat = append(tm.failpat, testFailure{regexp.MustCompile(pattern), reason}) 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. // config defines chain config for tests matching the pattern.
func (tm *testMatcher) config(pattern string, cfg params.ChainConfig) { func (tm *testMatcher) config(pattern string, cfg params.ChainConfig) {
tm.configpat = append(tm.configpat, testConfig{regexp.MustCompile(pattern), cfg}) tm.configpat = append(tm.configpat, testConfig{regexp.MustCompile(pattern), cfg})
@ -217,11 +212,6 @@ func (tm *testMatcher) runTestFile(t *testing.T, path, name string, runTest inte
if r, _ := tm.findSkip(name); r != "" { if r, _ := tm.findSkip(name); r != "" {
t.Skip(r) t.Skip(r)
} }
if tm.whitelistpat != nil {
if !tm.whitelistpat.MatchString(name) {
t.Skip("Skipped by whitelist")
}
}
t.Parallel() t.Parallel()
// Load the file as map[string]<testType>. // Load the file as map[string]<testType>.
@ -275,14 +265,3 @@ func runTestFunc(runTest interface{}, t *testing.T, name string, m reflect.Value
m.MapIndex(reflect.ValueOf(key)), m.MapIndex(reflect.ValueOf(key)),
}) })
} }
func TestMatcherWhitelist(t *testing.T) {
t.Parallel()
tm := new(testMatcher)
tm.whitelist("invalid*")
tm.walk(t, rlpTestDir, func(t *testing.T, name string, test *RLPTest) {
if name[:len("invalidRLPTest.json")] != "invalidRLPTest.json" {
t.Fatalf("invalid test found: %s != invalidRLPTest.json", name)
}
})
}