[llvm] [runtimes] Fix check-runtimes when target-specific compiler-rt tests are disabled (PR #73610)

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 19:38:48 PST 2023


https://github.com/tstellar created https://github.com/llvm/llvm-project/pull/73610

It's possible to pass options like -DRUNTIMES_aarch64-linux-android21_LLVM_INCLUDE_TESTS=OFF to cmake which will disable tests for specific compiler-rt targets. llvm/runtimes/CMakeLists.txt assumes that when LLVM_INCLUDE_TESTS is enabled that each target's compiler-rt tests will run too, but this is not the case when the option above is used.

With this patch, the check-runtimes target will do nothing when these options are used instead of emitting an error.  It also fixes the test-depends target with this config.

This fix should allow 7f215b1380da49dccbf57da3040a40d25ed898f4 to be re-committed.

>From e2aa6ebdb3181412a87d6094efc7350e41f7bc1f Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar at redhat.com>
Date: Mon, 27 Nov 2023 22:51:12 +0000
Subject: [PATCH] [runtimes] Fix check-runtimes when target-specific
 compiler-rt tests are disabled

It's possible to pass options like -DRUNTIMES_aarch64-linux-android21_LLVM_INCLUDE_TESTS=OFF
to cmake which will disable tests for specific compiler-rt targets.
llvm/runtimes/CMakeLists.txt assumes that when LLVM_INCLUDE_TESTS is
enabled that each target's compiler-rt tests will run too, but this
is not the case when the option above is used.

With this patch, the check-runtimes target will do nothing when these
options are used instead of emitting an error.  It also fixes the
test-depends target with this config.

This fix should allow 7f215b1380da49dccbf57da3040a40d25ed898f4 to
be re-committed.
---
 llvm/runtimes/CMakeLists.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index a464c6c43af7b9c..28484cb93050b6b 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -272,6 +272,7 @@ function(runtime_register_target name)
   cmake_parse_arguments(ARG "" "BASE_NAME" "DEPENDS;CMAKE_ARGS;EXTRA_ARGS" ${ARGN})
   include(${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake OPTIONAL)
   set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Components.cmake)
+  set(runtime_tests_enabled ${LLVM_INCLUDE_TESTS})
 
   set(runtime_names ${RUNTIME_NAMES})
   foreach(_name IN ITEMS ${ARG_BASE_NAME} ${name})
@@ -348,6 +349,9 @@ function(runtime_register_target name)
       string(FIND "${variable_name}" "RUNTIMES_${extra_name}_" out)
       if("${out}" EQUAL 0)
         string(REPLACE "RUNTIMES_${extra_name}_" "" new_name ${variable_name})
+        if (new_name STREQUAL "LLVM_INCLUDE_TESTS")
+          set(runtime_tests_enabled ${${variable_name}})
+        endif()
         if(new_name STREQUAL CACHE_FILES)
           foreach(cache IN LISTS ${variable_name})
             list(APPEND ${name}_extra_args -C ${cache})
@@ -386,7 +390,7 @@ function(runtime_register_target name)
   add_dependencies(runtimes-configure runtimes-${name}-configure)
   add_dependencies(install-runtimes install-runtimes-${name})
   add_dependencies(install-runtimes-stripped install-runtimes-${name}-stripped)
-  if(LLVM_INCLUDE_TESTS)
+  if(LLVM_INCLUDE_TESTS AND runtime_tests_enabled)
     add_dependencies(check-runtimes check-runtimes-${name})
     add_dependencies(runtimes-test-depends runtimes-test-depends-${name})
   endif()



More information about the llvm-commits mailing list