[compiler-rt] r336905 - [CMake] Remove unnecesary list of source files for Xray unit tests.

Dan Liew via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 12 06:48:18 PDT 2018


Author: delcypher
Date: Thu Jul 12 06:48:18 2018
New Revision: 336905

URL: http://llvm.org/viewvc/llvm-project?rev=336905&view=rev
Log:
[CMake] Remove unnecesary list of source files for Xray unit tests.

The list duplicates information already available in the parent
directory so use that instead. It is unclear to me why we need
to spell out the dependencies explicitly but fixing that should
be done in a separate patch.

Differential Revision: https://reviews.llvm.org/D49177

Modified:
    compiler-rt/trunk/lib/xray/CMakeLists.txt
    compiler-rt/trunk/lib/xray/tests/CMakeLists.txt

Modified: compiler-rt/trunk/lib/xray/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/CMakeLists.txt?rev=336905&r1=336904&r2=336905&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/xray/CMakeLists.txt Thu Jul 12 06:48:18 2018
@@ -85,6 +85,33 @@ set(XRAY_IMPL_HEADERS
   xray_utils.h
   xray_x86_64.inc)
 
+# Create list of all source files for
+# consumption by tests.
+set(XRAY_ALL_SOURCE_FILES
+  ${XRAY_SOURCES}
+  ${XRAY_FDR_MODE_SOURCES}
+  ${XRAY_BASIC_MODE_SOURCES}
+  ${XRAY_PROFILING_MODE_SOURCES}
+  ${x86_64_SOURCES}
+  ${arm_SOURCES}
+  ${armhf_SOURCES}
+  ${mips_SOURCES}
+  ${mipsel_SOURCES}
+  ${mips64_SOURCES}
+  ${mips64el_SOURCES}
+  ${powerpc64le_SOURCES}
+  ${XRAY_IMPL_HEADERS}
+)
+list(REMOVE_DUPLICATES XRAY_ALL_SOURCE_FILES)
+# Make list that uses absolute paths
+set(XRAY_ALL_SOURCE_FILES_ABS_PATHS "")
+foreach (src_file ${XRAY_ALL_SOURCE_FILES})
+  list(APPEND
+    XRAY_ALL_SOURCE_FILES_ABS_PATHS
+    "${CMAKE_CURRENT_SOURCE_DIR}/${src_file}")
+endforeach()
+
+
 # Now put it all together...
 include_directories(..)
 include_directories(../../include)

Modified: compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/xray/tests/CMakeLists.txt?rev=336905&r1=336904&r2=336905&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/xray/tests/CMakeLists.txt Thu Jul 12 06:48:18 2018
@@ -3,45 +3,17 @@ include_directories(..)
 add_custom_target(XRayUnitTests)
 set_target_properties(XRayUnitTests PROPERTIES FOLDER "XRay unittests")
 
-# Create an XRAY_IMPL_FILES variable which must include all the implementation
-# files that are in the lib directory. We *must* keep this list up-to-date.
-set(XRAY_IMPL_FILES
-  ../../xray_AArch64.cc
-  ../../xray_allocator.h
-  ../../xray_arm.cc
-  ../../xray_basic_flags.cc
-  ../../xray_basic_flags.h
-  ../../xray_basic_logging.cc
-  ../../xray_basic_logging.h
-  ../../xray_buffer_queue.cc
-  ../../xray_buffer_queue.h
-  ../../xray_defs.h
-  ../../xray_fdr_flags.cc
-  ../../xray_fdr_flags.h
-  ../../xray_fdr_logging.cc
-  ../../xray_fdr_logging.h
-  ../../xray_fdr_log_records.h
-  ../../xray_flags.cc
-  ../../xray_flags.h
-  ../../xray_function_call_trie.h
-  ../../xray_init.cc
-  ../../xray_interface.cc
-  ../../xray_interface_internal.h
-  ../../xray_log_interface.cc
-  ../../xray_mips64.cc
-  ../../xray_mips.cc
-  ../../xray_powerpc64.cc
-  ../../xray_profile_collector.cc
-  ../../xray_profile_collector.h
-  ../../xray_profiling_flags.cc
-  ../../xray_profiling_flags.h
-  ../../xray_recursion_guard.h
-  ../../xray_segmented_array.h
-  ../../xray_trampoline_powerpc64.cc
-  ../../xray_tsc.h
-  ../../xray_utils.cc
-  ../../xray_utils.h
-  ../../xray_x86_64.cc)
+# Sanity check XRAY_ALL_SOURCE_FILES_ABS_PATHS
+list(LENGTH XRAY_ALL_SOURCE_FILES_ABS_PATHS XASFAP_LENGTH)
+if (${XASFAP_LENGTH} EQUAL 0)
+  message(FATAL_ERROR "XRAY_ALL_SOURCE_FILES_ABS_PATHS cannot be empty")
+endif()
+unset(XASFAP_LENGTH)
+foreach (src_file ${XRAY_ALL_SOURCE_FILES_ABS_PATHS})
+  if (NOT EXISTS "${src_file}")
+    message(FATAL_ERROR "Source file \"${src_file}\" does not exist")
+  endif()
+endforeach()
 
 set(XRAY_UNITTEST_CFLAGS
   ${XRAY_CFLAGS}
@@ -94,7 +66,7 @@ macro(add_xray_unittest testname)
         # tests to be re-built. This is by design, but may be cumbersome during
         # the build/test cycle.
         COMPILE_DEPS ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
-        ${XRAY_HEADERS} ${XRAY_IMPL_FILES}
+        ${XRAY_HEADERS} ${XRAY_ALL_SOURCE_FILES_ABS_PATHS}
         RUNTIME "${XRAY_RUNTIME_LIBS}"
         DEPS gtest xray
         CFLAGS ${XRAY_UNITTEST_CFLAGS}




More information about the llvm-commits mailing list