Skip to content

Commit 6269ee2

Browse files
author
Hatim Chahout
committed
Amended testing scripts, param.bash envs and how run_proc is called. #66
1 parent 7b75e74 commit 6269ee2

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

tests/run_test_setup.bash

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,35 @@ function setup_test_env() {
2323
echo "export MSKPATH=$TMP_DIR/MESH_MASK_DIR" >> "param.bash"
2424
echo "export CDFPATH=$TMP_DIR/CDFTOOLS_DIR/bin" >> "param.bash"
2525
echo "export NMLPATH=$TMP_DIR/nam_cdf_names" >> "param.bash"
26+
echo "export EXEPATH=$TMP_DIR" >> "param.bash"
27+
echo "export SCRPATH=$TMP_DIR/SCRIPT" >> "param.bash"
28+
echo "export DATPATH=$TMP_DIR/DATA" >> "param.bash"
2629
echo "export OBSPATH=$TMP_DIR/OBS_PATH_DIR" >> "param.bash"
30+
echo "export OBS_MESH=\${OBSPATH}/obs_mesh.nc" >> "param.bash"
31+
echo "export OBS_ABS_SAL=\${OBSPATH}/obs_abs_sal.nc" >> "param.bash"
32+
echo "export OBS_CON_TEM=\${OBSPATH}/obs_con_tem.nc" >> "param.bash"
33+
# echo "export runOBS=1" >> "param.bash"
34+
35+
echo "Contents of param.bash:"
36+
cat param.bash
37+
38+
# Source the param.bash file to set environment variables
39+
source "param.bash"
2740

2841
# Create the necessary directories and files
29-
mkdir -p "$TMP_DIR/CDFTOOLS_DIR/bin"
30-
mkdir -p "$TMP_DIR/MESH_MASK_DIR"
31-
mkdir -p "$TMP_DIR/OBS_PATH_DIR"
32-
touch "$TMP_DIR/CDFTOOLS_DIR/bin/cdf_tool"
33-
touch "$TMP_DIR/MESH_MASK_DIR/mesh_mask.nc"
34-
touch "$TMP_DIR/MESH_MASK_DIR/bathy.nc"
35-
touch "$TMP_DIR/nam_cdf_names"
36-
touch "$TMP_DIR/OBS_PATH_DIR/obs_abs_sal.nc"
37-
touch "$TMP_DIR/OBS_PATH_DIR/obs_con_tem.nc"
42+
mkdir -p "$MSKPATH"
43+
mkdir -p "$CDFPATH"
44+
mkdir -p "$SCRPATH"
45+
mkdir -p "$DATPATH"
46+
mkdir -p "$OBSPATH"
47+
48+
touch "$NMLPATH"
49+
touch "$CDFPATH/cdf_tool"
50+
touch "$MSKPATH/mesh_mask.nc"
51+
touch "$MSKPATH/bathy.nc"
52+
touch "$OBS_MESH"
53+
touch "$OBS_ABS_SAL"
54+
touch "$OBS_CON_TEM"
3855
}
3956

4057
# Function to clean up the temporary environment after a test

tests/test_valid_run.bash

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ setup_test_env
1111

1212
echo "Changing to temporary directory..."
1313
cd "$TMP_DIR"
14+
1415
echo "Running the process with valid parameters..."
15-
bash ./run_proc.bash -B $MSKPATH/bathy.nc -C 1 $MSKPATH/mesh_mask.nc 2020 2020 1m RUNID_TEST > output.txt 2>&1
16+
source ./run_proc.bash -B bathy.nc -C 1 mesh_mask.nc 2020 2020 1m RUNID_TEST > output.txt 2>&1
1617

1718
if ! grep -q "MOCK SBATCH: --output=.*mk_msks.out /.*/mk_msks.bash" output.txt; then
1819
echo "Test failed: Expected 'mk_msks.bash' job was not submitted."

0 commit comments

Comments
 (0)