Skip to content

Commit a086e60

Browse files
committed
[test-suite, CUDA] Update CUDA cmake files.
This should unbreak CUDA buildbots. The problem is that CUDA test suite is generating multiple test executables that all use the same reference output file and that resulted in multiple compilation jobs attempting to create the same symlink at the same time. This patch adds a SUFFIX parameter to make it possible to append a suffix to the target file name and that allows us to avoid name clashes. Differential Revision: https://reviews.llvm.org/D51663 llvm-svn: 341430
1 parent a659d5c commit a086e60

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

External/CUDA/CMakeLists.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,21 @@ macro(create_one_local_test_f Name FileGlob FilterRegex)
5757
cuda_glob(_sources ${FileGlob})
5858
set(_executable ${Name}-${VariantSuffix})
5959
set(_executable_path ${CMAKE_CURRENT_BINARY_DIR}/${_executable})
60+
llvm_test_run()
61+
set(REFERENCE_OUTPUT)
6062
# Verify reference output if it exists.
6163
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${Name}.reference_output)
62-
llvm_test_traditional(${Name})
64+
set(REFERENCE_OUTPUT ${Name}.reference_output)
65+
llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
66+
${FPCMP} %o ${REFERENCE_OUTPUT}-${VariantSuffix}
67+
)
68+
llvm_test_executable(${_executable} ${_sources})
69+
llvm_test_data(${_executable}
70+
DEST_SUFFIX "-${VariantSuffix}"
71+
${REFERENCE_OUTPUT})
6372
else()
64-
# otherwise just run the executable.
65-
llvm_test_run()
73+
llvm_test_executable(${_executable} ${_sources})
6674
endif()
67-
llvm_test_executable(${_executable} ${_sources})
6875
target_compile_options(${_executable} PUBLIC ${VariantCPPFLAGS})
6976
if(VariantLibs)
7077
target_link_libraries(${_executable} ${VariantLibs})

cmake/modules/TestSuite.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,28 @@ mark_as_advanced(TEST_SUITE_COPY_DATA)
1818
# directory of the benchmark executable.
1919
# Paths are interepreted relative to CMAKE_CURRENT_SOURCE_DIR by default but
2020
# this can be changed with the SOURCE_DIR argument.
21+
# If DEST_SUFFIX is specified, it's appended to the destination file names.
2122
function(llvm_test_data target)
22-
cmake_parse_arguments(_LTDARGS "MUST_COPY" "SOURCE_DIR" "" ${ARGN})
23+
cmake_parse_arguments(_LTDARGS "MUST_COPY" "SOURCE_DIR;DEST_SUFFIX" "" ${ARGN})
2324
set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
2425
if(_LTDARGS_SOURCE_DIR)
2526
set(SOURCE_DIR ${_LTDARGS_SOURCE_DIR})
2627
endif()
28+
set(SUFFIX ${_LTDARGS_DEST_SUFFIX})
2729
foreach(file ${_LTDARGS_UNPARSED_ARGUMENTS})
2830
set(full_path ${SOURCE_DIR}/${file})
2931
if(_LTDARGS_MUST_COPY OR TEST_SUITE_COPY_DATA)
3032
if(IS_DIRECTORY ${full_path})
31-
llvm_copy_dir(${target} $<TARGET_FILE_DIR:${target}>/${file} ${full_path})
33+
llvm_copy_dir(${target} $<TARGET_FILE_DIR:${target}>/${file}${SUFFIX} ${full_path})
3234
else()
33-
llvm_copy(${target} $<TARGET_FILE_DIR:${target}>/${file} ${full_path})
35+
llvm_copy(${target} $<TARGET_FILE_DIR:${target}>/${file}${SUFFIX} ${full_path})
3436
endif()
3537
else()
3638
get_filename_component(file_subdir ${file} DIRECTORY)
3739
if(file_subdir)
3840
llvm_make_directory(${target} ${file_subdir})
3941
endif()
40-
llvm_create_symlink(${target} $<TARGET_FILE_DIR:${target}>/${file} ${full_path})
42+
llvm_create_symlink(${target} $<TARGET_FILE_DIR:${target}>/${file}${SUFFIX} ${full_path})
4143
endif()
4244
endforeach()
4345
endfunction()

0 commit comments

Comments
 (0)