From 434cd396fef7c6f9ea895af565638db3bfe25818 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Fri, 16 Apr 2021 10:42:24 +0000 Subject: [PATCH] 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 Reviewed-by: Antonio Maiorano --- tools/fix-tests | 30 +++++++++++++++++++ tools/fix-tests/go.mod | 5 ---- tools/lint | 2 +- tools/{ => src}/fix-tests/fix-tests.go | 2 +- tools/src/fix-tests/go.mod | 5 ++++ tools/{ => src}/fix-tests/go.sum | 0 tools/{ => src}/fix-tests/substr/substr.go | 0 .../{ => src}/fix-tests/substr/substr_test.go | 0 tools/{ => src}/run-parallel/main.go | 0 tools/{ => src}/trim-includes/build.sh | 0 tools/{ => src}/trim-includes/config.cfg | 0 tools/{ => src}/trim-includes/glob/glob.go | 2 +- tools/src/trim-includes/go.mod | 3 ++ tools/{ => src}/trim-includes/main.go | 2 +- tools/{ => src}/trim-includes/match/match.go | 0 .../trim-includes/match/match_test.go | 0 tools/trim-includes/go.mod | 3 -- 17 files changed, 42 insertions(+), 12 deletions(-) create mode 100755 tools/fix-tests delete mode 100644 tools/fix-tests/go.mod rename tools/{ => src}/fix-tests/fix-tests.go (99%) create mode 100644 tools/src/fix-tests/go.mod rename tools/{ => src}/fix-tests/go.sum (100%) rename tools/{ => src}/fix-tests/substr/substr.go (100%) rename tools/{ => src}/fix-tests/substr/substr_test.go (100%) rename tools/{ => src}/run-parallel/main.go (100%) rename tools/{ => src}/trim-includes/build.sh (100%) rename tools/{ => src}/trim-includes/config.cfg (100%) rename tools/{ => src}/trim-includes/glob/glob.go (98%) create mode 100644 tools/src/trim-includes/go.mod rename tools/{ => src}/trim-includes/main.go (99%) rename tools/{ => src}/trim-includes/match/match.go (100%) rename tools/{ => src}/trim-includes/match/match_test.go (100%) delete mode 100644 tools/trim-includes/go.mod diff --git a/tools/fix-tests b/tools/fix-tests new file mode 100755 index 0000000000..ad5915d167 --- /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 099add3915..0000000000 --- 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 1224c0e50c..0c53516711 100755 --- a/tools/lint +++ b/tools/lint @@ -25,7 +25,7 @@ FILES="`find src -type f` `find samples -type f`" 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 50f60e9e15..9b80381b7e 100644 --- a/tools/fix-tests/fix-tests.go +++ b/tools/src/fix-tests/fix-tests.go @@ -26,7 +26,7 @@ import ( "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 0000000000..b7ba1a0a23 --- /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 723400792e..8a9a9bb901 100644 --- a/tools/trim-includes/glob/glob.go +++ b/tools/src/trim-includes/glob/glob.go @@ -23,7 +23,7 @@ import ( "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 0000000000..294be66876 --- /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 99% rename from tools/trim-includes/main.go rename to tools/src/trim-includes/main.go index 3e049b9024..0c411c3f94 100644 --- a/tools/trim-includes/main.go +++ b/tools/src/trim-includes/main.go @@ -35,7 +35,7 @@ import ( "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 19aab3255c..0000000000 --- a/tools/trim-includes/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module dawn.googlesource.com/tint/tools/trim-includes - -go 1.16