Skip to content

Commit

Permalink
Per #3051, update unit tests so that installed files are found relati…
Browse files Browse the repository at this point in the history
…ve to MET_BASE (<install_loc>/share/met) and other files that are only in the MET repo are found relative to MET_TEST_BASE (MET/internal/test_unit). Also remove MET_BUILD_BASE env var
  • Loading branch information
georgemccabe committed Jan 15, 2025
1 parent 174ab7b commit 342e2dc
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 22 deletions.
1 change: 0 additions & 1 deletion .github/jobs/test_env_vars.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export MET_BASE=/usr/local/share/met

export MET_BUILD_BASE=${MET_REPO_DIR}
export MET_TEST_BASE=${MET_REPO_DIR}/internal/test_unit
export PERL5LIB=${MET_TEST_BASE}/lib

Expand Down
8 changes: 4 additions & 4 deletions docs/Users_Guide/appendixA.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Q. How do I use map_data?
sample.grib china_tmp_2m_admin.ps \
'name="TMP"; level="Z2"; \
map_data = { source = [ { file_name = \
"${MET_BUILD_BASE}/data/map/admin_by_country/admin_China_data"; } \
"${MET_BASE}/map/admin_by_country/admin_China_data"; } \
]; }'

Q. How can I understand the number of matched pairs?
Expand Down Expand Up @@ -449,7 +449,7 @@ Q. Is an example of verifying forecast probabilities?

.. code-block:: none
${MET_BUILD_BASE}/scripts/config/GridStatConfig_POP_12
MET/scripts/config/GridStatConfig_POP_12

The config file should look something like this:

Expand Down Expand Up @@ -720,7 +720,7 @@ Q. How do I correct a precipitation time range?

.. code-block:: none
wgrib ${MET_BUILD_BASE}/data/sample_fcst/2005080700/wrfprs_ruc13_12.tm00_G212 | grep APCP
wgrib MET/data/sample_fcst/2005080700/wrfprs_ruc13_12.tm00_G212 | grep APCP
1:0:d=05080700:APCP:kpds5=61:kpds6=1:kpds7=0:TR=4:P1=0: \
P2=12:TimeU=1:sfc:0- 12hr acc:NAve=0
2:31408:d=05080700:APCP:kpds5=61:kpds6=1:kpds7=0:TR=4: \
Expand Down Expand Up @@ -1512,7 +1512,7 @@ Q. How does pairwise differences using plot_tcmpr.R work?

.. code-block:: none
Rscript ${MET_BUILD_BASE}/scripts/Rscripts/plot_tcmpr.R \
Rscript ${MET_BASE}/Rscripts/plot_tcmpr.R \
-lookin tc_pairs_output.tcst \
-filter '-amodel AHWI,GFSI' \
-series AMODEL AHWI,GFSI,AHWI-GFSI \
Expand Down
3 changes: 1 addition & 2 deletions internal/scripts/regression/test_unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ if [ -z ${MET_TEST_INPUT+x} ]; then
fi

# Run the unit tests
export MET_BUILD_BASE=$(pwd)
export MET_BASE=$MET_BUILD_BASE/share/met
export MET_BASE=$(pwd)/share/met
export MET_TEST_BASE=$(pwd)/internal/test_unit
export MET_TEST_OUTPUT=$(pwd)/test_output
export MET_TMP_DIR=$(pwd)/internal/test_unit/tmp
Expand Down
4 changes: 1 addition & 3 deletions internal/test_unit/bin/unit_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

# Check that required unit test environment variables are set
if [[ -z "${MET_BASE}" ||
-z "${MET_BUILD_BASE}" ||
-z "${MET_TEST_BASE}" ||
-z "${MET_TEST_INPUT}" ||
-z "${MET_TEST_OUTPUT}" ]]; then
echo
echo "ERROR: Required environment variable(s) unset:"
echo "ERROR: \${MET_BASE}, \${MET_BUILD_BASE}, \${MET_TEST_BASE}, \${MET_TEST_INPUT}, \${MET_TEST_OUTPUT}"
echo "ERROR: \${MET_BASE}, \${MET_TEST_BASE}, \${MET_TEST_INPUT}, \${MET_TEST_OUTPUT}"
echo
exit
else
echo "export MET_BASE=${MET_BASE}"
echo "export MET_BUILD_BASE=${MET_BUILD_BASE}"
echo "export MET_TEST_BASE=${MET_TEST_BASE}"
echo "export MET_TEST_INPUT=${MET_TEST_INPUT}"
echo "export MET_TEST_OUTPUT=${MET_TEST_OUTPUT}"
Expand Down
2 changes: 1 addition & 1 deletion internal/test_unit/xml/unit_gen_vx_mask.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE met_test [
<!ENTITY MET_BASE "${MET_BASE}">
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_DATA "${MET_BUILD_BASE}/data">
<!ENTITY MET_DATA "${MET_TEST_BASE}/../../data">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down
2 changes: 1 addition & 1 deletion internal/test_unit/xml/unit_grid_diag.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE met_test [
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_DATA "${MET_BUILD_BASE}/data">
<!ENTITY MET_DATA "${MET_TEST_BASE}/../../data">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down
1 change: 0 additions & 1 deletion internal/test_unit/xml/unit_ioda2nc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<!DOCTYPE met_test [
<!ENTITY MET_BASE "${MET_BASE}">
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_DATA "${MET_BUILD_BASE}/data">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down
4 changes: 2 additions & 2 deletions internal/test_unit/xml/unit_met_test_scripts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<!DOCTYPE met_test [
<!ENTITY MET_BASE "${MET_BASE}">
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_DATA "${MET_BUILD_BASE}/data">
<!ENTITY MET_SCRIPTS "${MET_BUILD_BASE}/scripts">
<!ENTITY MET_DATA "${MET_TEST_BASE}/../../data">
<!ENTITY MET_SCRIPTS "${MET_TEST_BASE}/../../scripts">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}/met_test_scripts">
Expand Down
2 changes: 1 addition & 1 deletion internal/test_unit/xml/unit_modis.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE met_test
[
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_DATA "${MET_BUILD_BASE}/data">
<!ENTITY MET_DATA "${MET_TEST_BASE}/../../data">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down
1 change: 0 additions & 1 deletion internal/test_unit/xml/unit_pb2nc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<!DOCTYPE met_test [
<!ENTITY MET_BASE "${MET_BASE}">
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_DATA "${MET_BUILD_BASE}/data">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down
2 changes: 1 addition & 1 deletion internal/test_unit/xml/unit_pb2nc_indy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE met_test [
<!ENTITY MET_BASE "${MET_BASE}">
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_DATA "${MET_BUILD_BASE}/data">
<!ENTITY MET_DATA "${MET_TEST_BASE}/../../data">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down
2 changes: 1 addition & 1 deletion internal/test_unit/xml/unit_perc_thresh.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE met_test [
<!ENTITY MET_BASE "${MET_BASE}">
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_DATA "${MET_BUILD_BASE}/data">
<!ENTITY MET_DATA "${MET_TEST_BASE}/../../data">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down
2 changes: 1 addition & 1 deletion internal/test_unit/xml/unit_plot_tc.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE met_test [
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_SCRIPTS "${MET_BUILD_BASE}/scripts">
<!ENTITY MET_SCRIPTS "${MET_BASE}">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down
2 changes: 1 addition & 1 deletion internal/test_unit/xml/unit_python.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE met_test [
<!ENTITY MET_BASE "${MET_BASE}">
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_DATA "${MET_BUILD_BASE}/data">
<!ENTITY MET_DATA "${MET_TEST_BASE}/../../data">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down
2 changes: 1 addition & 1 deletion internal/test_unit/xml/unit_trmm2nc.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE met_test [
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY MET_SCRIPTS "${MET_BUILD_BASE}/scripts">
<!ENTITY MET_SCRIPTS "${MET_BASE}">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
Expand Down

0 comments on commit 342e2dc

Please sign in to comment.