[PATCH] D15938: [test-suite] Prevent timeit and fpcmp from being rebuilt every time make is called.

Chad Rosier via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 14:33:25 PST 2016


mcrosier created this revision.
mcrosier added a reviewer: MatzeB.
mcrosier added a subscriber: llvm-commits.
mcrosier set the repository for this revision to rL LLVM.

Internally, our build system has an option to build External tests in parallel by calling make per benchmark.  Unfortunately, this causes a race condition because the timeit and fpcmp tools are built every time make is run (e.g., one instance of make tries to execute timeit, while another is rebuilding it).

This patch adds a custom_command level underneath the custom_targets for timeit and fpcmp to prevent the executables from being rebuilt every time make is called.

The custom_target rule will still be run every time, but the binaries will be detected as being up to date and skip rebuilding.

I’m a bit shaky on my CMake but I think this is the proper way to resolve the issue. 

Please take a look.

 Chad

Repository:
  rL LLVM

http://reviews.llvm.org/D15938

Files:
  tools/CMakeLists.txt

Index: tools/CMakeLists.txt
===================================================================
--- tools/CMakeLists.txt
+++ tools/CMakeLists.txt
@@ -1,13 +1,19 @@
-add_executable(timeit-target timeit.c)
+add_executable(timeit-target ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c)
 
 # FIXME: Replicate Makefile.tools's logic for determining whether to use fpcmp/fpcmp.sh
 set(TEST_SUITE_HOST_CC "cc" CACHE STRING "C compiler targetting the host")
 mark_as_advanced(TEST_SUITE_HOST_CC)
+
 add_custom_target(fpcmp
+    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/fpcmp)
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/fpcmp
   COMMAND ${TEST_SUITE_HOST_CC} ${CMAKE_CURRENT_SOURCE_DIR}/fpcmp.c -o ${CMAKE_CURRENT_BINARY_DIR}/fpcmp
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/fpcmp.c
 )
+
 add_custom_target(timeit
+    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/timeit)
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/timeit
   COMMAND ${TEST_SUITE_HOST_CC} ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c -o ${CMAKE_CURRENT_BINARY_DIR}/timeit
   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/timeit.c
 )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15938.44159.patch
Type: text/x-patch
Size: 1067 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160106/b26fc938/attachment.bin>


More information about the llvm-commits mailing list