Skip to content

Commit 0b2dce0

Browse files
authored
Add an option to disable QEMU testing (#586)
Testing with QEMU is implicitly enabled by default, but configuring the project to run with tests requires QEMU. As testing with QEMU is considered optional, it should be possible to disable tests when QEMU is not available or testing is not needed. Since there is already an option for controlling FVP testing, this patch adds a similar option for QEMU, ENABLE_QEMU_TESTING, which instead defaults to ON. This can then be turned off when QEMU is not installed, so that configurations where QEMU is expected can suitably detect and show an error when it is missing.
1 parent cba1a32 commit 0b2dce0

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,14 @@ option(
150150
"During checkout, apply optional downstream patches to
151151
llvm-project to improve performance."
152152
)
153+
option(
154+
ENABLE_QEMU_TESTING
155+
"Enable tests that use QEMU. This option is ON by default."
156+
ON
157+
)
153158
option(
154159
ENABLE_FVP_TESTING
155-
"Tests using FVP need to be explictly enabled."
160+
"Enable tests that use FVPs. This option is OFF by default."
156161
)
157162
set(
158163
FVP_INSTALL_DIR
@@ -596,6 +601,7 @@ if(NOT PREBUILT_TARGET_LIBRARIES)
596601
-DENABLE_VARIANTS=${ENABLE_VARIANTS_PASSTHROUGH}
597602
-DLIBC_HDRGEN=${LIBC_HDRGEN}
598603
-DFVP_INSTALL_DIR=${FVP_INSTALL_DIR}
604+
-DENABLE_QEMU_TESTING=${ENABLE_QEMU_TESTING}
599605
-DENABLE_FVP_TESTING=${ENABLE_FVP_TESTING}
600606
-DFVP_CONFIG_DIR=${CMAKE_CURRENT_SOURCE_DIR}/fvp/config
601607
-DFETCHCONTENT_SOURCE_DIR_LLVMPROJECT=${FETCHCONTENT_SOURCE_DIR_LLVMPROJECT}

arm-multilib/CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,14 @@ set(C_LIBRARY "picolibc" CACHE STRING "Which C library to use.")
3333
set_property(CACHE C_LIBRARY PROPERTY STRINGS picolibc newlib llvmlibc)
3434
set(LLVM_BINARY_DIR "" CACHE PATH "Path to LLVM toolchain build or install root.")
3535
set(LIBC_HDRGEN "" CACHE PATH "Path to prebuilt lbc-hdrgen if not included in LLVM binaries set by LLVM_BINARY_DIR")
36+
option(
37+
ENABLE_QEMU_TESTING
38+
"Enable tests that use QEMU. This option is ON by default."
39+
ON
40+
)
3641
option(
3742
ENABLE_FVP_TESTING
38-
"Tests using FVP need to be explictly enabled."
43+
"Enable tests that use FVPs. This option is OFF by default."
3944
)
4045
set(
4146
FVP_INSTALL_DIR
@@ -162,9 +167,9 @@ foreach(lib_idx RANGE ${lib_count_dec})
162167
file(READ ${variant_json_file} variant_json_str)
163168
string(JSON test_executor GET ${variant_json_str} "args" "common" "TEST_EXECUTOR")
164169

165-
# FVP testing should default to off, so override any
166-
# settings from the JSON.
167-
if(test_executor STREQUAL "fvp" AND NOT ${ENABLE_FVP_TESTING})
170+
# The multilib project can be configured to disable QEMU and/or FVP
171+
# testing, which will need to override the settings from the json.
172+
if((test_executor STREQUAL "qemu" AND NOT ${ENABLE_QEMU_TESTING}) OR (test_executor STREQUAL "fvp" AND NOT ${ENABLE_FVP_TESTING}))
168173
list(APPEND additional_cmake_args "-DENABLE_LIBC_TESTS=OFF" "-DENABLE_COMPILER_RT_TESTS=OFF" "-DENABLE_LIBCXX_TESTS=OFF")
169174
set(read_ENABLE_LIBC_TESTS "OFF")
170175
set(read_ENABLE_COMPILER_RT_TESTS "OFF")

docs/building-from-source.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ $ brew install llvm python3 git make ninja qemu cmake
3636
$ pip install meson
3737
```
3838

39+
Testing with QEMU is enabled by default, but can be disabled using the
40+
`-DENABLE_QEMU_TESTING=OFF` CMake option if testing is not required or QEMU is
41+
not installed.
42+
3943
Some recent targets are not supported by QEMU, for these the Arm FVP models are
4044
used instead. These models are available free-of-change but are not
4145
open-source, and come with their own licenses.

0 commit comments

Comments
 (0)