Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Sep 29, 2024
1 parent 6636864 commit d4d296e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,6 @@ option(RUN_TESTS_AFTER_BUILD "Run tests when building" OFF) # By default, tests
# *****************************************************************************
add_subdirectory(src)

if(BUILD_TESTS)
if(BUILD_TESTS OR PACKAGE_TESTS)
add_subdirectory(tests)
endif()
14 changes: 11 additions & 3 deletions tests/build_and_run.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#!/usr/bin/env bash

# Clean up existing containers, images and volumes and start over
docker-compose down --rmi all -v --remove-orphans
docker-compose up --build -d

# Check if the build directory exists, if it doesn't exist it creates it
cd ..
if [ ! -d "build" ]; then
mkdir build
fi
cd build || exit
cmake -DCMAKE_BUILD_TYPE=Debug -DPACKAGE_TESTS=On .. ; make -j"$(nproc)"

# Configure the build using vcpkg and compile the project with 6 threads
cmake -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -DPACKAGE_TESTS=On .. ; make -j"$(nproc)"

# Run tests after compilation
./tests/unit/canary_ut --reporter compact --success
cd ..
cd tests || exit

# Go back to the tests folder and clean the Docker environment again
cd ../tests || exit
docker-compose down --rmi all -v --remove-orphans

0 comments on commit d4d296e

Please sign in to comment.