add support to run test_c and test_cpp targets as a CMake test

This commit is contained in:
Alfi Maulana 2023-01-22 12:47:03 +07:00
parent 03870ba3b0
commit c04ca4c05a
No known key found for this signature in database
GPG Key ID: 2242A64C2A8DF5A4
2 changed files with 6 additions and 9 deletions

View File

@ -32,7 +32,7 @@ jobs:
with:
source-dir: test
build-dir: output
run_test: true
run-test: true
- name: Check if the default build directory does not exist
run: test ! -d build && test ! -d test/build
@ -51,14 +51,11 @@ jobs:
with:
source-dir: test
targets: test_c test_cpp
run-test: true
c-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
cxx-flags: ${{ matrix.compiler == 'msvc' && '/w /WX-' || '-Wno-unused-variable' }}
args: -D CHECK_SURPASS_WARNING=ON
- name: Run the build results
run: |
${{ matrix.compiler == 'msvc' && 'test\build\Debug\test_c.exe' || 'test/build/test_c' }}
${{ matrix.compiler == 'msvc' && 'test\build\Debug\test_cpp.exe' || 'test/build/test_cpp' }}
test-args: -C test
specified-compiler-usage:
runs-on: ${{ matrix.os }}-latest
@ -74,13 +71,12 @@ jobs:
with:
source-dir: test
targets: test_c test_cpp
run-test: true
generator: Ninja
c-compiler: clang
cxx-compiler: clang++
args: -D CHECK_USING_CLANG=ON
- name: Run the build results
run: test/build/test_c && test/build/test_cpp
test-args: -C test
specified-generator-usage:
runs-on: ${{ matrix.os }}-latest

View File

@ -28,4 +28,5 @@ foreach(LANG ${LANGS})
$<$<BOOL:${CHECK_USING_CLANG}>:CHECK_USING_CLANG>
$<$<BOOL:${CHECK_SURPASS_WARNING}>:CHECK_SURPASS_WARNING>
)
add_test(NAME test_${LANG} CONFIGURATIONS test COMMAND $<TARGET_FILE:test_${LANG}>)
endforeach()