Skip to content

Commit

Permalink
Test (#113)
Browse files Browse the repository at this point in the history
* installing pkg-config in mingw

* checking pkg config version

* getting location

* trying to use the mysys shell

* putting msys onto the path

* format error

* setting pkg-config location

* trying choco instead

* not using choclatey

* using pkgconf?

* removing compiler check

* I want to see what's installed

* maybe using the msys shell?

* ah, this may be it

* removing explicit path for pkg config

* adding build types and tests

* correcting syntax

* trying to get tests to run

* maybe i have to cd

* gotta be in the build directory

* not running tests that require bash scripts on windows

* ignoring more tests that depend on shell scripts

* output on failure for tests

* seeing if diagnostics is the problem

* um, ok

* removing unused file

* trying to test multiple versions

* undoing a change

* adding a dash

* triggering a build

* removing versions
  • Loading branch information
K20shores authored Oct 29, 2024
1 parent 54c5410 commit 11bf64d
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 88 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ concurrency:
jobs:
gnu:
runs-on: macos-latest
continue-on-error: true
strategy:
matrix:
gcc_version: [12, 13, 14]
Expand All @@ -31,4 +32,7 @@ jobs:
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }}

- name: Build
run: cmake --build build --verbose
run: cmake --build build --verbose

- name: Test
run: ctest -C ${{ matrix.build_type }} --output-on-failure
32 changes: 25 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@ on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true

jobs:
gnu:
runs-on: windows-latest
continue-on-error: true
strategy:
matrix:
build_type: [Debug, Release]

steps:
- name: Checkout code
Expand All @@ -22,23 +30,33 @@ jobs:
install: >-
base-devel
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-cmake
mingw-w64-x86_64-netcdf
mingw-w64-x86_64-netcdf-fortran
msystem: MINGW64

- name: Check if CMake exists in the expected path
run: cmake --version

- name: Check if compilers are available

- name: Check package versions
shell: msys2 {0}
run: |
cmake --version
gcc --version
g++ --version
gfortran --version
make --version
pkg-config --version
- name: Configure with CMake
run: cmake -G "MinGW Makefiles" -B build
shell: msys2 {0}
run: |
cmake -G "MinGW Makefiles" -S . -B build -D CMAKE_BUILD_TYPE=${{ matrix.build_type }}
- name: Build the project
run: cmake --build build
shell: msys2 {0}
run: cmake --build build

- name: Run the tests
working-directory: build
shell: msys2 {0}
run: ctest -C ${{ matrix.build_type }} --output-on-failure
2 changes: 1 addition & 1 deletion examples/tuv_5_4.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
]
},
"photolysis": {
"enable diagnostics" : true,
"enable diagnostics" : false,
"reactions": [
{
"name": "O2+hv->O+O",
Expand Down
2 changes: 1 addition & 1 deletion examples/tuv_5_4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ grids:
- 12.0
- 14.0
photolysis:
enable diagnostics: true
enable diagnostics: false
reactions:
- cross section:
apply O2 bands: true
Expand Down
14 changes: 8 additions & 6 deletions test/regression/dose_rates/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ include(test_util)
################################################################################
# Dose rate regression tests


add_regression_test(
regression_dose_rates
test/regression/dose_rates/dose_rates.sh
test/regression/dose_rates/dose_rates_memcheck.sh
)
# windows doesn't run .sh files
if(NOT WIN32)
add_regression_test(
regression_dose_rates
test/regression/dose_rates/dose_rates.sh
test/regression/dose_rates/dose_rates_memcheck.sh
)
endif()

################################################################################
13 changes: 8 additions & 5 deletions test/regression/photolysis_rates/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ include(test_util)
################################################################################
# Phototolysis rate regression tests

add_regression_test(
regression_photolysis_rates
test/regression/photolysis_rates/photolysis_rates.sh
test/regression/photolysis_rates/photolysis_rates_memcheck.sh
)
# windows doesn't run .sh files
if(NOT WIN32)
add_regression_test(
regression_photolysis_rates
test/regression/photolysis_rates/photolysis_rates.sh
test/regression/photolysis_rates/photolysis_rates_memcheck.sh
)
endif()

################################################################################
103 changes: 53 additions & 50 deletions test/regression/radiators/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,64 +6,67 @@ include(test_util)
################################################################################
# Radiator regression tests

add_regression_test(
regression_aerosols_radiator
test/regression/radiators/radiation.aerosols.sh
test/regression/radiators/radiation.aerosols.memcheck.sh
)
# windows doesn't run .sh files
if(NOT WIN32)
add_regression_test(
regression_aerosols_radiator
test/regression/radiators/radiation.aerosols.sh
test/regression/radiators/radiation.aerosols.memcheck.sh
)

add_regression_test(
regression_aerosols_radiator_4strm
test/regression/radiators/radiation.aerosols.4strm.sh
test/regression/radiators/radiation.aerosols.4strm.memcheck.sh
)
add_regression_test(
regression_aerosols_radiator_4strm
test/regression/radiators/radiation.aerosols.4strm.sh
test/regression/radiators/radiation.aerosols.4strm.memcheck.sh
)

add_regression_test(
regression_o2_radiator
test/regression/radiators/radiation.o2.sh
test/regression/radiators/radiation.o2.memcheck.sh
)
add_regression_test(
regression_o2_radiator
test/regression/radiators/radiation.o2.sh
test/regression/radiators/radiation.o2.memcheck.sh
)

add_regression_test(
regression_o2_radiator_4strm
test/regression/radiators/radiation.o2.4strm.sh
test/regression/radiators/radiation.o2.4strm.memcheck.sh
)
add_regression_test(
regression_o2_radiator_4strm
test/regression/radiators/radiation.o2.4strm.sh
test/regression/radiators/radiation.o2.4strm.memcheck.sh
)

add_regression_test(
regression_o3_radiator
test/regression/radiators/radiation.o3.sh
test/regression/radiators/radiation.o3.memcheck.sh
)
add_regression_test(
regression_o3_radiator
test/regression/radiators/radiation.o3.sh
test/regression/radiators/radiation.o3.memcheck.sh
)

add_regression_test(
regression_o3_radiator_4strm
test/regression/radiators/radiation.o3.4strm.sh
test/regression/radiators/radiation.o3.4strm.memcheck.sh
)
add_regression_test(
regression_o3_radiator_4strm
test/regression/radiators/radiation.o3.4strm.sh
test/regression/radiators/radiation.o3.4strm.memcheck.sh
)

add_regression_test(
regression_rayleigh_radiator
test/regression/radiators/radiation.rayleigh.sh
test/regression/radiators/radiation.rayleigh.memcheck.sh
)
add_regression_test(
regression_rayleigh_radiator
test/regression/radiators/radiation.rayleigh.sh
test/regression/radiators/radiation.rayleigh.memcheck.sh
)

add_regression_test(
regression_rayleigh_radiator_4strm
test/regression/radiators/radiation.rayleigh.4strm.sh
test/regression/radiators/radiation.rayleigh.4strm.memcheck.sh
)
add_regression_test(
regression_rayleigh_radiator_4strm
test/regression/radiators/radiation.rayleigh.4strm.sh
test/regression/radiators/radiation.rayleigh.4strm.memcheck.sh
)

add_regression_test(
regression_all_radiators
test/regression/radiators/radiation.all.sh
test/regression/radiators/radiation.all.memcheck.sh
)
add_regression_test(
regression_all_radiators
test/regression/radiators/radiation.all.sh
test/regression/radiators/radiation.all.memcheck.sh
)

add_regression_test(
regression_all_radiators_4strm
test/regression/radiators/radiation.all.4strm.sh
test/regression/radiators/radiation.all.4strm.memcheck.sh
)
add_regression_test(
regression_all_radiators_4strm
test/regression/radiators/radiation.all.4strm.sh
test/regression/radiators/radiation.all.4strm.memcheck.sh
)
endif()

################################################################################
37 changes: 20 additions & 17 deletions test/unit/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,33 @@ include(test_util)
################################################################################
# Utility tests

create_standard_test(NAME util_array SOURCES array.F90)
# windows doesn't run .sh files
if(NOT WIN32)
create_standard_test(NAME util_array SOURCES array.F90)

create_standard_cxx_test(NAME util_array2d SOURCES array2d.cpp)
create_standard_cxx_test(NAME util_array2d SOURCES array2d.cpp)

create_standard_cxx_test(NAME util_array3d SOURCES array3d.cpp)
create_standard_cxx_test(NAME util_array3d SOURCES array3d.cpp)

create_standard_test(NAME util_assert SOURCES assert.F90)
add_executable(util_assert_failure assert.F90)
set_target_properties(util_assert_failure PROPERTIES LINKER_LANGUAGE Fortran)
add_std_test_script(util_assert_failure assert.sh)
create_standard_test(NAME util_assert SOURCES assert.F90)
add_executable(util_assert_failure assert.F90)
set_target_properties(util_assert_failure PROPERTIES LINKER_LANGUAGE Fortran)
add_std_test_script(util_assert_failure assert.sh)

create_standard_test(NAME util_config SOURCES config.F90)
create_standard_test(NAME util_config SOURCES config.F90)

create_standard_test(NAME util_map SOURCES map.F90)
add_executable(util_map_failure map.F90)
set_target_properties(util_map_failure PROPERTIES LINKER_LANGUAGE Fortran)
add_std_test_script(util_map_failure map.sh)
create_standard_test(NAME util_map SOURCES map.F90)
add_executable(util_map_failure map.F90)
set_target_properties(util_map_failure PROPERTIES LINKER_LANGUAGE Fortran)
add_std_test_script(util_map_failure map.sh)

create_standard_test(NAME util_mpi SOURCES mpi.F90)
create_standard_test(NAME util_mpi SOURCES mpi.F90)

create_standard_test(NAME util_string SOURCES string.F90)
add_executable(util_string_failure string.F90)
set_target_properties(util_string_failure PROPERTIES LINKER_LANGUAGE Fortran)
add_std_test_script(util_string_failure string.sh)
create_standard_test(NAME util_string SOURCES string.F90)
add_executable(util_string_failure string.F90)
set_target_properties(util_string_failure PROPERTIES LINKER_LANGUAGE Fortran)
add_std_test_script(util_string_failure string.sh)
endif()

add_subdirectory(io)

Expand Down

0 comments on commit 11bf64d

Please sign in to comment.