diff --git a/CMakeLists.txt b/CMakeLists.txt index e72b435..ecd1a6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,8 +124,26 @@ else() endif() message(" (set with command line option -DUSE_EXCEPTIONS=ON/OFF)") +# these are the test executables, we expect to be generated. +set(EXPECTED_EMBB_TEST_EXECUTABLES "embb_algorithms_cpp_test" + "embb_base_c_test" + "embb_base_cpp_test" + "embb_containers_cpp_test" + "embb_dataflow_cpp_test" + "embb_mtapi_c_test" + "embb_mtapi_cpp_test" + "embb_mtapi_network_c_test" + "embb_tasks_cpp_test" + ) + +# if opencl is there, we also expect the mtapi opencl test to be generated +if(OpenCL_FOUND) + list(APPEND EXPECTED_EMBB_TEST_EXECUTABLES "embb_mtapi_opencl_c_test") +endif() + + ## Copy test execution script to local binaries folder -# + if (DEFINED CYGWIN) set(test_script_in run_tests_cygwin.sh) set(test_script_out run_tests.sh) @@ -136,9 +154,7 @@ else() set(test_script_in run_tests_windows.bat) set(test_script_out run_tests.bat) endif() -execute_process( - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/scripts/${test_script_in} binaries/${test_script_out} - ) +CONFIGURE_FILE( ${CMAKE_SOURCE_DIR}/scripts/${test_script_in}.cmake binaries/${test_script_out} ) ## Test and Partest build # diff --git a/scripts/run_tests_cygwin.sh b/scripts/run_tests_cygwin.sh.cmake similarity index 92% rename from scripts/run_tests_cygwin.sh rename to scripts/run_tests_cygwin.sh.cmake index 43ae62d..2fce866 100755 --- a/scripts/run_tests_cygwin.sh +++ b/scripts/run_tests_cygwin.sh.cmake @@ -27,6 +27,7 @@ # Needs to be located in the folder containing the tests!! # Is copied automatically there when generating build files with cmake. +EMBB_TEST_EXECUTABLES="@EXPECTED_EMBB_TEST_EXECUTABLES@" SCRIPT_LOCATION="$0" # case we have symlinks... @@ -36,10 +37,6 @@ done DIR=`dirname "$SCRIPT_LOCATION"` -TESTS="embb_base_c_test embb_base_cpp_test embb_mtapi_c_test \ - embb_mtapi_cpp_test embb_tasks_cpp_test embb_algorithms_cpp_test \ - embb_containers_cpp_test embb_dataflow_cpp_test" - -for TEST in $TESTS; do +for TEST in $(echo $EMBB_TEST_EXECUTABLES | tr ";" " "); do "$DIR/$TEST".exe; done diff --git a/scripts/run_tests_unix.sh b/scripts/run_tests_unix.sh.cmake similarity index 91% rename from scripts/run_tests_unix.sh rename to scripts/run_tests_unix.sh.cmake index a39ede6..b668b9b 100755 --- a/scripts/run_tests_unix.sh +++ b/scripts/run_tests_unix.sh.cmake @@ -27,6 +27,7 @@ # Needs to be located in the folder containing the tests!! # Is copied automatically there when generating build files with cmake. +EMBB_TEST_EXECUTABLES="@EXPECTED_EMBB_TEST_EXECUTABLES@" SCRIPT_LOCATION="$0" # case we have symlinks... @@ -36,10 +37,6 @@ done DIR=`dirname "$SCRIPT_LOCATION"` -TESTS="embb_base_c_test embb_base_cpp_test embb_mtapi_c_test \ - embb_mtapi_cpp_test embb_tasks_cpp_test embb_algorithms_cpp_test \ - embb_containers_cpp_test embb_dataflow_cpp_test" - -for TEST in $TESTS; do +for TEST in $(echo $EMBB_TEST_EXECUTABLES | tr ";" " "); do $DIR/$TEST; done diff --git a/scripts/run_tests_windows.bat b/scripts/run_tests_windows.bat.cmake similarity index 66% rename from scripts/run_tests_windows.bat rename to scripts/run_tests_windows.bat.cmake index 1621f08..c3d4a44 100644 --- a/scripts/run_tests_windows.bat +++ b/scripts/run_tests_windows.bat.cmake @@ -28,29 +28,28 @@ setlocal EnableDelayedExpansion SET NUM_ERRORS=0 SET DIR=%~dp0 -"%DIR:~0,-1%\embb_base_c_test.exe" -if not !ERRORLEVEL! ==0 set /a NUM_ERRORS=!NUM_ERRORS!+1 -echo. -"%DIR:~0,-1%\embb_base_cpp_test.exe" -if not !ERRORLEVEL! ==0 set /a NUM_ERRORS=!NUM_ERRORS!+1 -echo. -"%DIR:~0,-1%\embb_mtapi_c_test.exe" -if not !ERRORLEVEL! ==0 set /a NUM_ERRORS=!NUM_ERRORS!+1 -echo. -"%DIR:~0,-1%\embb_mtapi_cpp_test.exe" -if not !ERRORLEVEL! ==0 set /a NUM_ERRORS=!NUM_ERRORS!+1 -echo. -"%DIR:~0,-1%\embb_tasks_cpp_test.exe" -if not !ERRORLEVEL! ==0 set /a NUM_ERRORS=!NUM_ERRORS!+1 -echo. -"%DIR:~0,-1%\embb_algorithms_cpp_test.exe" -if not !ERRORLEVEL! ==0 set /a NUM_ERRORS=!NUM_ERRORS!+1 -echo. -"%DIR:~0,-1%\embb_containers_cpp_test.exe" -if not !ERRORLEVEL! ==0 set /a NUM_ERRORS=!NUM_ERRORS!+1 -echo. -"%DIR:~0,-1%\embb_dataflow_cpp_test.exe" +SET EMBB_EXECUTABLES=@EXPECTED_EMBB_TEST_EXECUTABLES@ + +call :parse "%EMBB_EXECUTABLES%" +goto :end + +:parse +set list=%1 +set list=%list:"=% +FOR /f "tokens=1* delims=;" %%a IN ("%list%") DO ( + if not "%%a" == "" call :sub %%a + if not "%%b" == "" call :parse "%%b" +) +exit /b + +:sub +call "%DIR:~0,-1%\%1.exe" if not !ERRORLEVEL! ==0 set /a NUM_ERRORS=!NUM_ERRORS!+1 +exit /b + + +:end + if not !NUM_ERRORS! ==0 ( echo. SET ERRORLEVEL=1