[PATCH] D51048: cmake: Specify reference outputs in llvm_test_data()

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 31 17:40:05 PDT 2018


MatzeB added a comment.

In https://reviews.llvm.org/D51048#1221423, @tra wrote:

> I've ran into an unexpected problem after this patches have landed.
>
> CUDA test suite generates multiple tests that use the same reference output.
>  I can't just use llvm_test_data(test_XYZ, "test.reference_output"), because there can only be one test.reference_output in the build directory.
>  I also can't manually create a symlink $SRC/test.reference_output -> $BUILD_DIR/test-XYZ.reference_output and then use llvm_test_data(SOURCE_DIR=$BUILD_DIR test-XYZ.reference_output) because it can't link to itself.
>  The only way around is to create a new directory, symlink original file there as test_XYZ and then use the temp dir as SOURCE_DIR to create test_XYZ.reference_output in the build dir. This is rather convoluted.
>
> We probably need llvm_test_data with an optional argument that would allow providing a different name for the file name in the build dir, or make it unique automatically.


Possible fix for your case (untested as I don't have a CUDA environment):

  diff --git a/External/CUDA/CMakeLists.txt b/External/CUDA/CMakeLists.txt
  index 071ffbc9..63ab1e4c 100644
  --- a/External/CUDA/CMakeLists.txt
  +++ b/External/CUDA/CMakeLists.txt
  @@ -58,13 +58,16 @@ macro(create_one_local_test_f Name FileGlob FilterRegex)
       set(_executable ${Name}-${VariantSuffix})
       set(_executable_path ${CMAKE_CURRENT_BINARY_DIR}/${_executable})
       # Verify reference output if it exists.
  +    llvm_test_run()
  +    set(REFERENCE_OUTPUT)
       if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${Name}.reference_output)
  -      llvm_test_traditional(${Name})
  -    else()
  -      # otherwise just run the executable.
  -      llvm_test_run()
  +      set(REFERENCE_OUTPUT ${Name}.reference_output)
  +      llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
  +        ${FPCMP} %o ${REFERENCE_OUTPUT}
  +      )
       endif()
       llvm_test_executable(${_executable} ${_sources})
  +    llvm_test_data(${_executable} ${REFERENCE_OUTPUT})
       target_compile_options(${_executable} PUBLIC ${VariantCPPFLAGS})
       if(VariantLibs)
         target_link_libraries(${_executable} ${VariantLibs})


Repository:
  rT test-suite

https://reviews.llvm.org/D51048





More information about the llvm-commits mailing list