[test-suite] r341255 - cmake: Specify reference outputs in llvm_test_data()
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 31 14:06:24 PDT 2018
Author: matze
Date: Fri Aug 31 14:06:23 2018
New Revision: 341255
URL: http://llvm.org/viewvc/llvm-project?rev=341255&view=rev
Log:
cmake: Specify reference outputs in llvm_test_data()
Specify reference outputs in llvm_test_data() so they get copied to the
builddir and used from there.
Differential Revision: https://reviews.llvm.org/D51048
Modified:
test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/ImageProcessing/BilateralFiltering/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/ImageProcessing/Dilate/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt
test-suite/trunk/MicroBenchmarks/harris/CMakeLists.txt
test-suite/trunk/cmake/modules/SingleMultiSource.cmake
test-suite/trunk/cmake/modules/TestFile.cmake
test-suite/trunk/cmake/modules/TestSuite.cmake
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/AnisotropicDiffusion/CMakeLists.txt Fri Aug 31 14:06:23 2018
@@ -3,10 +3,13 @@ set(IMAGEPROC_UTILS MicroBenchmarks/Imag
list(APPEND CXXFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS})
list(APPEND LDFLAGS -lm)
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/anisotropicDiffusionOutput.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/anisotropicDiffusionOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/anisotropicDiffusion.reference_output")
+llvm_test_verify_hash_program_output(anisotropicDiffusionOutput.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} anisotropicDiffusion.reference_output anisotropicDiffusionOutput.txt
+)
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
llvm_test_executable(AnisotropicDiffusion ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c main.cpp anisotropicDiffusionKernel.c)
+llvm_test_data(AnisotropicDiffusion anisotropicDiffusion.reference_output)
target_link_libraries(AnisotropicDiffusion benchmark)
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/BilateralFiltering/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/BilateralFiltering/CMakeLists.txt?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/BilateralFiltering/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/BilateralFiltering/CMakeLists.txt Fri Aug 31 14:06:23 2018
@@ -2,10 +2,13 @@ set(IMAGEPROC_UTILS MicroBenchmarks/Imag
list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS})
list(APPEND LDFLAGS -lm)
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/bilateralFilterOutput.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/bilateralFilterOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/bilateralFilter.reference_output")
+llvm_test_verify_hash_program_output(bilateralFilterOutput.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} bilateralFilter.reference_output bilateralFilterOutput.txt
+)
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
llvm_test_executable(BilateralFilter ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c main.cpp bilateralFilterKernel.c)
+llvm_test_data(BilateralFilter bilateralFilter.reference_output)
target_link_libraries(BilateralFilter benchmark)
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Blur/CMakeLists.txt Fri Aug 31 14:06:23 2018
@@ -3,13 +3,18 @@ set(IMAGEPROC_UTILS MicroBenchmarks/Imag
list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS})
list(APPEND LDFLAGS -lm)
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/boxBlurOutput.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/boxBlurOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/boxBlur.reference_output")
+llvm_test_verify_hash_program_output(boxBlurOutput.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} boxBlur.reference_output boxBlurOutput.txt
+)
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/gaussianBlurOutput.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/gaussianBlurOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/gaussianBlur.reference_output")
+llvm_test_verify_hash_program_output(gaussianBlurOutput.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} gaussianBlur.reference_output gaussianBlurOutput.txt
+)
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
llvm_test_executable(blur ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c main.cpp boxBlurKernel.c gaussianBlurKernel.c)
+llvm_test_data(blur boxBlur.reference_output gaussianBlur.reference_output)
target_link_libraries(blur benchmark)
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Dilate/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Dilate/CMakeLists.txt?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Dilate/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Dilate/CMakeLists.txt Fri Aug 31 14:06:23 2018
@@ -1,11 +1,14 @@
set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils)
list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS})
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/dilateOutput.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/dilateOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/dilate.reference_output")
+llvm_test_verify_hash_program_output(dilateOutput.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} dilate.reference_output dilateOutput.txt
+)
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
llvm_test_executable(Dilate ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c main.cpp dilateKernel.c)
+llvm_test_data(Dilate dilate.reference_output)
target_link_libraries(Dilate benchmark)
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Dither/CMakeLists.txt Fri Aug 31 14:06:23 2018
@@ -2,13 +2,18 @@ set(IMAGEPROC_UTILS MicroBenchmarks/Imag
list(APPEND CPPFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS})
list(APPEND LDFLAGS -lm)
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/orderedOutput.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/orderedOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/orderedDither.reference_output")
+llvm_test_verify_hash_program_output(orderedOutput.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} orderedDither.reference_output orderedOutput.txt
+)
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/floydOutput.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/floydOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/floydDither.reference_output")
+llvm_test_verify_hash_program_output(floydOutput.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} floydDither.reference_output floydOutput.txt
+)
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
llvm_test_executable(Dither main.cpp orderedDitherKernel.c floydDitherKernel.c ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c)
+llvm_test_data(Dither orderedDither.reference_output floydDither.reference_output)
target_link_libraries(Dither benchmark)
Modified: test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/ImageProcessing/Interpolation/CMakeLists.txt Fri Aug 31 14:06:23 2018
@@ -1,13 +1,18 @@
set(IMAGEPROC_UTILS MicroBenchmarks/ImageProcessing/utils)
list(APPEND CXXFLAGS -I ${CMAKE_SOURCE_DIR}/${IMAGEPROC_UTILS})
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/bicubicOutput.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/bicubicOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/bicubic.reference_output")
+llvm_test_verify_hash_program_output(bicubicOutput.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} bicubic.reference_output bicubicOutput.txt
+)
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/bilinearOutput.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/bilinearOutput.txt ${CMAKE_CURRENT_SOURCE_DIR}/bilinear.reference_output")
+llvm_test_verify_hash_program_output(bilinearOutput.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} bilinear.reference_output bilinearOutput.txt
+)
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
llvm_test_executable(Interpolation bicubicKernel.c bilinearKernel.c main.cpp ../utils/ImageHelper.cpp ../utils/glibc_compat_rand.c)
+llvm_test_data(Interpolation bicubic.reference_output bilinear.reference_output)
target_link_libraries(Interpolation benchmark)
Modified: test-suite/trunk/MicroBenchmarks/harris/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MicroBenchmarks/harris/CMakeLists.txt?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/MicroBenchmarks/harris/CMakeLists.txt (original)
+++ test-suite/trunk/MicroBenchmarks/harris/CMakeLists.txt Fri Aug 31 14:06:23 2018
@@ -1,8 +1,10 @@
list(APPEND CPPFLAGS -std=c++11 -ffast-math)
-set(REFERENCE_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/harris.reference_output)
-llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${CMAKE_CURRENT_BINARY_DIR}/output.txt")
-llvm_test_verify("${FPCMP} ${CMAKE_CURRENT_BINARY_DIR}/output.txt ${REFERENCE_OUTPUT}")
+llvm_test_verify_hash_program_output(output.txt)
+llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${FPCMP} harris.reference_output output.txt
+)
llvm_test_run(WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
-llvm_test_executable(harris harrisKernel.cpp main.cpp)
+llvm_test_executable(harris harrisKernel.cpp main.cpp)
target_link_libraries(harris benchmark)
+llvm_test_data(harris harris.reference_output)
Modified: test-suite/trunk/cmake/modules/SingleMultiSource.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/SingleMultiSource.cmake?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/cmake/modules/SingleMultiSource.cmake (original)
+++ test-suite/trunk/cmake/modules/SingleMultiSource.cmake Fri Aug 31 14:06:23 2018
@@ -37,9 +37,11 @@ function(llvm_singlesource)
endif()
foreach(source ${sources})
basename(name ${source})
- llvm_test_traditional(${name})
set(_target ${_LSARG_PREFIX}${name})
- llvm_test_executable(${_target} ${source})
+ llvm_test_executable_no_test(${_target} ${source})
+ set_property(TARGET ${_target} PROPERTY TEST_NAME ${name})
+ llvm_test_traditional(${_target})
+ llvm_add_test_for_target(${_target})
endforeach()
endfunction()
@@ -52,10 +54,17 @@ function(llvm_multisource target)
file(GLOB sources *.c *.cpp *.cc)
endif()
+ llvm_test_executable_no_test(${target} ${sources})
llvm_test_traditional(${target})
- llvm_test_executable(${target} ${sources})
+ llvm_add_test_for_target(${target})
endfunction()
+macro(llvm_test_verify_hash_program_output _file)
+ llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${CMAKE_SOURCE_DIR}/HashProgramOutput.sh ${_file}
+ )
+endmacro()
+
# Sets Var to ${name} with directory and shortest extension removed.
macro(basename Var name)
# strip directory name
@@ -67,14 +76,19 @@ endmacro()
# Traditionally CMakeLists.txt files would set RUN_OPTIONS, SMALL_PROBLEM_SIZE,
# HASH_PROGRAM_OUTPUT, etc.
# Create llvm_test_run() and llvm_test_verify() invocation for that.
-function(llvm_test_traditional name)
+function(llvm_test_traditional target)
+ get_property(name TARGET ${target} PROPERTY TEST_NAME)
+ if(NOT name)
+ set(name ${target})
+ endif()
+
# Always run in the same directory as the executable
list(INSERT RUN_OPTIONS 0 WORKDIR ${CMAKE_CURRENT_BINARY_DIR})
llvm_test_run(${RUN_OPTIONS})
# Hash if we've been asked to.
if(HASH_PROGRAM_OUTPUT)
- llvm_test_verify("${CMAKE_SOURCE_DIR}/HashProgramOutput.sh %o")
+ llvm_test_verify_hash_program_output(%o)
endif()
# Find the reference output file key name.
@@ -88,13 +102,13 @@ function(llvm_test_traditional name)
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.reference_output.${ENDIAN}-endian.${SIZE_SUFFIX})
- set(REFERENCE_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${name}.reference_output.${ENDIAN}-endian.${SIZE_SUFFIX})
+ set(REFERENCE_OUTPUT ${name}.reference_output.${ENDIAN}-endian.${SIZE_SUFFIX})
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.reference_output.${SIZE_SUFFIX})
- set(REFERENCE_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${name}.reference_output.${SIZE_SUFFIX})
+ set(REFERENCE_OUTPUT ${name}.reference_output.${SIZE_SUFFIX})
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.reference_output.${ENDIAN}-endian)
- set(REFERENCE_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${name}.reference_output.${ENDIAN}-endian)
+ set(REFERENCE_OUTPUT ${name}.reference_output.${ENDIAN}-endian)
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${name}.reference_output)
- set(REFERENCE_OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${name}.reference_output)
+ set(REFERENCE_OUTPUT ${name}.reference_output)
else()
message("-- No reference output found for test ${name}")
endif()
@@ -108,7 +122,10 @@ function(llvm_test_traditional name)
if(FP_ABSTOLERANCE)
set(DIFFPROG "${DIFFPROG} -a ${FP_ABSTOLERANCE}")
endif()
- llvm_test_verify("${DIFFPROG} %o ${REFERENCE_OUTPUT}")
+ llvm_test_verify(WORKDIR ${CMAKE_CURRENT_BINARY_DIR}
+ ${DIFFPROG} %o ${REFERENCE_OUTPUT}
+ )
+ llvm_test_data(${target} ${REFERENCE_OUTPUT})
endif()
set(TESTSCRIPT "${TESTSCRIPT}" PARENT_SCOPE)
endfunction()
Modified: test-suite/trunk/cmake/modules/TestFile.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/TestFile.cmake?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/cmake/modules/TestFile.cmake (original)
+++ test-suite/trunk/cmake/modules/TestFile.cmake Fri Aug 31 14:06:23 2018
@@ -88,3 +88,8 @@ function(llvm_add_test testfile executab
# flush the test script
set(TESTSCRIPT "" PARENT_SCOPE)
endfunction()
+
+function(llvm_add_test_for_target target)
+ llvm_add_test($<TARGET_FILE:${target}>.test $<TARGET_FILE:${target}>)
+ set(TESTSCRIPT "" PARENT_SCOPE)
+endfunction()
Modified: test-suite/trunk/cmake/modules/TestSuite.cmake
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/cmake/modules/TestSuite.cmake?rev=341255&r1=341254&r2=341255&view=diff
==============================================================================
--- test-suite/trunk/cmake/modules/TestSuite.cmake (original)
+++ test-suite/trunk/cmake/modules/TestSuite.cmake Fri Aug 31 14:06:23 2018
@@ -34,12 +34,7 @@ function(llvm_test_data target)
endforeach()
endfunction()
-# Creates a new executable build target. Use this instead of `add_executable`.
-# It applies CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS. Creates a .test file if
-# necessary, registers the target with the TEST_SUITE_TARGETS list and makes
-# sure we build the required dependencies for compiletime measurements
-# and support the TEST_SUITE_PROFILE_USE mode.
-function(llvm_test_executable target)
+function(llvm_test_executable_no_test target)
add_executable(${target} ${ARGN})
append_target_flags(COMPILE_FLAGS ${target} ${CFLAGS})
append_target_flags(COMPILE_FLAGS ${target} ${CPPFLAGS})
@@ -54,8 +49,17 @@ function(llvm_test_executable target)
endif()
set_property(GLOBAL APPEND PROPERTY TEST_SUITE_TARGETS ${target})
- llvm_add_test(${CMAKE_CURRENT_BINARY_DIR}/${target}.test ${target_path})
test_suite_add_build_dependencies(${target})
+endfunction()
+
+# Creates a new executable build target. Use this instead of `add_executable`.
+# It applies CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS. Creates a .test file if
+# necessary, registers the target with the TEST_SUITE_TARGETS list and makes
+# sure we build the required dependencies for compiletime measurements
+# and support the TEST_SUITE_PROFILE_USE mode.
+function(llvm_test_executable target)
+ llvm_test_executable_no_test(${target} ${ARGN})
+ llvm_add_test_for_target(${target})
set(TESTSCRIPT "" PARENT_SCOPE)
endfunction()
More information about the llvm-commits
mailing list