Skip to content

Commit

Permalink
test: Adds check_nml_error after reading a namelist, so it could cras…
Browse files Browse the repository at this point in the history
…h only as expected (NOAA-GFDL#904)
  • Loading branch information
uramirez8707 authored Feb 10, 2022
1 parent d652777 commit b6b9554
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions test_fms/fms2_io/test_atmosphere_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ program test_atmosphere_io
use mpp_mod
use setup
use platform_mod

use fms_mod, only : check_nml_error

type(Params) :: test_params
type(domain2d) :: domain
Expand Down Expand Up @@ -86,6 +86,9 @@ program test_atmosphere_io
logical :: ignore_checksum = .false.
logical :: bad_checksum = .false.

integer :: io !< Error code when reading namelist
integer :: ierr !< Error code when reading namelist

namelist /test_atmosphere_io_nml/ bad_checksum, ignore_checksum

!Initialize.
Expand All @@ -97,7 +100,8 @@ program test_atmosphere_io
call random_seed()
call fms2_io_init()

read(input_nml_file, nml=test_atmosphere_io_nml)
read(input_nml_file, nml=test_atmosphere_io_nml, iostat=io)
ierr = check_nml_error(io, 'test_atmosphere_io_nml')

if (test_params%debug) then
if (mpp_pe() .eq. 0) then
Expand Down
6 changes: 5 additions & 1 deletion test_fms/fms2_io/test_bc_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
program test_bc_restart

use mpp_mod, only : mpp_init, mpp_exit, mpp_pe, mpp_root_pe, mpp_sync, input_nml_file
use fms_mod, only : check_nml_error
use fms2_io_mod, only : FmsNetcdfFile_t, fms2_io_init, open_file, register_restart_field, &
register_variable_attribute, read_restart_bc, write_restart_bc, close_file
use mpp_domains_mod, only : mpp_get_global_domain, mpp_get_data_domain, mpp_get_compute_domain, &
Expand All @@ -41,6 +42,8 @@ program test_bc_restart
real, allocatable, dimension(:,:,:):: var3d !< 3d variable data
end type

integer :: io !< Error code when reading namelist
integer :: ierr !< Error code when reading namelist
integer, dimension(2) :: layout = (/4,4/) !< Domain layout
integer :: nlon !< Number of points in x axis
integer :: nlat !< Number of points in y axis
Expand All @@ -58,7 +61,8 @@ program test_bc_restart
call mpp_init
call fms2_io_init

read(input_nml_file, nml=test_bc_restart_nml)
read(input_nml_file, nml=test_bc_restart_nml, iostat=io)
ierr = check_nml_error(io, 'test_bc_restart_nml')

nlon = 144
nlat = 144
Expand Down

0 comments on commit b6b9554

Please sign in to comment.