Commit 6f874b73 authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Improve test

parent 8dd05f1c
Pipeline #130377 passed with stages
in 4 minutes and 44 seconds
......@@ -19,6 +19,8 @@ install(FILES FindPhoenixHDF5.cmake DESTINATION share/cmake)
add_subdirectory(src)
set(PHOENIX_HDF5_EXECUTABLE "${CMAKE_CURRENT_BINARY_DIR}/src/phoenix_hdf5" CACHE STRING " executable phoenix_hdf5")
if(SELF_TESTS_MODE)
include(CTest)
add_subdirectory(TESTS)
......
......@@ -9,4 +9,16 @@ target_link_libraries(test_base_config test_base_config_lib ${HDF5_CXX_LIBRARIES
add_test(NAME TestBaseConfig
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/test_base_config
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_test(NAME TestBaseUnexistingConfig
COMMAND ${PHOENIX_HDF5_EXECUTABLE} -i unexistingConfigFile.ph5
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_tests_properties(TestBaseUnexistingConfig PROPERTIES WILL_FAIL true)
add_test(NAME TestBaseUnexistingOutputDir
COMMAND ${PHOENIX_HDF5_EXECUTABLE} -i ${CMAKE_CURRENT_SOURCE_DIR}/baseConfig.ph5 -o "UnexistingOutputDir/"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_tests_properties(TestBaseUnexistingOutputDir PROPERTIES WILL_FAIL true)
......@@ -80,14 +80,11 @@ bool testReadData(const std::string & fileName){
int main(int argc, char** argv){
std::string fileName("configTable_full.h5");
if(!testWriteData(fileName)){
std::cerr << "Cannot write file '"<<fileName<<"'" << std::endl;
return -1;
}
if(!testReadData(fileName)){
std::cerr << "Cannot read file '"<<fileName<<"'" << std::endl;
return -1;
}
return 0;
bool b(true);
b &= testWriteData(fileName);
b &= testReadData(fileName);
std::cout << "b = " << b << std::endl;
return b - 1;
}
set(PHOENIX_HDF5_PROGRAM "${CMAKE_BINARY_DIR}/src/phoenix_hdf5")
# Function which call the generator on configuration file and compile a library
# targetName : name of the target to be created
# ARGN : list of configuration files to be passed to the phoenix_hdf5 generator
......@@ -18,10 +16,10 @@ function(call_generator targetName)
endforeach(configFile)
add_custom_command(OUTPUT ${listOutputFile}
COMMAND ${PHOENIX_HDF5_PROGRAM} -i "${listInputFile}"
COMMAND ${PHOENIX_HDF5_EXECUTABLE} -i "${listInputFile}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Create sources of library ${targetName}"
DEPENDS ${PHOENIX_HDF5_PROGRAM} ${listInputFile})
DEPENDS ${PHOENIX_HDF5_EXECUTABLE} ${listInputFile})
set(targetCreateSource "${targetName}_createSource")
add_custom_target(${targetCreateSource} ALL DEPENDS ${listOutputFile})
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment