[tools] Replace test-all.sh with ./tools/run tests

• Simplify the usage by allowing globs, directories or single test file paths as unnamed arguments. Removes the `--filter` flag that nobody really understood.
• Make the table fit the terminal.
• Replace dawn-path with `<dawn>` in expectation files.

Change-Id: I45a0579e3589888664877c22edb575d1a4ed18c1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/161701
Reviewed-by: dan sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
diff --git a/tools/src/fileutils/paths.go b/tools/src/fileutils/paths.go
index e6f03f8..a2edcfb 100644
--- a/tools/src/fileutils/paths.go
+++ b/tools/src/fileutils/paths.go
@@ -137,3 +137,29 @@
 	}
 	return !s.IsDir()
 }
+
+// CommonRootDir returns the common directory for pathA and pathB
+func CommonRootDir(pathA, pathB string) string {
+	pathA, pathB = filepath.ToSlash(pathA), filepath.ToSlash(pathB) // Normalize to forward-slash
+	if !strings.HasSuffix(pathA, "/") {
+		pathA += "/"
+	}
+	if !strings.HasSuffix(pathB, "/") {
+		pathB += "/"
+	}
+	n := len(pathA)
+	if len(pathB) < n {
+		n = len(pathB)
+	}
+	common := ""
+	for i := 0; i < n; i++ {
+		a, b := pathA[i], pathB[i]
+		if a != b {
+			break
+		}
+		if a == '/' {
+			common = pathA[:i+1]
+		}
+	}
+	return common
+}