Skip to content

Commit 356d82d

Browse files
authored
Merge pull request #45 from linuxdeploy/fix-test-runs
Fix test runs
2 parents 1c96d54 + 374c7d9 commit 356d82d

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

lib/linuxdeploy

tests/CMakeLists.txt

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
1+
# common CMake macro for linuxdeploy, adding tests only if they are supposed to be built
2+
# otherwise if you try to run CTest the tests aren't build and CTest can't find them
3+
if(NOT COMMAND ld_add_test)
4+
function(ld_add_test TARGET_NAME)
5+
get_target_property(${TARGET_NAME}_EFA ${TARGET_NAME} EXCLUDE_FROM_ALL)
6+
if(NOT ${${TARGET_NAME}_EXCLUDE_FROM_ALL})
7+
message(STATUS "[${PROJECT_NAME}] Adding test ${TARGET_NAME}")
8+
add_test(${TARGET_NAME} ${TARGET_NAME})
9+
else()
10+
message(STATUS "[${PROJECT_NAME}] Test ${TARGET_NAME} is excluded from ALL, not adding as test")
11+
endif()
12+
endfunction()
13+
endif()
14+
115
add_executable(linuxdeploy-plugin-qt-tests test_main.cpp test_deploy_qml.cpp ../src/qml.cpp)
216
target_link_libraries(linuxdeploy-plugin-qt-tests linuxdeploy_core args json gtest)
317
target_compile_definitions(linuxdeploy-plugin-qt-tests PRIVATE TESTS_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data")
418

5-
add_test(linuxdeploy-plugin-qt-tests linuxdeploy-plugin-qt-tests)
19+
ld_add_test(linuxdeploy-plugin-qt-tests linuxdeploy-plugin-qt-tests)
620

travis/build.sh

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ cmake "$REPO_ROOT" -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo
3939

4040
make -j$(nproc)
4141

42+
ctest -V
43+
4244
make install DESTDIR=AppDir
4345

4446
strip_path=$(which strip)

0 commit comments

Comments
 (0)