Skip to content

Commit 95f2126

Browse files
committed
Update CI job instructions for running tests
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.
1 parent fe761d5 commit 95f2126

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

.gitlab-ci.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ stages:
44
- All Code Coverage
55
- Sanitizers
66

7-
variables:
8-
CTEST_OUTPUT_ON_FAILURE: "1"
9-
107
# Analysis
118

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

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

461458
Linux/Static Analysis:
462459
variables:
@@ -511,13 +508,15 @@ Linux/Clang/MemorySanitizer:
511508
Linux/GCC/UndefinedSanitizer:
512509
variables:
513510
CMAKE_OPTIONS: -D EXAMPLE_USE_SANITIZER=undefined
511+
CTEST_OPTIONS: --verbose
514512
<<: *linux_success_template
515513

516514
Linux/Clang/UndefinedSanitizer:
517515
variables:
518516
CC: clang
519517
CXX: clang++
520518
CMAKE_OPTIONS: -D EXAMPLE_USE_SANITIZER=undefined
519+
CTEST_OPTIONS: --verbose
521520
<<: *linux_success_template
522521

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

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

549548
macOS/AppleClang/ThreadSanitizer:
550549
variables:
@@ -580,13 +579,15 @@ macOS/Clang/LeakSanitizer:
580579
macOS/AppleClang/UndefinedSanitizer:
581580
variables:
582581
CMAKE_OPTIONS: -D EXAMPLE_USE_SANITIZER=undefined
582+
CTEST_OPTIONS: --verbose
583583
<<: *macos_success_template
584584

585585
macOS/Clang/UndefinedSanitizer:
586586
variables:
587587
CC: clang
588588
CXX: clang++
589589
CMAKE_OPTIONS: -D EXAMPLE_USE_SANITIZER=undefined
590+
CTEST_OPTIONS: --verbose
590591
<<: *macos_success_template
591592

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

607608
# Legacy Sanitizer
608609

@@ -652,13 +653,15 @@ Linux/Clang/MemorySanitizer (LEGACY):
652653
Linux/GCC/UndefinedSanitizer (LEGACY):
653654
variables:
654655
CMAKE_OPTIONS: -D USE_SANITIZER=undefined
656+
CTEST_OPTIONS: --verbose
655657
<<: *linux_success_template
656658

657659
Linux/Clang/UndefinedSanitizer (LEGACY):
658660
variables:
659661
CC: clang
660662
CXX: clang++
661663
CMAKE_OPTIONS: -D USE_SANITIZER=undefined
664+
CTEST_OPTIONS: --verbose
662665
<<: *linux_success_template
663666

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

679682
macOS/AppleClang/ThreadSanitizer (LEGACY):
680683
variables:
@@ -710,11 +713,13 @@ macOS/Clang/LeakSanitizer (LEGACY):
710713
macOS/AppleClang/UndefinedSanitizer (LEGACY):
711714
variables:
712715
CMAKE_OPTIONS: -D USE_SANITIZER=undefined
716+
CTEST_OPTIONS: --verbose
713717
<<: *macos_success_template
714718

715719
macOS/Clang/UndefinedSanitizer (LEGACY):
716720
variables:
717721
CC: clang
718722
CXX: clang++
719723
CMAKE_OPTIONS: -D USE_SANITIZER=undefined
724+
CTEST_OPTIONS: --verbose
720725
<<: *macos_success_template

0 commit comments

Comments
 (0)