Skip to content

Commit 2269446

Browse files
committed
merge dev
2 parents 7e02d90 + 8b4d541 commit 2269446

File tree

183 files changed

+857
-408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+857
-408
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Fortran Unit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- development
7+
- main
8+
pull_request:
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
gcc-toolchain:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix:
20+
version: [12, 13, 14]
21+
env:
22+
CC: gcc-${{ matrix.version }}
23+
CXX: g++-${{ matrix.version }}
24+
FC: gfortran-${{ matrix.version }}
25+
steps:
26+
- name: Checkout cam-sima
27+
uses: actions/checkout@v4
28+
29+
- name: Build pFUnit
30+
run: |
31+
git clone --depth 1 --branch v4.10.0 https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git
32+
cd pFUnit
33+
cmake -B./build -S.
34+
cd build
35+
make install
36+
37+
- name: Build cam-sima
38+
run: |
39+
cmake \
40+
-DCMAKE_PREFIX_PATH=/home/runner/work/CAM-SIMA/CAM-SIMA/pFUnit/build/installed \
41+
-DCAM_SIMA_ENABLE_CODE_COVERAGE=ON \
42+
-B./build \
43+
-S./test/unit/fortran
44+
cd build
45+
make
46+
47+
- name: Run fortran unit tests
48+
run: |
49+
cd build && ctest -V --output-on-failure --output-junit test_results.xml
50+
51+
- name: Upload unit test results
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: unit-test-results-${{ env.FC }}
55+
path: build/test_results.xml
56+
57+
- name: Setup GCov
58+
run: |
59+
python3 -m venv venv
60+
source venv/bin/activate
61+
pip3 install gcovr
62+
63+
- name: Run Gcov
64+
run: |
65+
source venv/bin/activate
66+
cd build
67+
gcovr --gcov-executable gcov-${{ matrix.version }} -r .. --filter '\.\./src' --html cam_sima_code_coverage.html --txt
68+
69+
- name: Upload code coverage results
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: code-coverage-results-${{ env.FC }}
73+
path: build/cam_sima_code_coverage.html

.github/workflows/python_unit_tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Python Unit Tests
22

33
on:
4+
workflow_dispatch:
45
pull_request:
56
types: [opened, synchronize, reopened]
67
push:
@@ -16,12 +17,12 @@ jobs:
1617
#a PR is either opened or synced (i.e. additional commits are pushed
1718
#to branch involved in PR).
1819
python_unit_tests:
19-
if: github.event_name == 'pull_request' || github.repository == 'ESCOMP/CAM-SIMA'
20+
if: github.event_name == 'pull_request' || github.repository == 'ESCOMP/CAM-SIMA' || github.event_name == 'workflow_dispatch'
2021
runs-on: ubuntu-latest
2122
strategy:
2223
matrix:
2324
#All of these python versions will be used to run tests:
24-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
25+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
2526
fail-fast: false
2627
steps:
2728
# Acquire github action routines:
@@ -56,4 +57,4 @@ jobs:
5657
pytest src/data --doctest-modules
5758
5859
# Run all python unit tests:
59-
pytest test/unit
60+
pytest test/unit/python

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ buildnmlc
55
# Ignore test output
66
test/include/*.mod
77
test/include/*.o
8-
test/unit/tmp
8+
test/unit/python/tmp
99
test/system/*.log
1010
test/system/cime-tests.o*
1111
test_driver_*.sh

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
[submodule "ncar-physics"]
2121
path = src/physics/ncar_ccpp
2222
url = https://github.com/ESCOMP/atmospheric_physics
23-
fxtag = 60b71f3fd9f10b362caf64afffce12de10854d4d
23+
fxtag = 252b500a93c89f36ece7d8ba08fd8eb025279eaa
2424
fxrequired = AlwaysRequired
2525
fxDONOTUSEurl = https://github.com/ESCOMP/atmospheric_physics
2626
[submodule "ccs_config"]

cime_config/atm_in_paramgen.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,11 +1495,16 @@ def write(self, output_path):
14951495
# Write all variables within that group (sorted alphabetically):
14961496
for var in sorted(self._data[nml_group], key=var_sort_key):
14971497
#Extract variable value(s):
1498-
val = self._data[nml_group][var]["values"].strip()
1498+
val = self._data[nml_group][var]["values"]
14991499

1500-
#If no value is set then move to the next variable:
1500+
#Raise error if no value found:
15011501
if val is None:
1502-
continue
1502+
emsg = f"Namelist entry '{var}' is missing a "
1503+
emsg += "valid/default 'value' element."
1504+
raise AtmInParamGenError(emsg)
1505+
else:
1506+
#If value found then strip white space:
1507+
val = val.strip()
15031508
#End if
15041509

15051510
#Extract variable type:

cime_config/buildlib

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ def _build_cam():
105105
os.path.join(atm_root, "src", "history", "buffers", "src"),
106106
os.path.join(atm_root, "src", "history", "buffers", "src", "hash"),
107107
os.path.join(atm_root, "src", "history", "buffers", "src", "util"),
108-
os.path.join(atm_root, "src", "utils")]
108+
os.path.join(atm_root, "src", "utils"),
109+
os.path.join(atm_root, "src", "core_utils")]
109110
for path in phys_dirs:
110111
if path not in paths:
111112
paths.append(path)

cime_config/cam_autogen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def _find_scheme_source(source_dirs, metadata_file_name):
132132
doctests:
133133
134134
1. Check that the function can correctly find source and namelist files:
135-
>>> _find_scheme_source([os.path.join(_CAM_ROOT_DIR, "test", "unit", "sample_files", \
135+
>>> _find_scheme_source([os.path.join(_CAM_ROOT_DIR, "test", "unit", "python", "sample_files", \
136136
"autogen_files")], "two_scheme_banana") # doctest: +ELLIPSIS
137137
('...two_scheme_banana.F90', '...two_scheme_banana_namelist.xml')
138138

cime_config/testdefs/testlist_cam.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
<option name="comment">Test for Moist Held-Suarez (TJ2016) physics (physics_after_coupler group)</option>
4444
</options>
4545
</test>
46+
<test compset="FPHYStest" grid="ne3pg3_ne3pg3_mg37" name="SMS_Ln2" testmods="cam/outfrq_zm_derecho">
47+
<machines>
48+
<machine name="derecho" compiler="gnu" category="aux_sima"/>
49+
</machines>
50+
<options>
51+
<option name="wallclock">00:10:00</option>
52+
<option name="comment">Test for Zhang McFarlane physics</option>
53+
</options>
54+
</test>
4655

4756
<!-- Derecho dycore tests -->
4857
<test compset="FKESSLER" grid="mpasa480_mpasa480" name="SMS_Ln9" testmods="cam/outfrq_kessler_mpas_derecho">
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites kessler"
1+
./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites kessler_test"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./xmlchange CAM_CONFIG_OPTS="--dyn none --physics-suites zhang_mcfarlane"

0 commit comments

Comments
 (0)