Skip to content

Commit

Permalink
now MPI_abort does not overwrite ret_val
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 7, 2016
1 parent 611b76d commit 5651c78
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions tests/unit/basic_tests.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Subroutine test_create(test_id, err_msg)

! Local Vars
character(len=str_len) :: filename
integer :: iotype, ret_val, pio_dim
integer :: iotype, ret_val, ret_val2, pio_dim

err_msg = "no_error"

Expand All @@ -51,7 +51,7 @@ Subroutine test_create(test_id, err_msg)
! Error in PIO_createfile
print *,' ret_val = ', ret_val
err_msg = "Could not create " // trim(filename)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

call mpi_barrier(mpi_comm_world,ret_val)
Expand All @@ -62,7 +62,7 @@ Subroutine test_create(test_id, err_msg)
! Error in PIO_enddef
err_msg = "Could not end define mode"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if
end if
call PIO_closefile(pio_file)
Expand All @@ -73,7 +73,7 @@ Subroutine test_create(test_id, err_msg)
if (ret_val .ne. PIO_NOERR) then
! Error in PIO_openfile
err_msg = "Could not open " // trim(filename)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Close file
Expand All @@ -85,7 +85,7 @@ Subroutine test_create(test_id, err_msg)
if (ret_val .ne. PIO_NOERR) then
! Error in PIO_createfile
err_msg = "Could not clobber " // trim(filename)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Leave define mode
Expand All @@ -94,7 +94,7 @@ Subroutine test_create(test_id, err_msg)
! Error in PIO_enddef
err_msg = "Could not end define mode in clobbered file"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Close file
Expand All @@ -113,7 +113,7 @@ Subroutine test_create(test_id, err_msg)
err_msg = "Was able to clobber file despite PIO_NOCLOBBER"
ret_val = PIO_enddef(pio_file)
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if
end if

Expand All @@ -137,7 +137,7 @@ Subroutine test_open(test_id, err_msg)

! Local Vars
character(len=str_len) :: filename
integer :: iotype, ret_val
integer :: iotype, ret_val, ret_val2

! Data used to test writing
integer, dimension(3) :: data_buffer, compdof
Expand Down Expand Up @@ -172,7 +172,7 @@ Subroutine test_open(test_id, err_msg)
! Error in PIO_openfile
err_msg = "Successfully opened file that doesn't exist"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Open existing file, write data to it (for binary file, need to create new file)
Expand All @@ -184,7 +184,7 @@ Subroutine test_open(test_id, err_msg)
if (ret_val .ne. PIO_NOERR) then
! Error in PIO_openfile (or PIO_createfile)
err_msg = "Could not open " // trim(filename) // " in write mode"
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Enter define mode for netcdf files
Expand All @@ -194,7 +194,7 @@ Subroutine test_open(test_id, err_msg)
! Error in PIO_redef
err_msg = "Could not enter redef mode"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Define a new dimension N
Expand All @@ -203,7 +203,7 @@ Subroutine test_open(test_id, err_msg)
! Error in PIO_def_dim
err_msg = "Could not define dimension N"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Define a new variable foo
Expand All @@ -213,7 +213,7 @@ Subroutine test_open(test_id, err_msg)
! Error in PIO_def_var
err_msg = "Could not define variable foo"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Leave define mode
Expand All @@ -223,7 +223,7 @@ Subroutine test_open(test_id, err_msg)
print *,__FILE__,__LINE__,ret_val
err_msg = "Could not end define mode"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if
end if

Expand All @@ -235,7 +235,7 @@ Subroutine test_open(test_id, err_msg)
! Error in PIO_write_darray
err_msg = "Could not write data"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Close file
Expand All @@ -248,7 +248,7 @@ Subroutine test_open(test_id, err_msg)
if (ret_val .ne. PIO_NOERR) then
! Error opening file
err_msg = "Could not open file in NoWrite mode"
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

! Try to write (should fail)
Expand All @@ -260,7 +260,7 @@ Subroutine test_open(test_id, err_msg)
! Error in PIO_write_darray
err_msg = "Wrote to file opened in NoWrite mode"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

call mpi_barrier(MPI_COMM_WORLD,ret_val)
Expand All @@ -273,13 +273,13 @@ Subroutine test_open(test_id, err_msg)
err_msg = "Error in read_darray"
call PIO_closefile(pio_file)
print *,__FILE__,__LINE__,err_msg
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if
if(any(data_buffer /= my_rank)) then
err_msg = "Error reading data"
call PIO_closefile(pio_file)
print *,__FILE__,__LINE__,iotype, trim(err_msg), data_buffer
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if

ret_val = PIO_set_log_level(3)
Expand All @@ -288,7 +288,7 @@ Subroutine test_open(test_id, err_msg)
err_msg = "Error in inq_unlimdim"
call PIO_closefile(pio_file)
print *,__FILE__,__LINE__,iotype, trim(err_msg)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if
ret_val = PIO_set_log_level(0)

Expand All @@ -309,7 +309,7 @@ Subroutine test_open(test_id, err_msg)
! Error in PIO_openfile
err_msg = "Opened a non-netcdf file as netcdf"
call PIO_closefile(pio_file)
call mpi_abort(MPI_COMM_WORLD,0,ret_val)
call mpi_abort(MPI_COMM_WORLD, 0, ret_val2)
end if
end if

Expand Down

0 comments on commit 5651c78

Please sign in to comment.