Skip to content

Commit 5852e82

Browse files
committed
fix tests
1 parent db09145 commit 5852e82

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ include_directories(
9191

9292
install(DIRECTORY include DESTINATION include)
9393

94+
if (BUILD_TESTS)
95+
# Set JSONNET_BIN variable required for regression tests.
96+
file(TO_NATIVE_PATH ${GLOBAL_OUTPUT_PATH}/jsonnet JSONNET_BIN)
97+
endif()
98+
9499
add_subdirectory(stdlib)
95100
add_subdirectory(third_party/md5)
96101
add_subdirectory(core)
97102
add_subdirectory(cmd)
98103
add_subdirectory(test_suite)
99104

100105
if (BUILD_TESTS)
101-
# Set JSONNET_CMD variable required for regression tests.
102-
file(TO_NATIVE_PATH ${GLOBAL_OUTPUT_PATH}/jsonnet JSONNET_CMD)
103-
set(CTEST_ENVIRONMENT
104-
"JSONNET_CMD=${JSONNET_CMD}")
105-
106106
# s`run_tests` target builds and runs all tests. The cmake-generated `test`
107107
# target runs tests without building them.
108108
add_custom_target(run_tests COMMAND ${CMAKE_CTEST_COMMAND}
@@ -111,3 +111,5 @@ if (BUILD_TESTS)
111111
)
112112

113113
endif()
114+
115+

test_suite/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,16 @@ find_program(BASH bash)
22
if (BASH STREQUAL "BASH-NOTFOUND")
33
message(WARNING "Bash not found, can't run regression tests.")
44
else()
5-
# Note: this test relies on the JSONNET_CMD environment variable, which
5+
# Note: this test relies on the JSONNET_BIN variable, which
66
# is set in the root CMakeLists.txt.
7+
message( "Testing with Jsonnet executable: ${JSONNET_BIN}" )
78
add_test(
89
NAME regression_test
910
COMMAND ${BASH} ${CMAKE_CURRENT_SOURCE_DIR}/run_tests.sh
1011
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
11-
endif()
12+
set_tests_properties(
13+
regression_test
14+
PROPERTIES
15+
ENVIRONMENT JSONNET_BIN=${JSONNET_BIN})
16+
17+
endif()

0 commit comments

Comments
 (0)