Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run unit tests for Linux on CI #538

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/BuildPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ jobs:
run: scripts/linux/install.sh
- name: Build project
run: scripts/linux/build.sh
- name: Run tests
run: ctest --test-dir build/qdlt
- name: Make artifact executable
run: chmod -R +x build/dist
- name: Archive artifact
Expand Down
1 change: 1 addition & 0 deletions qdlt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ endforeach()
find_package(GTest)
# configure unit tests only if gtest found on the system
if (GTest_FOUND)
message(STATUS "Tests enabled")
enable_testing()
add_subdirectory(tests)
endif()
5 changes: 5 additions & 0 deletions qdlt/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ target_link_libraries(
qdlt
)

add_test(
NAME test_tools
COMMAND $<TARGET_FILE:test_tools>
)

7 changes: 5 additions & 2 deletions scripts/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ BUILD_DIR="${SRC_DIR}/build"
INSTALL_DIR="${BUILD_DIR}/install"
APP_DIR_NAME="DLTViewer"

NPROC=$(nproc)
echo Nb of cpus: ${NPROC}

rm -rf "${APP_DIR_NAME}"
rm -rf "${SRC_DIR}/build"
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"

echo Build with QMake
qmake ../BuildDltViewer.pro
make
make -j ${NPROC}

echo Cleanup
rm -rf "${INSTALL_DIR}"
Expand All @@ -37,7 +40,7 @@ cmake -G Ninja \
-DDLT_RESOURCE_INSTALLATION_PATH="${APP_DIR_NAME}/usr/share" \
-DDLT_PLUGIN_INSTALLATION_PATH="${APP_DIR_NAME}/usr/bin/plugins" \
"${SRC_DIR}"
cmake --build "${BUILD_DIR}" -v
cmake --build "${BUILD_DIR}" -j ${NPROC} -v

# External CPack generator calls "cmake --install" and "linuxdeploy"
#
Expand Down
2 changes: 1 addition & 1 deletion scripts/linux/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install -y git cmake build-essential ninja-build \
qt515declarative qt515serialport qt515charts-no-lgpl qt515svg \
libgtk2.0-dev libgl-dev gcc-11 g++-11
libgtk2.0-dev libgl-dev gcc-11 g++-11 libgtest-dev

sudo update-alternatives --remove-all cpp
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11 --slave /usr/bin/cpp cpp /usr/bin/cpp-11
Expand Down