diff --git a/CMakeLists.txt b/CMakeLists.txt index d5853366d80..5bee518ecd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/tests/build_and_run.sh b/tests/build_and_run.sh index ac4ccad512c..f885525353f 100755 --- a/tests/build_and_run.sh +++ b/tests/build_and_run.sh @@ -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