From cd7057b21ca699ade836c780080a81988c84cac6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 15 Nov 2010 11:35:29 -0500 Subject: [svn-r19782] Fix CMake testing for links_env test which requires an environment variable at test run-time. Modified runTest.cmake file to allow optional ENV_VAR and ENV_VALUE to be passed. runTest.cmake requires a reference file, added links_env.out to testfiles folder. Also updated root CMakeLists.txt to output a message when unsopported options are configured with the PARALLEL option. CMake will still generate files. Tested: windows and local linux --- CMakeLists.txt | 8 ++++++++ MANIFEST | 1 + config/cmake/runTest.cmake | 4 ++++ test/CMakeLists.txt | 43 +++++++++++++++++++++++++++++++++++++++---- test/testfiles/links_env.out | 6 ++++++ 5 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 test/testfiles/links_env.out diff --git a/CMakeLists.txt b/CMakeLists.txt index b1808e4..ee6c069 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -649,6 +649,10 @@ ENDIF (WIN32 AND NOT CYGWIN) IF (WIN32 AND NOT CYGWIN) OPTION (HDF5_ENABLE_THREADSAFE "Enable Threadsafety" OFF) IF (HDF5_ENABLE_THREADSAFE) + # check for unsupported options + IF (HDF5_ENABLE_PARALLEL) + MESSAGE (FATAL " **** Parallel and Threadsafe options are mutually exclusive **** ") + ENDIF (HDF5_ENABLE_PARALLEL) SET (H5_HAVE_WIN_THREADS 1) SET (H5_HAVE_THREADSAFE 1) ENDIF (HDF5_ENABLE_THREADSAFE) @@ -759,6 +763,10 @@ ENDIF (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR} IF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") OPTION (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF) IF (HDF5_BUILD_CPP_LIB) + # check for unsupported options + IF (HDF5_ENABLE_PARALLEL) + MESSAGE (FATAL " **** Parallel and C++ options are mutually exclusive **** ") + ENDIF (HDF5_ENABLE_PARALLEL) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++) ENDIF (HDF5_BUILD_CPP_LIB) ENDIF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") diff --git a/MANIFEST b/MANIFEST index 02b211b..d3ff7c3 100644 --- a/MANIFEST +++ b/MANIFEST @@ -954,6 +954,7 @@ ./test/testfiles/err_compat_2 ./test/testfiles/error_test_1 ./test/testfiles/error_test_2 +./test/testfiles/links_env.out ./testpar/COPYING ./testpar/Makefile.am diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake index c9334c1..e65e877 100644 --- a/config/cmake/runTest.cmake +++ b/config/cmake/runTest.cmake @@ -28,6 +28,10 @@ SET (ERROR_APPEND 1) MESSAGE (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") +IF (TEST_ENV_VAR) + SET (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") +ENDIF (TEST_ENV_VAR) + # run the test program, capture the stdout/stderr and the result var EXECUTE_PROCESS ( COMMAND ${TEST_PROGRAM} ${TEST_ARGS} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b39de38..c27f43f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -55,16 +55,17 @@ SET (HDF5_REFERENCE_FILES err_compat_2 error_test_1 error_test_2 + links_env.out ) FOREACH (ref_file ${HDF5_REFERENCE_FILES}) - SET (dest "${PROJECT_BINARY_DIR}/testfiles/${ref_file}") + SET (dest "${PROJECT_BINARY_DIR}/${ref_file}") #MESSAGE (STATUS " Copying ${h5_file}") ADD_CUSTOM_COMMAND ( TARGET ${HDF5_TEST_LIB_TARGET} POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} + COMMAND ${XLATE_UTILITY} + ARGS ${HDF5_TEST_SOURCE_DIR}/testfiles/${ref_file} ${dest} -l3 ) ENDFOREACH (ref_file ${HDF5_REFERENCE_FILES}) @@ -287,7 +288,7 @@ SET (H5_TESTS err_compat tcheck_version testmeta - links_env + #links_env ) FOREACH (test ${H5_TESTS}) @@ -338,6 +339,40 @@ TARGET_LINK_LIBRARIES (ttsafe ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) ADD_TEST (NAME ttsafe COMMAND $) +#-- Adding test for error_test +#ADD_EXECUTABLE (error_test ${HDF5_TEST_SOURCE_DIR}/error_test.c) +#H5_NAMING (error_test) +#TARGET_WIN_PROPERTIES (error_test) +#TARGET_LINK_LIBRARIES (error_test ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) +# +#ADD_TEST (NAME error_test COMMAND "${CMAKE_COMMAND}" +# -D "TEST_PROGRAM=$" +# -D "TEST_ARGS:STRING=" +# -D "TEST_EXPECT=0" +# -D "TEST_OUTPUT=error_test.txt" +# -D "TEST_REFERENCE=error_test1" +# -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" +# -P "${HDF5_RESOURCES_DIR}/runTest.cmake" +#) + +#-- Adding test for links_env +ADD_EXECUTABLE (links_env ${HDF5_TEST_SOURCE_DIR}/links_env.c) +H5_NAMING (links_env) +TARGET_WIN_PROPERTIES (links_env) +TARGET_LINK_LIBRARIES (links_env ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + +ADD_TEST (NAME links_env COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=" + -D "TEST_ENV_VAR:STRING=HDF5_EXT_PREFIX" + -D "TEST_ENV_VALUE:STRING=.:tmp" + -D "TEST_EXPECT=0" + -D "TEST_OUTPUT=links_env.txt" + -D "TEST_REFERENCE=links_env.out" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF5_RESOURCES_DIR}/runTest.cmake" +) + IF (HDF5_TEST_VFD) SET (VFD_LIST diff --git a/test/testfiles/links_env.out b/test/testfiles/links_env.out new file mode 100644 index 0000000..3ca9b99 --- /dev/null +++ b/test/testfiles/links_env.out @@ -0,0 +1,6 @@ +############################# +Expected output for links_env +############################# +Testing external links via environment variable PASSED +Testing external links via environment variable (w/new group format) PASSED +All external Link (HDF5_EXT_PREFIX) tests passed. -- cgit v0.12