Skip to content

Commit 2148e46

Browse files
committed
Add an option to disable QEMU testing
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 14871ac commit 2148e46

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ option(
150150
"During checkout, apply optional downstream patches to
151151
llvm-project to improve performance."
152152
)
153+
option(
154+
ENABLE_QEMU_TESTING
155+
"Tests using QEMU are enabled by default, but can be disabled."
156+
ON
157+
)
153158
option(
154159
ENABLE_FVP_TESTING
155160
"Tests using FVP need to be explictly enabled."
@@ -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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ 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+
"Tests using QEMU are enabled by default, but can be disabled."
39+
ON
40+
)
3641
option(
3742
ENABLE_FVP_TESTING
3843
"Tests using FVP need to be explictly enabled."
@@ -163,7 +168,7 @@ foreach(lib_idx RANGE ${lib_count_dec})
163168

164169
# FVP testing should default to off, so override any
165170
# settings from the JSON.
166-
if(test_executor STREQUAL "fvp" AND NOT ${ENABLE_FVP_TESTING})
171+
if((test_executor STREQUAL "qemu" AND NOT ${ENABLE_QEMU_TESTING}) OR (test_executor STREQUAL "fvp" AND NOT ${ENABLE_FVP_TESTING}))
167172
set(additional_cmake_args "-DENABLE_LIBC_TESTS=OFF" "-DENABLE_COMPILER_RT_TESTS=OFF" "-DENABLE_LIBCXX_TESTS=OFF")
168173
set(read_ENABLE_LIBC_TESTS "OFF")
169174
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)