Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed to use run_and_check function (found in test_utils.bash) in #206

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 27 additions & 44 deletions t/Test01-check_programs_exist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,143 +22,126 @@
load test_utils

@test "Check make_hgrid exists and is executable" {
run command -v make_hgrid
[ "$status" -eq 0 ]
run_and_check -v make_hgrid
run make_hgrid -h
[ "$status" -eq 2 ]
}

@test "Check make_vgrid exists and is executable" {
run command -v make_vgrid
[ "$status" -eq 0 ]
run_and_check -v make_vgrid
run make_vgrid -h
[ "$status" -eq 1 ]
}

@test "Check make_solo_mosaic exists and is executable" {
run command -v make_solo_mosaic
[ "$status" -eq 0 ]
run_and_check -v make_solo_mosaic
run make_solo_mosaic -h
[ "$status" -eq 2 ]
}

@test "Check make_topog exists and is executable" {
run command -v make_topog
[ "$status" -eq 0 ]
run_and_check -v make_topog
run make_topog -h
[ "$status" -eq 1 ]
}
# only run with mpi
@test "Check make_topog_parallel exists and is executable" {
[ ! -z $skip_mpi ] && skip "not built with MPI"
run command -v make_topog_parallel
[ "$status" -eq 0 ]
run_and_check -v make_topog_parallel

}

@test "Check coupler_mosaic exists and is executable" {
run command -v make_coupler_mosaic
[ "$status" -eq 0 ]
run_and_check -v make_coupler_mosaic
run make_coupler_mosaic -h
[ "$status" -eq 2 ]
}

# only run with mpi
@test "Check coupler_mosaic_parallel exists and is executable" {
[ ! -z $skip_mpi ] && skip "not built with MPI"
run command -v make_coupler_mosaic_parallel
[ "$status" -eq 0 ]
run_and_check -v make_coupler_mosaic_parallel

}

@test "Check fregrid exists and is executable" {
run command -v fregrid
[ "$status" -eq 0 ]
run_and_check -v fregrid
run fregrid -h
[ "$status" -eq 2 ]
}

# only run with mpi
@test "Check fregrid_parallel exists and is executable" {
[ ! -z $skip_mpi ] && skip "not built with MPI"
run command -v fregrid_parallel
[ "$status" -eq 0 ]
run_and_check -v fregrid_parallel

}

@test "Check runoff_regrid exists and is executable" {
run command -v runoff_regrid
[ "$status" -eq 0 ]
run_and_check -v runoff_regrid
run runoff_regrid -h
[ "$status" -eq 2 ]
}

@test "Check river_regrid exists and is executable" {
run command -v river_regrid
[ "$status" -eq 0 ]
run_and_check -v river_regrid
run river_regrid -h
[ "$status" -eq 2 ]
}

@test "Check check_mask exists and is executable" {
run command -v check_mask
[ "$status" -eq 0 ]
run_and_check -v check_mask
run check_mask -h
[ "$status" -eq 2 ]
}

@test "Check remap_land exists and is executable" {
run command -v remap_land
[ "$status" -eq 0 ]
run_and_check -v remap_land
run remap_land -h
[ "$status" -eq 1 ]
}

# only run with mpi
@test "Check remap_land_parallel exists and is executable" {
[ ! -z $skip_mpi ] && skip "not built with MPI"
run command -v remap_land_parallel
[ "$status" -eq 0 ]
run_and_check -v remap_land_parallel

}

@test "Check make_regional_mosaic exists and is executable" {
run command -v make_regional_mosaic
[ "$status" -eq 0 ]
run_and_check -v make_regional_mosaic
run make_regional_mosaic -h
[ "$status" -eq 2 ]
}

@test "Check mppncscatter exists and is executable" {
run command -v mppncscatter
[ "$status" -eq 0 ]
run_and_check -v mppncscatter
}

@test "Check mppnccombine exists and is executable" {
run command -v mppnccombine
[ "$status" -eq 0 ]
run_and_check -v mppnccombine
run mppnccombine -h
[ "$status" -eq 1 ]
}

@test "Check combine-ncc exists and is executable" {
run command -v combine-ncc
[ "$status" -eq 0 ]
run_and_check -v combine-ncc
}

@test "Check decompress-ncc exists and is executable" {
run command -v decompress-ncc
[ "$status" -eq 0 ]
run_and_check -v decompress-ncc
}

@test "Check cr_lake_files exists and is executable" {
run command -v cr_lake_files
[ "$status" -eq 0 ]
run_and_check -v cr_lake_files

}

@test "Check cp_river_vars exists and is executable" {
run command -v cp_river_vars
[ "$status" -eq 0 ]
run_and_check -v cp_river_vars
}

@test "Check rmv_parallel_rivers exists and is executable" {
run command -v rmv_parallel_rivers
[ "$status" -eq 0 ]
run_and_check -v rmv_parallel_rivers
}

2 changes: 1 addition & 1 deletion t/Test02-mppnccombine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ load test_utils
mppnccombine \
mppnccombine_output.nc \
mppnccombine.nc.????
[ -e mppnccombine_output.nc ]
run_and_check [ -e mppnccombine_output.nc ]
ncdump -h mppnccombine_output.nc
}
5 changes: 3 additions & 2 deletions t/Test03-grid_coupled_model.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ load test_utils
--vgrid ocean_vgrid.nc \
--output topog_parallel.nc

nccmp -md topog.nc topog_parallel.nc
run_and_check nccmp -md topog.nc topog_parallel.nc
fi


Expand Down Expand Up @@ -113,8 +113,9 @@ load test_utils
--ocean_topog ../topog.nc \
--mosaic_name grid_spec \
--area_ratio_thresh 1.e-10

# compare any created files to non-parallel (exclude directory differences)
nccmp -md --exclude=atm_mosaic_dir --exclude=lnd_mosaic_dir --exclude=ocn_mosaic_dir \
run_and_check nccmp -md --exclude=atm_mosaic_dir --exclude=lnd_mosaic_dir --exclude=ocn_mosaic_dir \
--exclude=ocn_topog_dir grid_spec.nc ../grid_spec.nc
fi
}
2 changes: 1 addition & 1 deletion t/Test04-grid_coupled_nest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ ncgen -o OCCAM_p5degree.nc $BATS_TEST_DIRNAME/Test03-input/OCCAM_p5degree.ncl
--land_mosaic ../land_mosaic.nc --ocean_mosaic ../ocean_mosaic.nc \
--ocean_topog ../topog.nc --interp_order 1 --mosaic_name grid_spec
# directory paths should differ
nccmp -md --exclude=atm_mosaic_dir --exclude=lnd_mosaic_dir --exclude=ocn_mosaic_dir \
run_and_check nccmp -md --exclude=atm_mosaic_dir --exclude=lnd_mosaic_dir --exclude=ocn_mosaic_dir \
--exclude=ocn_topog_dir grid_spec.nc ../grid_spec.nc
fi
}
2 changes: 1 addition & 1 deletion t/Test12-mppnscatter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ prepare_input_data ()
mppnccombine -64 output/$test_file ${test_file}.????

# Compare output
nccmp -w format -md output/$test_file input/$test_file
run_and_check nccmp -w format -md output/$test_file input/$test_file

}
2 changes: 1 addition & 1 deletion t/Test15-regrid_land.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ load test_utils
--output_file out_parallel.nc \
--remap_file remap_file.nc

nccmp -md out.nc out_parallel.nc
run_and_check nccmp -md out.nc out_parallel.nc
fi

# remap other fields
Expand Down
4 changes: 2 additions & 2 deletions t/Test17-combine-ncc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ load test_utils
combine-ncc \
combine-ncc.atmos_daily.nc.copy \
combine-ncc_output.nc
[ -e combine-ncc_output.nc ]
ncdump -h combine-ncc_output.nc
run_and_check [ -e combine-ncc_output.nc ]
run_and_check ncdump -h combine-ncc_output.nc

}
4 changes: 2 additions & 2 deletions t/Test18-decompress-ncc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ load test_utils
decompress-ncc \
decompress-ncc.atmos_daily.nc.copy \
decompress-ncc_output.nc
[ -e decompress-ncc_output.nc ]
ncdump -h decompress-ncc_output.nc
run_and_check [ -e decompress-ncc_output.nc ]
run_and_check ncdump -h decompress-ncc_output.nc
}
6 changes: 3 additions & 3 deletions t/Test21-reference_mppnccombine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ load test_utils
mppnccombine \
mppnccombine_output.nc \
mppnccombine.nc.????
[ -e mppnccombine_output.nc ]
run_and_check [ -e mppnccombine_output.nc ]
ncdump -h mppnccombine_output.nc

[ -e $top_srcdir/t/Test02-reference/mppnccombine_output.nc ]
run_and_check [ -e $top_srcdir/t/Test02-reference/mppnccombine_output.nc ]

nccmp -V

nccmp -d mppnccombine_output.nc $top_srcdir/t/Test02-reference/mppnccombine_output.nc
run_and_check nccmp -d mppnccombine_output.nc $top_srcdir/t/Test02-reference/mppnccombine_output.nc
}
8 changes: 4 additions & 4 deletions t/Test22-reference_combine-ncc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ load test_utils
combine-ncc \
combine-ncc.atmos_daily.nc.copy \
combine-ncc_output.nc
[ -e combine-ncc_output.nc ]
run_and_check [ -e combine-ncc_output.nc ]
ncdump -h combine-ncc_output.nc

[ -e $top_srcdir/t/Test17-reference/combine-ncc_output.nc ]
run_and_check [ -e $top_srcdir/t/Test17-reference/combine-ncc_output.nc ]

nccmp -V
run_and_check nccmp -V

nccmp -d combine-ncc_output.nc $top_srcdir/t/Test17-reference/combine-ncc_output.nc
run_and_check nccmp -d combine-ncc_output.nc $top_srcdir/t/Test17-reference/combine-ncc_output.nc
}
8 changes: 4 additions & 4 deletions t/Test23-reference_decompress-ncc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ load test_utils
decompress-ncc \
decompress-ncc.atmos_daily.nc.copy \
decompress-ncc_output.nc
[ -e decompress-ncc_output.nc ]
run_and_check [ -e decompress-ncc_output.nc ]
ncdump -h decompress-ncc_output.nc

[ -e $top_srcdir/t/Test18-reference/decompress-ncc_output.nc ]
run_and_check [ -e $top_srcdir/t/Test18-reference/decompress-ncc_output.nc ]

nccmp -V
run_and_check nccmp -V

nccmp -d decompress-ncc_output.nc $top_srcdir/t/Test18-reference/decompress-ncc_output.nc
run_and_check nccmp -d decompress-ncc_output.nc $top_srcdir/t/Test18-reference/decompress-ncc_output.nc
}
14 changes: 7 additions & 7 deletions t/Test24-reference_fregrid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ load test_utils
--output_mosaic latlon_mosaic.nc \
--check_conserve

[ -e ocean_temp_salt.res.latlon.nc ]
[ -e $top_srcdir/t/Test20-reference/ocean_temp_salt.res.latlon.nc ]
run_and_check [ -e ocean_temp_salt.res.latlon.nc ]
run_and_check [ -e $top_srcdir/t/Test20-reference/ocean_temp_salt.res.latlon.nc ]

nccmp -V
run_and_check nccmp -V

nccmp -d ocean_temp_salt.res.latlon.nc $top_srcdir/t/Test20-reference/ocean_temp_salt.res.latlon.nc
run_and_check nccmp -d ocean_temp_salt.res.latlon.nc $top_srcdir/t/Test20-reference/ocean_temp_salt.res.latlon.nc

[ -e latlon_mosaic.nc ]
[ -e $top_srcdir/t/Test20-reference/latlon_mosaic.nc ]
run_and_check [ -e latlon_mosaic.nc ]
run_and_check [ -e $top_srcdir/t/Test20-reference/latlon_mosaic.nc ]

nccmp -d latlon_mosaic.nc $top_srcdir/t/Test20-reference/latlon_mosaic.nc
run_and_check nccmp -d latlon_mosaic.nc $top_srcdir/t/Test20-reference/latlon_mosaic.nc
}
2 changes: 1 addition & 1 deletion t/Test25-hydrology.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ load test_utils

#Run wrapper hydrology script
run $top_srcdir/tools/simple_hydrog/share/make_simple_hydrog.csh -f 0. -t 1.e-5 -m $top_srcdir/t/Test25-input/grid_spec.nc
[ "$status" -eq 0 ]
run_and_check [ "$status" -eq 0 ]

}
14 changes: 7 additions & 7 deletions t/Test26-reference_fregrid_gcc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ load test_utils
--output_mosaic latlon_mosaic.nc \
--check_conserve

[ -e ocean_temp_salt.res.latlon.nc ]
[ -e $top_srcdir/t/Test20-reference/ocean_temp_salt.res.latlon.nc ]
run_and_check [ -e ocean_temp_salt.res.latlon.nc ]
run_and_check [ -e $top_srcdir/t/Test20-reference/ocean_temp_salt.res.latlon.nc ]

nccmp -V
run_and_check nccmp -V

# checks values with float tolerance to bypass any result differences from compilers
nccmp -d -t 0.000001 ocean_temp_salt.res.latlon.nc $top_srcdir/t/Test20-reference/ocean_temp_salt.res.latlon.nc
run_and_check nccmp -d -t 0.000001 ocean_temp_salt.res.latlon.nc $top_srcdir/t/Test20-reference/ocean_temp_salt.res.latlon.nc

[ -e latlon_mosaic.nc ]
[ -e $top_srcdir/t/Test20-reference/latlon_mosaic.nc ]
run_and_check [ -e latlon_mosaic.nc ]
run_and_check [ -e $top_srcdir/t/Test20-reference/latlon_mosaic.nc ]

nccmp -d latlon_mosaic.nc $top_srcdir/t/Test20-reference/latlon_mosaic.nc
run_and_check nccmp -d latlon_mosaic.nc $top_srcdir/t/Test20-reference/latlon_mosaic.nc
}
Loading