Skip to content

Commit

Permalink
Update based on better ekat flag handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jgfouca committed Nov 11, 2024
1 parent bf6aeb7 commit e779856
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 25 deletions.
8 changes: 4 additions & 4 deletions components/eamxx/src/physics/p3/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ endif()

CreateUnitTest(p3_tests "${P3_TESTS_SRCS}"
LIBS p3 p3_test_infra
EXE_ARGS "--flags=\\'${BASELINE_FILE_ARG}\\'"
EXE_ARGS "--args ${BASELINE_FILE_ARG}"
THREADS 1 ${SCREAM_TEST_MAX_THREADS} ${SCREAM_TEST_THREAD_INC}
LABELS "p3;physics")

Expand All @@ -68,7 +68,7 @@ CreateUnitTest(p3_tests "${P3_TESTS_SRCS}"
if (SCREAM_ENABLE_BASELINE_TESTS)
CreateUnitTest (p3_tests_fail p3_rain_sed_unit_tests.cpp
LIBS p3 p3_test_infra
EXE_ARGS "--flags=\\'${BASELINE_FILE_ARG}\\'"
EXE_ARGS "--args ${BASELINE_FILE_ARG}"
COMPILER_CXX_DEFS SCREAM_FORCE_RUN_DIFF
LABELS "p3;physics;fail"
${FORCE_RUN_DIFF_FAILS})
Expand All @@ -77,7 +77,7 @@ endif()
if (NOT SCREAM_P3_SMALL_KERNELS)
CreateUnitTest(p3_sk_tests "${P3_TESTS_SRCS}"
LIBS p3_sk p3_test_infra
EXE_ARGS "--flags=\\'${BASELINE_FILE_ARG}\\'"
EXE_ARGS "--args ${BASELINE_FILE_ARG}"
THREADS 1 ${SCREAM_TEST_MAX_THREADS} ${SCREAM_TEST_THREAD_INC}
LABELS "p3_sk;physics")

Expand All @@ -86,7 +86,7 @@ if (NOT SCREAM_P3_SMALL_KERNELS)
if (SCREAM_ENABLE_BASELINE_TESTS)
CreateUnitTest (p3_sk_tests_fail p3_rain_sed_unit_tests.cpp
LIBS p3_sk p3_test_infra
EXE_ARGS "--flags=\\'${BASELINE_FILE_ARG}\\'"
EXE_ARGS "--args ${BASELINE_FILE_ARG}"
COMPILER_CXX_DEFS SCREAM_FORCE_RUN_DIFF
LABELS "p3_sk;physics;fail"
${FORCE_RUN_DIFF_FAILS})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,28 +85,17 @@ struct UnitWrap {
{
Functions::p3_init(); // many tests will need fortran table data
auto& ts = ekat::TestSession::get();
auto raw_flags = ts.flags.begin()->first;
std::stringstream ss(raw_flags);
std::string flag;
bool next_token_is_path = false;
while (ss >> flag) {
if (flag == "-c") {
m_baseline_action = COMPARE;
}
else if (flag == "-g") {
m_baseline_action = GENERATE;
}
else if (flag == "-n") {
m_baseline_action = NONE;
}
else if (flag == "-b") {
next_token_is_path = true;
}
else if (next_token_is_path) {
m_baseline_path = flag;
next_token_is_path = false;
}
if (ts.flags["c"]) {
m_baseline_action = COMPARE;
}
else if (ts.flags["g"]) {
m_baseline_action = GENERATE;
}
else if (ts.flags["n"]) {
m_baseline_action = NONE;
}
m_baseline_path = ts.params["b"];

EKAT_REQUIRE_MSG( !(m_baseline_action != NONE && m_baseline_path == ""),
"P3 unit test flags problem: baseline actions were requested but no baseline path was provided");

Expand Down

0 comments on commit e779856

Please sign in to comment.