build: rename old tests binary to legacytests
ci: run-tests action, split legacy and new unit tests into two steps
This commit is contained in:
parent
2aee6d8812
commit
3ae2b3a571
17 changed files with 19 additions and 25 deletions
8
.github/actions/run-tests/action.yml
vendored
8
.github/actions/run-tests/action.yml
vendored
|
|
@ -15,7 +15,7 @@ runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: unittests
|
- name: Unit Tests
|
||||||
id: unittests
|
id: unittests
|
||||||
env:
|
env:
|
||||||
QT_QPA_PLATFORM: offscreen
|
QT_QPA_PLATFORM: offscreen
|
||||||
|
|
@ -29,16 +29,16 @@ runs:
|
||||||
shell: bash
|
shell: bash
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: legacytests
|
- name: Legacy Tests
|
||||||
id: legacytests
|
id: legacytests
|
||||||
env:
|
env:
|
||||||
QT_QPA_PLATFORM: offscreen
|
QT_QPA_PLATFORM: offscreen
|
||||||
run: |
|
run: |
|
||||||
./${{ inputs.bin-dir }}/unittests
|
./${{ inputs.bin-dir }}/legacytests
|
||||||
result=$?
|
result=$?
|
||||||
|
|
||||||
if [ $result -ne 0 ]; then
|
if [ $result -ne 0 ]; then
|
||||||
echo "Unit tests failed with code: $result" >> $GITHUB_STEP_SUMMARY
|
echo "Legacy tests failed with code: $result" >> $GITHUB_STEP_SUMMARY
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
|
||||||
9
.github/workflows/sonarcloud-analysis.yml
vendored
9
.github/workflows/sonarcloud-analysis.yml
vendored
|
|
@ -44,22 +44,23 @@ jobs:
|
||||||
-G "Ninja" \
|
-G "Ninja" \
|
||||||
-DCMAKE_BUILD_TYPE="Debug" \
|
-DCMAKE_BUILD_TYPE="Debug" \
|
||||||
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
|
||||||
|
-DSKIP_BUILD_TESTS=ON \
|
||||||
-DENABLE_COVERAGE=ON
|
-DENABLE_COVERAGE=ON
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
build-wrapper-linux-x86-64 --out-dir bw-output cmake --build build -j${CPU_CORE_COUNT}
|
build-wrapper-linux-x86-64 --out-dir bw-output cmake --build build -j${CPU_CORE_COUNT}
|
||||||
|
|
||||||
- name: Unit tests coverage
|
- name: Legacy tests coverage
|
||||||
env:
|
env:
|
||||||
QT_QPA_PLATFORM: offscreen
|
QT_QPA_PLATFORM: offscreen
|
||||||
run: cmake --build build --target coverage-unittests
|
run: cmake --build build --target coverage-legacytests
|
||||||
|
|
||||||
- name: Get coverage report paths
|
- name: Get coverage report paths
|
||||||
id: coverage-paths
|
id: coverage-paths
|
||||||
run: |
|
run: |
|
||||||
unittests=$(find build -name coverage-unittests.xml)
|
legacytests=$(find build -name coverage-legacytests.xml)
|
||||||
paths="${unittests}"
|
paths="${legacytests}"
|
||||||
if [ -z "$paths" ]; then
|
if [ -z "$paths" ]; then
|
||||||
echo "Error: No coverage files found"
|
echo "Error: No coverage files found"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
8
.github/workflows/valgrind-analysis.yml
vendored
8
.github/workflows/valgrind-analysis.yml
vendored
|
|
@ -31,10 +31,10 @@ jobs:
|
||||||
run: cmake --build build -j8
|
run: cmake --build build -j8
|
||||||
|
|
||||||
- name: Valgrind unit tests
|
- name: Valgrind unit tests
|
||||||
id: unittests
|
id: legacytests
|
||||||
uses: ./.github/actions/run-valgrind
|
uses: ./.github/actions/run-valgrind
|
||||||
with:
|
with:
|
||||||
executable: ./build/bin/unittests
|
executable: ./build/bin/legacytests
|
||||||
|
|
||||||
- name: Set job summary
|
- name: Set job summary
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -42,9 +42,9 @@ jobs:
|
||||||
message=$(cat <<EOF
|
message=$(cat <<EOF
|
||||||
## Valgrind summary
|
## Valgrind summary
|
||||||
|
|
||||||
### Unit tests
|
### legacytests Unit tests
|
||||||
$backticks
|
$backticks
|
||||||
${{ steps.unittests.outputs.summary }}
|
${{ steps.legacytests.outputs.summary }}
|
||||||
$backticks
|
$backticks
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ macro(configure_libs)
|
||||||
message(STATUS "Enabling code coverage")
|
message(STATUS "Enabling code coverage")
|
||||||
include(cmake/CodeCoverage.cmake)
|
include(cmake/CodeCoverage.cmake)
|
||||||
append_coverage_compiler_flags()
|
append_coverage_compiler_flags()
|
||||||
set(test_exclude subprojects/* build/* src/test/*)
|
set(test_exclude subprojects/* build/* src/tests/*)
|
||||||
set(test_src ${PROJECT_SOURCE_DIR}/src)
|
set(test_src ${PROJECT_SOURCE_DIR}/src)
|
||||||
|
|
||||||
# Apparently solves the bug in gcov where it returns negative counts and confuses gcovr.
|
# Apparently solves the bug in gcov where it returns negative counts and confuses gcovr.
|
||||||
|
|
@ -55,15 +55,8 @@ macro(configure_libs)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-update=atomic")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-update=atomic")
|
||||||
|
|
||||||
setup_target_for_coverage_gcovr_xml(
|
setup_target_for_coverage_gcovr_xml(
|
||||||
NAME coverage-integtests
|
NAME coverage-legacytests
|
||||||
EXECUTABLE integtests
|
EXECUTABLE legacytests
|
||||||
BASE_DIRECTORY ${test_src}
|
|
||||||
EXCLUDE ${test_exclude}
|
|
||||||
)
|
|
||||||
|
|
||||||
setup_target_for_coverage_gcovr_xml(
|
|
||||||
NAME coverage-unittests
|
|
||||||
EXECUTABLE unittests
|
|
||||||
BASE_DIRECTORY ${test_src}
|
BASE_DIRECTORY ${test_src}
|
||||||
EXCLUDE ${test_exclude}
|
EXCLUDE ${test_exclude}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
include(FetchContent)
|
include(FetchContent)
|
||||||
set(INSTALL_GTEST OFF)
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
googletest
|
googletest
|
||||||
GIT_REPOSITORY https://github.com/google/googletest.git
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||||
|
|
@ -23,7 +22,7 @@ macro(config_all_tests)
|
||||||
|
|
||||||
config_test_deps()
|
config_test_deps()
|
||||||
|
|
||||||
add_subdirectory(unittests)
|
add_subdirectory(legacytests)
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,6 @@
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
config_test()
|
config_test()
|
||||||
set(target unittests)
|
set(target legacytests)
|
||||||
add_executable(${target} ${sources} ${headers})
|
add_executable(${target} ${sources} ${headers})
|
||||||
target_link_libraries(${target} ${test_libs} common)
|
target_link_libraries(${target} ${test_libs} common)
|
||||||
|
|
@ -38,6 +38,7 @@ function(create_test)
|
||||||
add_test(NAME ${m_NAME} COMMAND $<TARGET_FILE:${m_NAME}> WORKING_DIRECTORY ${m_WORKING_DIRECTORY})
|
add_test(NAME ${m_NAME} COMMAND $<TARGET_FILE:${m_NAME}> WORKING_DIRECTORY ${m_WORKING_DIRECTORY})
|
||||||
set_tests_properties(${m_NAME} PROPERTIES DEPENDS ${m_DEPENDS})
|
set_tests_properties(${m_NAME} PROPERTIES DEPENDS ${m_DEPENDS})
|
||||||
set_property(GLOBAL APPEND PROPERTY ${CMAKE_PROJECT_NAME}_tests ${m_NAME})
|
set_property(GLOBAL APPEND PROPERTY ${CMAKE_PROJECT_NAME}_tests ${m_NAME})
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue