[compiler-rt] r326842 - [XRay][compiler-rt] Make unit tests depend on implementation files
Dean Michael Berris via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 6 15:06:09 PST 2018
Author: dberris
Date: Tue Mar 6 15:06:09 2018
New Revision: 326842
URL: http://llvm.org/viewvc/llvm-project?rev=326842&view=rev
Log:
[XRay][compiler-rt] Make unit tests depend on implementation files
Summary:
This change makes changes to XRay implementation files trigger re-builds
of the unit tests. Prior to this change, the unit tests were not built
and run properly if the implementation files were changed during the
development process. This change forces the dependency on all files in
the XRay include and lib hosted files in compiler-rt.
Caveat is, that new files added to the director(ies) will need a re-run
of CMake to re-generate the fileset.
We think this is an OK compromise, since adding new files may
necessitate editing (or adding) new unit tests. It's also less likely
that we're adding new files without updating the CMake configuration to
include the functionality in the XRay runtime implementation anyway.
Reviewers: pelikan, kpw, nglevin
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D44080
Modified:
compiler-rt/trunk/lib/xray/tests/CMakeLists.txt
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=326842&r1=326841&r2=326842&view=diff
==============================================================================
--- compiler-rt/trunk/lib/xray/tests/CMakeLists.txt (original)
+++ compiler-rt/trunk/lib/xray/tests/CMakeLists.txt Tue Mar 6 15:06:09 2018
@@ -3,6 +3,12 @@ include_directories(..)
add_custom_target(XRayUnitTests)
set_target_properties(XRayUnitTests PROPERTIES FOLDER "XRay unittests")
+# Create an XRAY_IMPL_FILES variable which will include all the implementation
+# files that are in the lib directory. Unfortunately, when new files are added
+# to the implementation, CMake must be run so that this variable is
+# re-generated.
+file(GLOB XRAY_IMPL_FILES "../*.cc" "../*.h")
+
set(XRAY_UNITTEST_CFLAGS
${XRAY_CFLAGS}
${COMPILER_RT_UNITTEST_CFLAGS}
@@ -24,6 +30,11 @@ macro(add_xray_unittest testname)
generate_compiler_rt_tests(TEST_OBJECTS
XRayUnitTests "${testname}-${arch}-Test" "${arch}"
SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE}
+ # Note that any change in the implementations will cause all the unit
+ # 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}
DEPS gtest xray llvm-xray
CFLAGS ${XRAY_UNITTEST_CFLAGS}
LINK_FLAGS -fxray-instrument
More information about the llvm-commits
mailing list