From 167201430d79ff8e2ea8b94b112d849bedbde703 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 15 Oct 2019 15:21:21 -0400 Subject: [PATCH] Make runtests configurable. This CL allows setting the location of glslangValidator and spirv-remap when calling the runtests script. A test target is added to CMake to execute runtests and sets the location to the build folder for the two applications. --- CMakeLists.txt | 18 ++++++++++++++++++ Test/runtests | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index da25533e..c3308e8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -180,3 +180,21 @@ if(ENABLE_HLSL) add_subdirectory(hlsl) endif(ENABLE_HLSL) add_subdirectory(gtests) + +if(BUILD_TESTING) + # glslang-testsuite runs a bash script on Windows. + # Make sure to use '-o igncr' flag to ignore carriage returns (\r). + set(IGNORE_CR_FLAG "") + if(WIN32) + set(IGNORE_CR_FLAG -o igncr) + endif() + + add_test(NAME glslang-testsuite + COMMAND bash ${IGNORE_CR_FLAG} runtests + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Test/) + + set_property(TEST glslang-testsuite APPEND PROPERTY + ENVIRONMENT GLSLANG_PATH=${CMAKE_CURRENT_BINARY_DIR}/StandAlone/glslangValidator) + set_property(TEST glslang-testsuite APPEND PROPERTY + ENVIRONMENT SPIRV_REMAP_PATH=${CMAKE_CURRENT_BINARY_DIR}/StandAlone/spirv-remap) +endif(BUILD_TESTING) diff --git a/Test/runtests b/Test/runtests index 8e31c069..40e928b6 100755 --- a/Test/runtests +++ b/Test/runtests @@ -2,8 +2,8 @@ TARGETDIR=localResults BASEDIR=baseResults -EXE=../build/install/bin/glslangValidator -REMAPEXE=../build/install/bin/spirv-remap +EXE=${GLSLANG_PATH:-../build/install/bin/glslangValidator} +REMAPEXE=${SPIRV_REMAP_PATH:-../build/install/bin/spirv-remap} HASERROR=0 mkdir -p localResults