From e253bcfff5efce1478bc6c5ec5e1edee4f07cf62 Mon Sep 17 00:00:00 2001 From: Baiju Meswani Date: Fri, 22 Nov 2024 23:29:08 +0000 Subject: [PATCH] Make tests discoverable at build time --- build.py | 4 ++-- test/CMakeLists.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index d8fb42867..f8ebc8c14 100644 --- a/build.py +++ b/build.py @@ -604,7 +604,7 @@ def test(args: argparse.Namespace, env: dict[str, str]): """ Run the tests. """ - lib_dir = args.build_dir / "test" + lib_dir = args.build_dir if util.is_windows(): # On Windows, the unit test executable is found inside a directory named after the configuration # (e.g. Debug, Release, etc.) within the test directory. @@ -616,7 +616,7 @@ def test(args: argparse.Namespace, env: dict[str, str]): lib_dir = args.ort_home / "lib" ctest_cmd = [str(args.ctest_path), "--build-config", args.config, "--verbose", "--timeout", "10800"] - util.run(ctest_cmd, cwd=str(args.build_dir / "test")) + util.run(ctest_cmd, cwd=str(args.build_dir)) if args.build_csharp: dotnet = str(_resolve_executable_path("dotnet")) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 75070cbd7..34e1ea4a8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -56,3 +56,4 @@ if (NOT MSVC) endif() include(GoogleTest) +gtest_discover_tests(unit_tests)