[tools][fuzz] Pass dictionary.txt to the WGSL fuzzer
Bug: tint:2223
Change-Id: I43237c029133fe9e69934683ffadafde1d7c5e34
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/185364
Reviewed-by: James Price <jrprice@google.com>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/tools/src/cmd/fuzz/main.go b/tools/src/cmd/fuzz/main.go
index 385e7ef..d87af69 100644
--- a/tools/src/cmd/fuzz/main.go
+++ b/tools/src/cmd/fuzz/main.go
@@ -49,6 +49,10 @@
"dawn.googlesource.com/dawn/tools/src/utils"
)
+const (
+ wgslDictionaryRelPath = "src/tint/cmd/fuzz/wgsl/dictionary.txt"
+)
+
func main() {
if err := run(); err != nil {
fmt.Println(err)
@@ -193,7 +197,14 @@
ctx, cancel := context.WithCancel(ctx)
defer cancel()
- args := []string{t.out, t.corpus}
+ dictPath, err := filepath.Abs(filepath.Join(fileutils.DawnRoot(), wgslDictionaryRelPath))
+ if err != nil || !fileutils.IsFile(dictPath) {
+ return fmt.Errorf("failed to obtain the dictionary.txt path: %w", err)
+ }
+
+ args := []string{t.out, t.corpus,
+ "-dict=" + dictPath,
+ }
if t.verbose {
args = append(args, "--verbose")
}