Skip to content

Commit

Permalink
Fix compilation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bernedom committed Sep 22, 2023
1 parent ca02129 commit 560e556
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/compilation-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ INSTALL_PATH=$(realpath ~/SI-install)
buildSingleTarget()
{
if [ "${2}" == "DEFAULTBUILD" ]; then
cmake ${ROOT_DIR}/test/src/compilation_tests/ -B${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DCMAKE_BUILD_TYPE=Release -G Ninja > /dev/null
cmake ${ROOT_DIR}/test/src/compilation_tests/ -B${BUILD_DIR} -DCMAKE_PREFIX_PATH=${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DCMAKE_BUILD_TYPE=Release -G Ninja > /dev/null
assertEquals "Configuration successful" 0 $?

else
cmake ${ROOT_DIR}/test/src/compilation_tests/ -B${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-DSI_DISABLE_IMPLICIT_RATIO_CONVERSION" -G Ninja > /dev/null
cmake ${ROOT_DIR}/test/src/compilation_tests/ -B${BUILD_DIR} -DCMAKE_PREFIX_PATH=${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-DSI_DISABLE_IMPLICIT_RATIO_CONVERSION" -G Ninja > /dev/null
assertEquals "Configuration successful" 0 $?
fi

Expand All @@ -29,10 +29,10 @@ buildSingleTarget()
oneTimeSetUp(){

BUILD_DIR=$(mktemp -d)
conan install . --output-folder=${BUILD_DIR} --build=missing --settings=build_type=Release
conan install . --output-folder=${BUILD_DIR} --build=missing --settings=build_type=Release 2>&1> /dev/null

# install SI
cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=Release -G Ninja > /dev/null
cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_PREFIX_PATH=${BUILD_DIR} -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PATH} -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=Release -G Ninja > /dev/null
cmake --build ${BUILD_DIR} --config Release --target install > /dev/null

if [ -d ${BUILD_DIR} ]; then
Expand All @@ -42,7 +42,7 @@ oneTimeSetUp(){

setUp(){
BUILD_DIR=$(mktemp -d)
conan install . --output-folder=${BUILD_DIR} --build=missing --settings=build_type=Release
conan install . --output-folder=${BUILD_DIR} --build=missing --settings=build_type=Release 2>&1> /dev/null
}

tearDown(){
Expand All @@ -53,15 +53,15 @@ tearDown(){

testSISelfSuccessfulCompilationWhenDefaultInvocation() {

cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -G Ninja > /dev/null
cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${BUILD_DIR} -G Ninja > /dev/null
assertEquals "Configuration successful" 0 $?
cmake --build ${BUILD_DIR} --config Release > /dev/null
assertEquals "Building successful" 0 $?
}

testSISelfFailedCompilationWhenImplicitConversionDisabled() {

cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-DSI_DISABLE_IMPLICIT_RATIO_CONVERSION" -G Ninja > /dev/null
cmake ${ROOT_DIR} -B${BUILD_DIR} -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=${BUILD_DIR} -DCMAKE_CXX_FLAGS="-DSI_DISABLE_IMPLICIT_RATIO_CONVERSION" -G Ninja > /dev/null
assertEquals "Configuration successful" 0 $?
cmake --build ${BUILD_DIR} --config Release
assertNotEquals "Building fails" 0 $?
Expand Down

0 comments on commit 560e556

Please sign in to comment.