|
4 | 4 | # Exit immediately if a command exits with a non-zero status. |
5 | 5 | set -e |
6 | 6 |
|
7 | | -# Mock the 'sbatch' command to write to stdout |
8 | | -sbatch() { |
9 | | - echo "MOCK SBATCH: $@" |
10 | | -} |
11 | | -export -f sbatch |
12 | | - |
13 | | -# Mock other commands used in the run_proc.bash |
| 7 | +# Mock functions from run_proc.bash |
| 8 | +sbatch() { echo "MOCK SBATCH: $@"; } |
14 | 9 | slurm_wait() { :; } |
15 | 10 | moo_wait() { :; } |
16 | 11 | sacct() { echo ""; } |
17 | | -squeue() { echo "P$$"; } # Add this new mock function |
18 | | -export -f slurm_wait moo_wait sacct squeue |
| 12 | +squeue() { echo "P$$"; } |
| 13 | +export -f sbatch slurm_wait moo_wait sacct squeue |
19 | 14 |
|
20 | 15 | # Function to set up the temporary environment for a test |
21 | 16 | function setup_test_env() { |
22 | 17 | export TMP_DIR=$(mktemp -d) |
23 | | - cp param.bash "$TMP_DIR/param.bash" |
| 18 | + |
| 19 | + # Create an empty param.bash and add the mock paths to it |
| 20 | + touch "$TMP_DIR/param.bash" |
| 21 | + echo "export MARINE_VAL=$TMP_DIR" >> "$TMP_DIR/param.bash" |
| 22 | + echo "export MSKPATH=$TMP_DIR/MESH_MASK_DIR" >> "$TMP_DIR/param.bash" |
| 23 | + echo "export CDFPATH=$TMP_DIR/CDFTOOLS_DIR/bin" >> "$TMP_DIR/param.bash" |
| 24 | + echo "export NMLPATH=$TMP_DIR/nam_cdf_names" >> "$TMP_DIR/param.bash" |
| 25 | + echo "export OBSPATH=$TMP_DIR/OBS_PATH_DIR" >> "$TMP_DIR/param.bash" |
| 26 | + |
| 27 | + # Create the necessary directories and files |
24 | 28 | mkdir -p "$TMP_DIR/CDFTOOLS_DIR/bin" |
25 | 29 | mkdir -p "$TMP_DIR/MESH_MASK_DIR" |
| 30 | + mkdir -p "$TMP_DIR/OBS_PATH_DIR" |
26 | 31 | touch "$TMP_DIR/CDFTOOLS_DIR/bin/cdf_tool" |
27 | 32 | touch "$TMP_DIR/MESH_MASK_DIR/mesh_mask.nc" |
28 | 33 | touch "$TMP_DIR/MESH_MASK_DIR/bathy.nc" |
29 | 34 | touch "$TMP_DIR/nam_cdf_names" |
| 35 | + touch "$TMP_DIR/OBS_PATH_DIR/your_obs_abs_sal_file.nc" |
| 36 | + touch "$TMP_DIR/OBS_PATH_DIR/your_obs_con_tem_file.nc" |
30 | 37 | } |
31 | 38 |
|
32 | 39 | # Function to clean up the temporary environment after a test |
|
0 commit comments