[llvm] [unittest] Allow LLVM unit test to run under a wrapper program. (PR #66821)
Zero Omega via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 19 14:15:47 PDT 2023
https://github.com/zeroomega created https://github.com/llvm/llvm-project/pull/66821
This patch add CMake option "LLVM_GTEST_RUN_UNDER" to LLVM unittest configuration. When specified, LLVM unittest will be run under the wrapper program specified by this option. This feature can simplify the setup to run LLVM unittest on a target platform that is different than host.
>From aade5b5abf83adad83d3f0fe49741838ff7d709e Mon Sep 17 00:00:00 2001
From: Haowei Wu <haowei at google.com>
Date: Tue, 19 Sep 2023 14:03:27 -0700
Subject: [PATCH] [unittest] Allow LLVM unit test to run under a wrapper
program.
This patch add CMake option "LLVM_GTEST_RUN_UNDER" to LLVM unittest
configuration. When specified, LLVM unittest will be run under the
wrapper program specified by this option. This feature can simplify
the setup to run LLVM unittest on a target platform that is different
than host.
---
llvm/test/Unit/lit.cfg.py | 6 +++++-
llvm/test/Unit/lit.site.cfg.py.in | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/llvm/test/Unit/lit.cfg.py b/llvm/test/Unit/lit.cfg.py
index f15c30dbcdb0aa6..61296d7ea0032ef 100644
--- a/llvm/test/Unit/lit.cfg.py
+++ b/llvm/test/Unit/lit.cfg.py
@@ -19,7 +19,11 @@
config.test_source_root = config.test_exec_root
# testFormat: The test format to use to interpret tests.
-config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, "Tests")
+config.test_format = lit.formats.GoogleTest(
+ config.llvm_build_mode,
+ "Tests",
+ run_under=config.gtest_run_under,
+)
# Propagate the temp directory. Windows requires this because it uses \Windows\
# if none of these are present.
diff --git a/llvm/test/Unit/lit.site.cfg.py.in b/llvm/test/Unit/lit.site.cfg.py.in
index 1d7d76580149495..3536a34f796a28d 100644
--- a/llvm/test/Unit/lit.site.cfg.py.in
+++ b/llvm/test/Unit/lit.site.cfg.py.in
@@ -7,6 +7,7 @@ config.llvm_obj_root = path(r"@LLVM_BINARY_DIR@")
config.llvm_tools_dir = lit_config.substitute(path(r"@LLVM_TOOLS_DIR@"))
config.llvm_build_mode = lit_config.substitute("@LLVM_BUILD_MODE@")
config.shlibdir = lit_config.substitute(path(r"@SHLIBDIR@"))
+config.gtest_run_under = lit_config.substitute(r"@LLVM_GTEST_RUN_UNDER@")
# Let the main config do the real work.
lit_config.load_config(
More information about the llvm-commits
mailing list