Skip to content

Commit 49c9ab2

Browse files
committed
add support to run test_c and test_cpp targets as a CMake test
1 parent 03870ba commit 49c9ab2

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,11 @@ jobs:
5151
with:
5252
source-dir: test
5353
targets: test_c test_cpp
54+
run_test: true
5455
c-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
5556
cxx-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
5657
args: -D CHECK_SURPASS_WARNING=ON
57-
58-
- name: Run the build results
59-
run: |
60-
${{ matrix.compiler == 'msvc' && 'test\build\Debug\test_c.exe' || 'test/build/test_c' }}
61-
${{ matrix.compiler == 'msvc' && 'test\build\Debug\test_cpp.exe' || 'test/build/test_cpp' }}
58+
test_args: -C test
6259

6360
specified-compiler-usage:
6461
runs-on: ${{ matrix.os }}-latest
@@ -74,13 +71,12 @@ jobs:
7471
with:
7572
source-dir: test
7673
targets: test_c test_cpp
74+
run_test: true
7775
generator: Ninja
7876
c-compiler: clang
7977
cxx-compiler: clang++
8078
args: -D CHECK_USING_CLANG=ON
81-
82-
- name: Run the build results
83-
run: test/build/test_c && test/build/test_cpp
79+
test_args: -C test
8480

8581
specified-generator-usage:
8682
runs-on: ${{ matrix.os }}-latest

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ foreach(LANG ${LANGS})
2828
$<$<BOOL:${CHECK_USING_CLANG}>:CHECK_USING_CLANG>
2929
$<$<BOOL:${CHECK_SURPASS_WARNING}>:CHECK_SURPASS_WARNING>
3030
)
31+
add_test(NAME test_${LANG} CONFIGURATIONS test COMMAND $<TARGET_FILE:test_${LANG}>)
3132
endforeach()

0 commit comments

Comments
 (0)