Skip to content

Commit

Permalink
adds cmake for test headers check
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveBronder committed Nov 21, 2024
1 parent 6a46395 commit 8aadf09
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 26 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/header_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ jobs:
Get-Command mingw32-make | Select-Object -ExpandProperty Definition
shell: powershell

- name: Build Math libs
shell: powershell
run: mingw32-make -f make/standalone math-libs -j2
# - name: Build Math libs
# shell: powershell
# run: mingw32-make -f make/standalone math-libs -j2

- name: Run header tests
shell: powershell
run: make -j2 test-headers
run: |
cmake -S . -B build -DCMAKE_BUILD_TYPE=RELEASE
cd build
make -j2 test-headers
opencl:
name: OpenCL
Expand All @@ -56,7 +59,8 @@ jobs:

- name: Run header tests
run: |
echo "STAN_OPENCL=true" > make/local
cmake -S . -B build -DCMAKE_BUILD_TYPE=RELEASE
cd build
make -j2 test-headers
no_range_checks:
name: NoRange
Expand All @@ -67,5 +71,8 @@ jobs:

- name: Run header tests
run: |
echo "STAN_NO_RANGE_CHECKS=true" > make/local
./runTests.py -j2 ./test/unit/math/prim/err/
cmake -S . -B build -DCMAKE_BUILD_TYPE=RELEASE -DSTAN_NO_RANGE_CHECKS=ON
cd build
make -j4 test_unit_math_prim_err_subtests
cd test
ctest -R "unit_math_prim_err"
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ jobs:
if: runner.os == 'Windows'
run: echo "C:/rtools44/usr/bin;C:/rtools44/x86_64-w64-mingw32.static.posix/bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8

- name: Build Math libs
shell: powershell
run: |
make -f make/standalone math-libs -j4
# - name: Build Math libs
# shell: powershell
# run: |
# make -f make/standalone math-libs -j4
- name: Add TBB to PATH
shell: powershell
run: echo "D:/a/math/math/lib/tbb" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8
Expand Down
35 changes: 20 additions & 15 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,45 +49,48 @@ endfunction()
function(newset_test_labels target label)
get_property(SUBTESTS TARGET ${target} PROPERTY MANUALLY_ADDED_DEPENDENCIES)
# Loop over the subtests
message(STATUS "{target} dependencies: ${SUBTESTS}")
foreach(subtest ${SUBTESTS})
string(FIND "${subtest}" "_test" INDEX REVERSE)
message("Checking: ${subtest}")
if(INDEX GREATER -1)
message("{subset} ends with the suffix.")
message("${subtest} ends with the suffix.")
# Set the labels for tests ending with "_test"
set_property(TEST ${subtest} PROPERTY LABELS ${label})
else()
message(STATUS "RECURSE on ${subtest}")
# Recursively call set_test_labels for other targets
set_test_labels(subtest ${label})
newset_test_labels(${subtest} ${label})
message(STATUS "FINISH on ${subtest}")
endif()
endforeach()
endfunction()

add_custom_target(test_unit_math_opencl_tests)
add_dependencies(test_unit_math_opencl_tests
test_unit_math_opencl_subtests test_unit_math_opencl_device_functions_subtests
test_unit_math_opencl_kernel_generator_subtests
test_unit_math_opencl_prim_subtests test_unit_math_opencl_rev_subtests)
test_unit_math_opencl_subtests test_unit_math_opencl_device_functions_subtests
test_unit_math_opencl_kernel_generator_subtests
test_unit_math_opencl_prim_subtests test_unit_math_opencl_rev_subtests)
newset_test_labels(test_unit_math_opencl_tests "unit_math_opencl")

message("Adding unit_math_mix_subtests")
add_custom_target(test_unit_math_mix_tests)
add_dependencies(test_unit_math_mix_tests
test_unit_math_mix_core_subtests
test_unit_math_mix_fun_subtests
test_unit_math_mix_functor_subtests
test_unit_math_mix_constraint_subtests
test_unit_math_mix_meta_subtests
test_unit_math_mix_prob_subtests)
test_unit_math_mix_core_subtests
test_unit_math_mix_fun_subtests
test_unit_math_mix_functor_subtests
test_unit_math_mix_constraint_subtests
test_unit_math_mix_meta_subtests
test_unit_math_mix_prob_subtests)
newset_test_labels(test_unit_math_mix_tests "unit_math_mix")
newset_test_labels(test_unit_math_mix_fun_subtests "unit_math_mix_fun")

add_custom_target(test_unit_math_mix_nonfun_tests)
add_dependencies(test_unit_math_mix_nonfun_tests
test_unit_math_mix_core_subtests
test_unit_math_mix_functor_subtests
test_unit_math_mix_meta_subtests
test_unit_math_mix_prob_subtests)
test_unit_math_mix_core_subtests
test_unit_math_mix_functor_subtests
test_unit_math_mix_meta_subtests
test_unit_math_mix_prob_subtests)
newset_test_labels(test_unit_math_mix_nonfun_tests "unit_math_mix_nonfun")

message("Adding unit_math_fwd_nonfun_mix_subtests")
Expand Down Expand Up @@ -194,3 +197,5 @@ add_dependencies(test_unit_math_mpi_tests
test_unit_math_prim_functor_subtests test_unit_math_rev_functor_subtests)
newset_test_labels(test_unit_math_mpi_tests "unit_math_mpi_subtest")


newset_test_labels(test_unit_math_prim_err_subtests "unit_math_prim_err")

0 comments on commit 8aadf09

Please sign in to comment.