Move tools to a tools/src directory

Allows bash scripts to share the same name as the directory.

Add fix-tests bash script.

Change-Id: Iaf1943d50ec1fd3f382a2c7823fb7cdd13b1d9a2
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/47766
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/tools/fix-tests b/tools/fix-tests
new file mode 100755
index 0000000..ad5915d
--- /dev/null
+++ b/tools/fix-tests
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+# Copyright 2021 The Tint Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# See https://clang.llvm.org/docs/SourceBasedCodeCoverage.html
+
+if [ ! -x "$(which go)" ] ; then
+    echo "error: go needs to be on \$PATH to use $0"
+    exit 1
+fi
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd )"
+ROOT_DIR="$( cd "${SCRIPT_DIR}/.." >/dev/null 2>&1 && pwd )"
+
+TARGET_EXE="$(realpath $1)"
+
+pushd ${SCRIPT_DIR}/src/fix-tests
+go run fix-tests.go "${TARGET_EXE}"
+popd
diff --git a/tools/fix-tests/go.mod b/tools/fix-tests/go.mod
deleted file mode 100644
index 099add3..0000000
--- a/tools/fix-tests/go.mod
+++ /dev/null
@@ -1,5 +0,0 @@
-module dawn.googlesource.com/tint/tools/fix-tests
-
-go 1.16
-
-require github.com/sergi/go-diff v1.2.0
diff --git a/tools/lint b/tools/lint
index 1224c0e..0c53516 100755
--- a/tools/lint
+++ b/tools/lint
@@ -25,7 +25,7 @@
 if command -v go &> /dev/null
 then
     # Go is installed. Run cpplint in parallel for speed wins
-    go run $SCRIPT_DIR/run-parallel/main.go       \
+    go run $SCRIPT_DIR/src/run-parallel/main.go   \
          --only-print-failures                    \
          ./third_party/cpplint/cpplint/cpplint.py \
          --root=$ROOT_DIR                         \
diff --git a/tools/fix-tests/fix-tests.go b/tools/src/fix-tests/fix-tests.go
similarity index 99%
rename from tools/fix-tests/fix-tests.go
rename to tools/src/fix-tests/fix-tests.go
index 50f60e9..9b80381 100644
--- a/tools/fix-tests/fix-tests.go
+++ b/tools/src/fix-tests/fix-tests.go
@@ -26,7 +26,7 @@
 	"regexp"
 	"strings"
 
-	"dawn.googlesource.com/tint/tools/fix-tests/substr"
+	"dawn.googlesource.com/tint/tools/src/fix-tests/substr"
 )
 
 func main() {
diff --git a/tools/src/fix-tests/go.mod b/tools/src/fix-tests/go.mod
new file mode 100644
index 0000000..b7ba1a0
--- /dev/null
+++ b/tools/src/fix-tests/go.mod
@@ -0,0 +1,5 @@
+module dawn.googlesource.com/tint/tools/src/fix-tests
+
+go 1.16
+
+require github.com/sergi/go-diff v1.2.0
diff --git a/tools/fix-tests/go.sum b/tools/src/fix-tests/go.sum
similarity index 100%
rename from tools/fix-tests/go.sum
rename to tools/src/fix-tests/go.sum
diff --git a/tools/fix-tests/substr/substr.go b/tools/src/fix-tests/substr/substr.go
similarity index 100%
rename from tools/fix-tests/substr/substr.go
rename to tools/src/fix-tests/substr/substr.go
diff --git a/tools/fix-tests/substr/substr_test.go b/tools/src/fix-tests/substr/substr_test.go
similarity index 100%
rename from tools/fix-tests/substr/substr_test.go
rename to tools/src/fix-tests/substr/substr_test.go
diff --git a/tools/run-parallel/main.go b/tools/src/run-parallel/main.go
similarity index 100%
rename from tools/run-parallel/main.go
rename to tools/src/run-parallel/main.go
diff --git a/tools/trim-includes/build.sh b/tools/src/trim-includes/build.sh
similarity index 100%
rename from tools/trim-includes/build.sh
rename to tools/src/trim-includes/build.sh
diff --git a/tools/trim-includes/config.cfg b/tools/src/trim-includes/config.cfg
similarity index 100%
rename from tools/trim-includes/config.cfg
rename to tools/src/trim-includes/config.cfg
diff --git a/tools/trim-includes/glob/glob.go b/tools/src/trim-includes/glob/glob.go
similarity index 98%
rename from tools/trim-includes/glob/glob.go
rename to tools/src/trim-includes/glob/glob.go
index 7234007..8a9a9bb 100644
--- a/tools/trim-includes/glob/glob.go
+++ b/tools/src/trim-includes/glob/glob.go
@@ -23,7 +23,7 @@
 	"os"
 	"path/filepath"
 
-	"dawn.googlesource.com/tint/tools/trim-includes/match"
+	"dawn.googlesource.com/tint/tools/src/trim-includes/match"
 )
 
 // Scan walks all files and subdirectories from root, returning those
diff --git a/tools/src/trim-includes/go.mod b/tools/src/trim-includes/go.mod
new file mode 100644
index 0000000..294be66
--- /dev/null
+++ b/tools/src/trim-includes/go.mod
@@ -0,0 +1,3 @@
+module dawn.googlesource.com/tint/tools/src/trim-includes
+
+go 1.16
diff --git a/tools/trim-includes/main.go b/tools/src/trim-includes/main.go
similarity index 98%
rename from tools/trim-includes/main.go
rename to tools/src/trim-includes/main.go
index 3e049b9..0c411c3 100644
--- a/tools/trim-includes/main.go
+++ b/tools/src/trim-includes/main.go
@@ -35,7 +35,7 @@
 	"sync"
 	"time"
 
-	"dawn.googlesource.com/tint/tools/trim-includes/glob"
+	"dawn.googlesource.com/tint/tools/src/trim-includes/glob"
 )
 
 var (
diff --git a/tools/trim-includes/match/match.go b/tools/src/trim-includes/match/match.go
similarity index 100%
rename from tools/trim-includes/match/match.go
rename to tools/src/trim-includes/match/match.go
diff --git a/tools/trim-includes/match/match_test.go b/tools/src/trim-includes/match/match_test.go
similarity index 100%
rename from tools/trim-includes/match/match_test.go
rename to tools/src/trim-includes/match/match_test.go
diff --git a/tools/trim-includes/go.mod b/tools/trim-includes/go.mod
deleted file mode 100644
index 19aab32..0000000
--- a/tools/trim-includes/go.mod
+++ /dev/null
@@ -1,3 +0,0 @@
-module dawn.googlesource.com/tint/tools/trim-includes
-
-go 1.16