Skip to content

Commit

Permalink
fix the test_read_input_nml2 so that it can work with cray
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenchilutti committed Jul 26, 2023
1 parent 2be8aa4 commit 6180ea9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions test_fms/mpp/test_read_input_nml.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ program test_read_input_nml
integer :: n, m !< Loop counting variable
integer :: current_pelist_name_len_plus1 !< Current pelist name length plus 1
integer :: ierr !< used by MPI_FINALIZE
integer :: nml_unit_var !< stores nml file unit number for reads
character(len=:), allocatable :: toobig !< String passed as argument into read_input_nml that is
!!larger than pelis_name and should raise an error

namelist /test_read_input_nml_nml/ test_numb

open(10, file="test_numb.nml", form="formatted", status="old")
read(10, nml = test_read_input_nml_nml)
close(10)
open(newunit=nml_unit_var, file="test_numb.nml", form="formatted", status="old")
read(unit=nml_unit_var, nml = test_read_input_nml_nml)
close(nml_unit_var)

call mpp_init(test_level=mpp_init_test_peset_allocated)

Expand All @@ -64,11 +65,11 @@ program test_read_input_nml
filename = "input_alternative.nml"
call read_input_nml("alternative")
end if
open(1, file=filename, iostat=stat) ! Open input nml or alternative
open(newunit=nml_unit_var, file=filename, iostat=stat) ! Open input nml or alternative
n = 1
do
read(1, '(A)', iostat=stat) line
if (stat.eq.-1) then
read(unit=nml_unit_var, '(A)', iostat=stat) line
if (stat < 0) then
exit
end if
if (input_nml_file(n).ne.line) then
Expand All @@ -77,7 +78,7 @@ program test_read_input_nml
end if
n = n + 1
end do
close(1)
close(nml_unit_var)

else if (test_numb.eq.3) then
! Test 3: Tests with an invalid pelist_name_in pass as an argument. An invalid
Expand Down
4 changes: 2 additions & 2 deletions test_fms/mpp/test_read_input_nml2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
# create and enter directory for in/output
output_dir

touch input.nml
touch test_numb_base.nml
echo "&test_read_input_nml_nml" > test_numb_base.nml
echo "test_numb = 0" >> test_numb_base.nml
echo "/" >> test_numb_base.nml
cp test_numb_base.nml input.nml

# Test 1
sed "s/test_numb = [0-9]/test_numb = 1/" test_numb_base.nml > test_numb.nml
Expand All @@ -45,7 +45,7 @@ test_expect_success "read input nml" '

# Test 2
sed "s/test_numb = [0-9]/test_numb = 2/" test_numb_base.nml > test_numb.nml
sed "s/1/2/" $top_srcdir/test_fms/mpp/input_base.nml > input_alternative.nml
cp input.nml input_alternative.nml
test_expect_success "read input nml with file name" '
mpirun -n 1 ../test_read_input_nml
'
Expand Down

0 comments on commit 6180ea9

Please sign in to comment.