aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristof Beyls <kristof.beyls@arm.com>2019-07-11 14:29:58 +0000
committerKristof Beyls <kristof.beyls@arm.com>2019-07-11 14:29:58 +0000
commit83027e4f36430597a803f48d37f8dc5d156257ce (patch)
treed92cb5c6f3a8cf5c62d856e968e69504eb7f8494
parent16ace0fb5752936746959ad5e04f3312b732f7d9 (diff)
Fix support for user mode emulation when using cmake/lit.
When using user mode emulation, i.e. cross-compiling programs for a different target and running them on a host under qemu user mode emulation, timeit and fpcmp should have host versions, not target versions. Running under user mode emulation had been broken for a while, presumably since https://reviews.llvm.org/rT341257 I first tried an alternative approach where fpcmp would be run under qemu user mode emulation too. That in itself worked, but if going for that approach, for orthogonality reasons, we probably should also run the other helper programs as if they were running on the target, i.e. also under qemu user mode emulation. I ran into issues with running timeit under qemu user mode emulation and also running RunSafely.sh under user mode emulation doesn't seem trivial. In the end, it seemed better to me to explicitly add a cmake option to mark that we're running under qemu user mode emulation, and in that mode, only aim to run the test/benchmark under qemu user mode emulation, rather than also all the helper programs (such as fpcmp, timeit, RunSafely.sh) under it (which is what would be needed if we just kept on using only the RUN_UNDER option for qemu user mode emulation. Differential Revision: https://reviews.llvm.org/D61597 git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@365783 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt17
-rw-r--r--cmake/modules/TestSuite.cmake3
-rw-r--r--lit.site.cfg.in1
-rw-r--r--litsupport/modules/timeit.py9
-rw-r--r--tools/CMakeLists.txt4
5 files changed, 30 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2385fc3d..2d058770 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,6 +77,18 @@ endif()
# Run Under configuration for RunSafely.sh (will be set in lit.site.cfg)
set(TEST_SUITE_RUN_UNDER "" CACHE STRING "RunSafely.sh run-under (-u) parameter")
+# User mode emulation configuration (e.g. running under qemu)
+# (will be set in lit.site.cfg)
+set(TEST_SUITE_USER_MODE_EMULATION NO CACHE BOOL
+ "RUN_UNDER is used to run tests under emulation.")
+# Set value to python style True/False
+if (TEST_SUITE_USER_MODE_EMULATION)
+ set(TEST_SUITE_USER_MODE_EMULATION "True")
+else()
+ set(TEST_SUITE_USER_MODE_EMULATION "False")
+endif()
+
+
# run type/benchmark size configuration (mostly for SPEC at the moment)
set(TEST_SUITE_RUN_TYPE "train" CACHE STRING
"Type of benchmark inputs (may be test,train or ref)")
@@ -220,7 +232,10 @@ mark_as_advanced(TEST_SUITE_LIT)
add_subdirectory(tools)
# Shortcut for the path to the fpcmp executable
-set(FPCMP ${CMAKE_BINARY_DIR}/tools/fpcmp)
+set(FPCMP ${CMAKE_BINARY_DIR}/tools/fpcmp-target)
+if (TEST_SUITE_USER_MODE_EMULATION)
+ set(FPCMP ${CMAKE_BINARY_DIR}/tools/fpcmp)
+endif()
option(TEST_SUITE_COLLECT_COMPILE_TIME
"Measure compile time by wrapping compiler invocations in timeit" ON)
diff --git a/cmake/modules/TestSuite.cmake b/cmake/modules/TestSuite.cmake
index 194e57ac..b87a06ce 100644
--- a/cmake/modules/TestSuite.cmake
+++ b/cmake/modules/TestSuite.cmake
@@ -99,7 +99,8 @@ function(test_suite_add_build_dependencies target)
build-HashProgramOutput.sh
build-timeit
build-timeit-target
- fpcmp
+ build-fpcmp
+ build-fpcmp-target
)
endfunction()
diff --git a/lit.site.cfg.in b/lit.site.cfg.in
index 0e2819a4..ddbaeb75 100644
--- a/lit.site.cfg.in
+++ b/lit.site.cfg.in
@@ -5,6 +5,7 @@ config.test_exec_root = "@CMAKE_BINARY_DIR@"
config.remote_client = "@TEST_SUITE_REMOTE_CLIENT@"
config.remote_host = "@TEST_SUITE_REMOTE_HOST@"
config.run_under = "@TEST_SUITE_RUN_UNDER@"
+config.user_mode_emulation = @TEST_SUITE_USER_MODE_EMULATION@
config.strip_tool = "@CMAKE_STRIP@"
config.profile_generate = @TEST_SUITE_PROFILE_GENERATE@
config.llvm_profdata = "@TEST_SUITE_LLVM_PROFDATA@"
diff --git a/litsupport/modules/timeit.py b/litsupport/modules/timeit.py
index c6725a22..26b119da 100644
--- a/litsupport/modules/timeit.py
+++ b/litsupport/modules/timeit.py
@@ -9,7 +9,14 @@ def _mutateCommandLine(context, commandline):
config = context.config
cmd = shellcommand.parse(commandline)
- timeit = "%s/tools/timeit-target" % config.test_source_root
+ if config.user_mode_emulation:
+ # user_mode_emulation should be true if tests are being run via
+ # user-mode emulation (e.g. Qemu) and thus the host version of timeit
+ # should be used.
+ timeit_name = "timeit"
+ else:
+ timeit_name = "timeit-target"
+ timeit = "%s/tools/%s" % (config.test_source_root, timeit_name)
args = ["--limit-core", "0"]
args += ["--limit-cpu", "7200"]
args += ["--timeout", "7200"]
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index a791a800..20f35a7b 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -7,7 +7,9 @@
include(Host)
-add_executable(fpcmp fpcmp.c)
+add_executable(fpcmp-target ${CMAKE_CURRENT_SOURCE_DIR}/fpcmp.c)
+add_executable(build-fpcmp-target ALIAS fpcmp-target)
+llvm_add_host_executable(build-fpcmp fpcmp fpcmp.c)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/HashProgramOutput.sh