mirror of
https://github.com/eclipse/upm.git
synced 2025-07-03 10:21:19 +03:00
JSON: Adding ctest
This commit adds node based tests provided by Nico to the ctest framework already established in UPM. Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
This commit is contained in:
36
tests/runjsontest.cmake
Normal file
36
tests/runjsontest.cmake
Normal file
@ -0,0 +1,36 @@
|
||||
# This macro sets up the initial JSON test environment
|
||||
# it copies over everything required by the test over to the
|
||||
# build directory so that the tests can be run from there
|
||||
macro(SETUP_JSON_COLLATERAL UBD NE)
|
||||
execute_process(COMMAND mkdir -p ${UBD}/build/node_test;
|
||||
COMMAND cp ${UBD}/tests/node/package.json ${UBD}/build/node_test/;
|
||||
COMMAND cp ${UBD}/tests/node/jsonlint.js ${UBD}/build/node_test/;
|
||||
COMMAND cp ${UBD}/tests/node/test.js ${UBD}/build/node_test/;
|
||||
COMMAND ${NE} install --prefix=${UBD}/build/node_test/;
|
||||
RESULT_VARIABLE ret_val
|
||||
)
|
||||
if(ret_val)
|
||||
message(FATAL_ERROR "value of result of first test: ${ret_val_1}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# This macro runs the json test and checks the json files for
|
||||
# their validity and also checks for the required fields
|
||||
macro(EXEC_JSON_TEST UBD NE)
|
||||
execute_process(COMMAND ${NE} test --prefix=${UBD}/build/node_test/
|
||||
RESULT_VARIABLE ret_val
|
||||
)
|
||||
execute_process(COMMAND rm -rf ${UBD}/build/node_test)
|
||||
if(ret_val)
|
||||
message(FATAL_ERROR "value of the result of the second test: ${ret_val_2}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# this macro removes all the JSON collateral from the build directory
|
||||
#macro(REMOVE_JSON_COLLATERAL UBD)
|
||||
# execute_process(COMMAND rm -rf ${UBD}/build/node_test)
|
||||
#endmacro()
|
||||
|
||||
setup_json_collateral(${UPMBASEDIR} ${NPMEXEC})
|
||||
exec_json_test(${UPMBASEDIR} ${NPMEXEC})
|
||||
#remove_json_collateral(${UPMBASEDIR})
|
Reference in New Issue
Block a user