Commit a158ba65 authored by Patrick Chen's avatar Patrick Chen

add test script after build

parent 19563ed6
......@@ -11,6 +11,10 @@ set(PROJECT_INCLUDE_DIR
set(PROJECT_SOURCE_DIR
"${PROJECT_ROOT_DIR}/src"
)
set(PROJECT_SCRIPT_DIR
"${PROJECT_ROOT_DIR}/script"
)
set(ENABLE_MODULE_TEST true)
# setup language
enable_language(CXX)
......@@ -76,3 +80,9 @@ target_include_directories(greeting PRIVATE
target_link_libraries(greeting
${GREETING_LIBS}
)
if (ENABLE_MODULE_TEST)
add_dependencies(greeting xs-test)
add_custom_command(TARGET greeting POST_BUILD
COMMAND ${PROJECT_SCRIPT_DIR}/run-test.sh ./xs-test ./greeting ${PROJECT_ROOT_DIR}/example/greeting.json
)
endif()
#!/bin/bash
set -e
XS_TEST="$1"
SUBJECT="$2"
SCRIPT="$3"
echo "run test: ${XS_TEST} ${SCRIPT}"
${SUBJECT} &
PID=$!
${XS_TEST} ${SCRIPT} ; kill $PID
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