[tools][fuzz] Don't check non-wgsl files Speeds up `./tools/run fuzz --check` which is taking increasingly longer for presubmits. Bug: tint:2223 Change-Id: Ic8aec82163779686743f18e39124717a9b18ffb3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/185780 Auto-Submit: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/tools/src/cmd/fuzz/main.go b/tools/src/cmd/fuzz/main.go index d87af69..7bddaee 100644 --- a/tools/src/cmd/fuzz/main.go +++ b/tools/src/cmd/fuzz/main.go
@@ -39,6 +39,7 @@ "os/exec" "path/filepath" "runtime" + "strings" "sync/atomic" "dawn.googlesource.com/dawn/tools/src/fileutils" @@ -141,17 +142,20 @@ numProcesses int // number of concurrent processes to spawn } -// check() runs the fuzzers against all the files under to the corpus directory, +// check() runs the fuzzers against all the .wgsl files under to the corpus directory, // ensuring that the fuzzers do not error for the given file. func (t tool) check() error { - files, err := glob.Glob(filepath.Join(t.corpus, "**")) + wgslFiles, err := glob.Glob(filepath.Join(t.corpus, "**.wgsl")) if err != nil { return err } - log.Printf("checking %v files...\n", len(files)) + // Remove '*.expected.wgsl' + wgslFiles = transform.Filter(wgslFiles, func(s string) bool { return !strings.Contains(s, ".expected.") }) - remaining := transform.SliceToChan(files) + log.Printf("checking %v files...\n", len(wgslFiles)) + + remaining := transform.SliceToChan(wgslFiles) var pb *progressbar.ProgressBar if term.CanUseAnsiEscapeSequences() { @@ -165,7 +169,7 @@ atomic.AddUint32(&numDone, 1) if pb != nil { pb.Update(progressbar.Status{ - Total: len(files), + Total: len(wgslFiles), Segments: []progressbar.Segment{ {Count: int(atomic.LoadUint32(&numDone))}, },