Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: remove whitelist feature #23297

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 4 additions & 25 deletions tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ func findLine(data []byte, offset int64) (line int) {

// testMatcher controls skipping and chain config assignment to tests.
type testMatcher struct {
configpat []testConfig
failpat []testFailure
skiploadpat []*regexp.Regexp
slowpat []*regexp.Regexp
whitelistpat *regexp.Regexp
configpat []testConfig
failpat []testFailure
skiploadpat []*regexp.Regexp
slowpat []*regexp.Regexp
}

type testConfig struct {
Expand Down Expand Up @@ -124,10 +123,6 @@ 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})
Expand Down Expand Up @@ -217,11 +212,6 @@ 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]<testType>.
Expand Down Expand Up @@ -275,14 +265,3 @@ func runTestFunc(runTest interface{}, t *testing.T, name string, m reflect.Value
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)
}
})
}