[NFC][CFI] Fix test from #137245 (#137420)

Check if arch supports CFI.

For #137245
diff --git a/compiler-rt/test/ubsan_minimal/CMakeLists.txt b/compiler-rt/test/ubsan_minimal/CMakeLists.txt
index dea0b4f..819428c 100644
--- a/compiler-rt/test/ubsan_minimal/CMakeLists.txt
+++ b/compiler-rt/test/ubsan_minimal/CMakeLists.txt
@@ -13,6 +13,8 @@
   string(TOLOWER "-${arch}-${OS_NAME}" UBSAN_TEST_CONFIG_SUFFIX)
   get_test_cc_for_arch(${arch} UBSAN_TEST_TARGET_CC UBSAN_TEST_TARGET_CFLAGS)
   set(CONFIG_NAME ${arch})
+  set(UBSAN_TEST_HAS_CFI ${arch} IN_LIST CFI_SUPPORTED_ARCH)
+  pythonize_bool(UBSAN_TEST_HAS_CFI)
   configure_lit_site_cfg(
     ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
     ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_NAME}/lit.site.cfg.py)
diff --git a/compiler-rt/test/ubsan_minimal/TestCases/icall.c b/compiler-rt/test/ubsan_minimal/TestCases/icall.c
index 25ef318..6948057 100644
--- a/compiler-rt/test/ubsan_minimal/TestCases/icall.c
+++ b/compiler-rt/test/ubsan_minimal/TestCases/icall.c
@@ -1,7 +1,7 @@
 // RUN: %clang -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall                              -fuse-ld=lld -flto -fvisibility=hidden %s -o %t && not --crash %run %t 2>&1 | FileCheck %s
 // RUN: %clang -fsanitize=cfi-icall -fno-sanitize-trap=cfi-icall -fsanitize-recover=cfi-icall -fuse-ld=lld -flto -fvisibility=hidden %s -o %t &&             %run %t 2>&1 | FileCheck %s
 
-// REQUIRES: lld-available
+// REQUIRES: lld-available, cfi
 
 void f() {}
 
diff --git a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
index 115bd24..714241a 100644
--- a/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
+++ b/compiler-rt/test/ubsan_minimal/lit.common.cfg.py
@@ -45,6 +45,9 @@
 ]:  # TODO: Windows
     config.unsupported = True
 
+if config.test_cfi:
+    config.available_features.add("cfi")
+
 # Don't target x86_64h if the test machine can't execute x86_64h binaries.
 if "-arch x86_64h" in target_cflags and "x86_64h" not in config.available_features:
     config.unsupported = True
diff --git a/compiler-rt/test/ubsan_minimal/lit.site.cfg.py.in b/compiler-rt/test/ubsan_minimal/lit.site.cfg.py.in
index 83a2824..457ddff 100644
--- a/compiler-rt/test/ubsan_minimal/lit.site.cfg.py.in
+++ b/compiler-rt/test/ubsan_minimal/lit.site.cfg.py.in
@@ -5,6 +5,7 @@
 # Tool-specific config options.
 config.target_cflags = "@UBSAN_TEST_TARGET_CFLAGS@"
 config.target_arch = "@UBSAN_TEST_TARGET_ARCH@"
+config.test_cfi = "@UBSAN_TEST_HAS_CFI_PYBOOL@"
 
 # Load common config for all compiler-rt lit tests.
 lit_config.load_config(config, "@COMPILER_RT_BINARY_DIR@/test/lit.common.configured")