[tint] Move test and benchmark mains to cmd.
Keeps all the executables (with exception to fuzzers) in one directory.
Fuzzers might get moved over in the future.
Change-Id: Ieff07149f86ff7950de9c6e4d5e93cd218ffca16
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/145880
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/BUILD.gn b/src/tint/BUILD.gn
index 9ab4eee..dfec136 100644
--- a/src/tint/BUILD.gn
+++ b/src/tint/BUILD.gn
@@ -1513,7 +1513,7 @@
if (build_with_chromium) {
sources = [ "//gpu/tint_unittests_main.cc" ]
} else {
- sources = [ "test_main.cc" ]
+ sources = [ "cmd/test/main_test.cc" ]
configs += [ ":tint_unittests_config" ]
deps += [ ":libtint" ]
diff --git a/src/tint/CMakeLists.txt b/src/tint/CMakeLists.txt
index fa446bb..70f1821 100644
--- a/src/tint/CMakeLists.txt
+++ b/src/tint/CMakeLists.txt
@@ -978,6 +978,7 @@
################################################################################
if(TINT_BUILD_TESTS)
list(APPEND TINT_TEST_SRCS
+ cmd/test/main_test.cc
lang/core/number_test.cc
lang/core/constant/composite_test.cc
lang/core/constant/manager_test.cc
@@ -1147,7 +1148,6 @@
lang/wgsl/resolver/value_constructor_validation_test.cc
lang/wgsl/resolver/variable_test.cc
lang/wgsl/resolver/variable_validation_test.cc
- test_main.cc
utils/cli/cli_test.cc
utils/command/command_test.cc
utils/containers/bitset_test.cc
@@ -1764,7 +1764,7 @@
list(APPEND TINT_BENCHMARK_SRCS
"utils/rtti/switch_bench.cc"
- "bench/benchmark.cc"
+ "cmd/bench/main_bench.cc"
"lang/wgsl/reader/reader_bench.cc"
)
diff --git a/src/tint/bench/benchmark.h b/src/tint/cmd/bench/bench.h
similarity index 95%
rename from src/tint/bench/benchmark.h
rename to src/tint/cmd/bench/bench.h
index c9e90ba..e813c4a 100644
--- a/src/tint/bench/benchmark.h
+++ b/src/tint/cmd/bench/bench.h
@@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#ifndef SRC_TINT_BENCH_BENCHMARK_H_
-#define SRC_TINT_BENCH_BENCHMARK_H_
+#ifndef SRC_TINT_CMD_BENCH_BENCH_H_
+#define SRC_TINT_CMD_BENCH_BENCH_H_
#include <memory>
#include <string>
#include <variant>
#include "benchmark/benchmark.h"
+#include "src/tint/lang/wgsl/program/program.h"
#include "src/tint/utils/macros/concat.h"
-#include "tint/tint.h"
namespace tint::bench {
@@ -87,4 +87,4 @@
} // namespace tint::bench
-#endif // SRC_TINT_BENCH_BENCHMARK_H_
+#endif // SRC_TINT_CMD_BENCH_BENCH_H_
diff --git a/src/tint/bench/benchmark.cc b/src/tint/cmd/bench/main_bench.cc
similarity index 95%
rename from src/tint/bench/benchmark.cc
rename to src/tint/cmd/bench/main_bench.cc
index c70b3cb..eaf8546 100644
--- a/src/tint/bench/benchmark.cc
+++ b/src/tint/cmd/bench/main_bench.cc
@@ -12,13 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include "src/tint/bench/benchmark.h"
-
#include <filesystem>
#include <iostream>
#include <utility>
#include <vector>
+#include "src/tint/cmd/bench/bench.h"
+#include "src/tint/lang/spirv/reader/reader.h"
+#include "src/tint/lang/wgsl/reader/reader.h"
+#include "src/tint/lang/wgsl/writer/writer.h"
#include "src/tint/utils/text/string.h"
#include "src/tint/utils/text/string_stream.h"
diff --git a/src/tint/test_main.cc b/src/tint/cmd/test/main_test.cc
similarity index 100%
rename from src/tint/test_main.cc
rename to src/tint/cmd/test/main_test.cc
diff --git a/src/tint/lang/glsl/writer/writer_bench.cc b/src/tint/lang/glsl/writer/writer_bench.cc
index a533f1a..6d433f7 100644
--- a/src/tint/lang/glsl/writer/writer_bench.cc
+++ b/src/tint/lang/glsl/writer/writer_bench.cc
@@ -14,7 +14,8 @@
#include <string>
-#include "src/tint/bench/benchmark.h"
+#include "src/tint/cmd/bench/bench.h"
+#include "src/tint/lang/glsl/writer/writer.h"
#include "src/tint/lang/wgsl/ast/identifier.h"
#include "src/tint/lang/wgsl/ast/module.h"
diff --git a/src/tint/lang/hlsl/writer/writer_bench.cc b/src/tint/lang/hlsl/writer/writer_bench.cc
index 1831f22..16337e1 100644
--- a/src/tint/lang/hlsl/writer/writer_bench.cc
+++ b/src/tint/lang/hlsl/writer/writer_bench.cc
@@ -14,7 +14,8 @@
#include <string>
-#include "src/tint/bench/benchmark.h"
+#include "src/tint/cmd/bench/bench.h"
+#include "src/tint/lang/hlsl/writer/writer.h"
namespace tint::hlsl::writer {
namespace {
diff --git a/src/tint/lang/msl/writer/writer_bench.cc b/src/tint/lang/msl/writer/writer_bench.cc
index 9e8e008..b10a350 100644
--- a/src/tint/lang/msl/writer/writer_bench.cc
+++ b/src/tint/lang/msl/writer/writer_bench.cc
@@ -14,7 +14,8 @@
#include <string>
-#include "src/tint/bench/benchmark.h"
+#include "src/tint/cmd/bench/bench.h"
+#include "src/tint/lang/msl/writer/writer.h"
#include "src/tint/lang/wgsl/ast/module.h"
#include "src/tint/lang/wgsl/sem/variable.h"
diff --git a/src/tint/lang/spirv/writer/writer_bench.cc b/src/tint/lang/spirv/writer/writer_bench.cc
index 85a4080..3d74eb8 100644
--- a/src/tint/lang/spirv/writer/writer_bench.cc
+++ b/src/tint/lang/spirv/writer/writer_bench.cc
@@ -14,7 +14,8 @@
#include <string>
-#include "src/tint/bench/benchmark.h"
+#include "src/tint/cmd/bench/bench.h"
+#include "src/tint/lang/spirv/writer/writer.h"
namespace tint::spirv::writer {
namespace {
diff --git a/src/tint/lang/wgsl/reader/reader_bench.cc b/src/tint/lang/wgsl/reader/reader_bench.cc
index 9ba155d..b5f736a 100644
--- a/src/tint/lang/wgsl/reader/reader_bench.cc
+++ b/src/tint/lang/wgsl/reader/reader_bench.cc
@@ -14,7 +14,8 @@
#include <string>
-#include "src/tint/bench/benchmark.h"
+#include "src/tint/cmd/bench/bench.h"
+#include "src/tint/lang/wgsl/reader/reader.h"
namespace tint::wgsl::reader {
namespace {
diff --git a/src/tint/lang/wgsl/writer/writer_bench.cc b/src/tint/lang/wgsl/writer/writer_bench.cc
index 5974042..8996be2 100644
--- a/src/tint/lang/wgsl/writer/writer_bench.cc
+++ b/src/tint/lang/wgsl/writer/writer_bench.cc
@@ -14,8 +14,8 @@
#include <string>
-#include "src/tint/bench/benchmark.h"
-#include "src/tint/lang/msl/writer/writer.h"
+#include "src/tint/cmd/bench/bench.h"
+#include "src/tint/lang/wgsl/writer/writer.h"
namespace tint::wgsl::writer {
namespace {