[PATCH] D106415: [test-suite] Disable X-Ray tests if unavailable.

Michael Kruse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 18:27:54 PDT 2021


Meinersbur updated this revision to Diff 360335.
Meinersbur added a comment.

- Rename X-Ray to XRay


Repository:
  rT test-suite

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106415/new/

https://reviews.llvm.org/D106415

Files:
  MicroBenchmarks/XRay/CMakeLists.txt
  MicroBenchmarks/XRay/FDRMode/CMakeLists.txt
  MicroBenchmarks/XRay/ReturnReference/CMakeLists.txt


Index: MicroBenchmarks/XRay/ReturnReference/CMakeLists.txt
===================================================================
--- MicroBenchmarks/XRay/ReturnReference/CMakeLists.txt
+++ MicroBenchmarks/XRay/ReturnReference/CMakeLists.txt
@@ -1,14 +1,12 @@
-check_cxx_compiler_flag(-fxray-instrument COMPILER_HAS_FXRAY_INSTRUMENT)
-if(ARCH STREQUAL "x86" AND COMPILER_HAS_FXRAY_INSTRUMENT AND NOT TARGET_OS STREQUAL "Darwin")
-  # retref is currently failing on Darwin.
-  #
-  # ld: in section __DATA,xray_instr_map reloc 0: X86_64_RELOC_SUBTRACTOR must
-  # have r_extern=1 file
-  # 'MicroBenchmarks/XRay/ReturnReference/CMakeFiles/retref-bench.dir/retref-bench.cc.o'
-  # for architecture x86_64
-  list(APPEND CPPFLAGS -std=c++11 -Wl,--gc-sections -fxray-instrument)
-  list(APPEND LDFLAGS -fxray-instrument)
-  llvm_test_run()
-  llvm_test_executable(retref-bench retref-bench.cc)
-  target_link_libraries(retref-bench benchmark)
-endif()
+# ReturnReference is currently failing on Darwin.
+#
+# ld: in section __DATA,xray_instr_map reloc 0: X86_64_RELOC_SUBTRACTOR must
+# have r_extern=1 file
+# 'MicroBenchmarks/XRay/ReturnReference/CMakeFiles/retref-bench.dir/retref-bench.cc.o'
+# for architecture x86_64.
+
+list(APPEND CPPFLAGS -std=c++11 -Wl,--gc-sections -fxray-instrument)
+list(APPEND LDFLAGS -fxray-instrument)
+llvm_test_run()
+llvm_test_executable(retref-bench retref-bench.cc)
+target_link_libraries(retref-bench benchmark)
Index: MicroBenchmarks/XRay/FDRMode/CMakeLists.txt
===================================================================
--- MicroBenchmarks/XRay/FDRMode/CMakeLists.txt
+++ MicroBenchmarks/XRay/FDRMode/CMakeLists.txt
@@ -1,8 +1,8 @@
-check_cxx_compiler_flag(-fxray-instrument COMPILER_HAS_FXRAY_INSTRUMENT)
-if(ARCH STREQUAL "x86" AND COMPILER_HAS_FXRAY_INSTRUMENT)
-  list(APPEND CPPFLAGS -std=c++11 -Wl,--gc-sections -fxray-instrument)
-  list(APPEND LDFLAGS -fxray-instrument)
-  llvm_test_run()
-  llvm_test_executable(fdrmode-bench fdrmode-bench.cc)
-  target_link_libraries(fdrmode-bench benchmark)
-endif()
+# FDRMode test is failing on Darwin because
+# `__xray_log_select_mode("xray-fdr")` returns `XRAY_MODE_NOT_FOUND`.
+
+list(APPEND CPPFLAGS -std=c++11 -Wl,--gc-sections -fxray-instrument)
+list(APPEND LDFLAGS -fxray-instrument)
+llvm_test_run()
+llvm_test_executable(fdrmode-bench fdrmode-bench.cc)
+target_link_libraries(fdrmode-bench benchmark)
Index: MicroBenchmarks/XRay/CMakeLists.txt
===================================================================
--- MicroBenchmarks/XRay/CMakeLists.txt
+++ MicroBenchmarks/XRay/CMakeLists.txt
@@ -1,8 +1,13 @@
-add_subdirectory(ReturnReference)
-if(NOT TARGET_OS STREQUAL "Darwin")
-  # FDRMode test is failing on Darwin because
-  # `__xray_log_select_mode("xray-fdr")` returns `XRAY_MODE_NOT_FOUND`.
-  #
-  # Disable the test until it is fixed. rdar://problem/44578416
+include(CheckIncludeFiles)
+
+check_cxx_compiler_flag(-fxray-instrument COMPILER_HAS_FXRAY_INSTRUMENT)
+check_include_files("xray/xray_interface.h" HAVE_XRAY_INTERFACE_INCLUDE LANGUAGE CXX)
+
+if(COMPILER_HAS_FXRAY_INSTRUMENT AND HAVE_XRAY_INTERFACE_INCLUDE AND ARCH STREQUAL "x86" AND NOT TARGET_OS STREQUAL "Darwin")
+  message(STATUS "XRay tests enabled")
+
+  add_subdirectory(ReturnReference)
   add_subdirectory(FDRMode)
+else()
+  message(STATUS "Compiler does not support XRay; tests disabled")
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106415.360335.patch
Type: text/x-patch
Size: 3387 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210721/537a84d0/attachment.bin>


More information about the llvm-commits mailing list