Skip to content

Commit

Permalink
Update CI job instructions for running tests
Browse files Browse the repository at this point in the history
When running using the CMake test suite, so far they have been invoked
via the build system, such as `ninja test`, however using the `ctest`
program directly does give some improved control, such as being able to
output verbose content to see the undefined sanitizer behaviour.
  • Loading branch information
StableCoder committed Sep 1, 2024
1 parent fe761d5 commit 95f2126
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ stages:
- All Code Coverage
- Sanitizers

variables:
CTEST_OUTPUT_ON_FAILURE: "1"

# Analysis

cmake-format Check:
Expand Down Expand Up @@ -441,7 +438,7 @@ Windows/All CC Clang Shared:
script:
- cmake example/all -B build -GNinja -DCMAKE_BUILD_TYPE=Release ${CMAKE_OPTIONS}
- ninja -C build
- ninja -C build test
- ctest --test-dir build --output-on-failure ${CTEST_OPTIONS}

.linux_failure_template: &linux_failure_template
stage: Sanitizers
Expand All @@ -456,7 +453,7 @@ Windows/All CC Clang Shared:
script:
- cmake example/all -B build -GNinja -DCMAKE_BUILD_TYPE=Release ${CMAKE_OPTIONS}
- ninja -C build
- "! ninja -C build test"
- "! ctest --test-dir build --output-on-failure ${CTEST_OPTIONS}"

Linux/Static Analysis:
variables:
Expand Down Expand Up @@ -511,13 +508,15 @@ Linux/Clang/MemorySanitizer:
Linux/GCC/UndefinedSanitizer:
variables:
CMAKE_OPTIONS: -D EXAMPLE_USE_SANITIZER=undefined
CTEST_OPTIONS: --verbose
<<: *linux_success_template

Linux/Clang/UndefinedSanitizer:
variables:
CC: clang
CXX: clang++
CMAKE_OPTIONS: -D EXAMPLE_USE_SANITIZER=undefined
CTEST_OPTIONS: --verbose
<<: *linux_success_template

.macos_success_template: &macos_success_template
Expand All @@ -531,7 +530,7 @@ Linux/Clang/UndefinedSanitizer:
script:
- cmake example/all -B build -GNinja -DCMAKE_BUILD_TYPE=Release ${CMAKE_OPTIONS}
- ninja -C build
- ninja -C build test
- ctest --test-dir build --output-on-failure ${CTEST_OPTIONS}

.macos_failure_template: &macos_failure_template
stage: Sanitizers
Expand All @@ -544,7 +543,7 @@ Linux/Clang/UndefinedSanitizer:
script:
- cmake example/all -B build -GNinja -DCMAKE_BUILD_TYPE=Release ${CMAKE_OPTIONS}
- ninja -C build
- "! ninja -C build test"
- "! ctest --test-dir build --output-on-failure ${CTEST_OPTIONS}"

macOS/AppleClang/ThreadSanitizer:
variables:
Expand Down Expand Up @@ -580,13 +579,15 @@ macOS/Clang/LeakSanitizer:
macOS/AppleClang/UndefinedSanitizer:
variables:
CMAKE_OPTIONS: -D EXAMPLE_USE_SANITIZER=undefined
CTEST_OPTIONS: --verbose
<<: *macos_success_template

macOS/Clang/UndefinedSanitizer:
variables:
CC: clang
CXX: clang++
CMAKE_OPTIONS: -D EXAMPLE_USE_SANITIZER=undefined
CTEST_OPTIONS: --verbose
<<: *macos_success_template

Windows/MSVC/Address Sanitizer:
Expand All @@ -600,9 +601,9 @@ Windows/MSVC/Address Sanitizer:
- windows
- ${ARCH}
script:
- cmake example/all/ -B build -GNinja -D EXAMPLE_USE_SANITIZER=address
- cmake example/all/ -B build -GNinja -D EXAMPLE_USE_SANITIZER=address $env:CMAKE_OPTIONS
- ninja -C build
- ninja -C build test ; if ($? -ne 0) { exit 1 } else { exit 0 }
- ctest --test-dir build --output-on-failure $env:CTEST_OPTIONS ; if ($? -ne 0) { exit 1 } else { exit 0 }

# Legacy Sanitizer

Expand Down Expand Up @@ -652,13 +653,15 @@ Linux/Clang/MemorySanitizer (LEGACY):
Linux/GCC/UndefinedSanitizer (LEGACY):
variables:
CMAKE_OPTIONS: -D USE_SANITIZER=undefined
CTEST_OPTIONS: --verbose
<<: *linux_success_template

Linux/Clang/UndefinedSanitizer (LEGACY):
variables:
CC: clang
CXX: clang++
CMAKE_OPTIONS: -D USE_SANITIZER=undefined
CTEST_OPTIONS: --verbose
<<: *linux_success_template

Windows/MSVC/Address Sanitizer (LEGACY):
Expand All @@ -674,7 +677,7 @@ Windows/MSVC/Address Sanitizer (LEGACY):
script:
- cmake example/all/ -B build -GNinja -D USE_SANITIZER=address
- ninja -C build
- ninja -C build test ; if ($? -ne 0) { exit 1 } else { exit 0 }
- ctest --test-dir build --output-on-failure $env:CTEST_OPTIONS ; if ($? -ne 0) { exit 1 } else { exit 0 }

macOS/AppleClang/ThreadSanitizer (LEGACY):
variables:
Expand Down Expand Up @@ -710,11 +713,13 @@ macOS/Clang/LeakSanitizer (LEGACY):
macOS/AppleClang/UndefinedSanitizer (LEGACY):
variables:
CMAKE_OPTIONS: -D USE_SANITIZER=undefined
CTEST_OPTIONS: --verbose
<<: *macos_success_template

macOS/Clang/UndefinedSanitizer (LEGACY):
variables:
CC: clang
CXX: clang++
CMAKE_OPTIONS: -D USE_SANITIZER=undefined
CTEST_OPTIONS: --verbose
<<: *macos_success_template

0 comments on commit 95f2126

Please sign in to comment.