Skip to content

Commit

Permalink
Make Fortran tests fail with a non-zero exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
eisenhauer committed Mar 18, 2024
1 parent 34093ee commit a2375f0
Show file tree
Hide file tree
Showing 23 changed files with 1,529 additions and 389 deletions.
35 changes: 28 additions & 7 deletions testing/adios2/bindings/fortran/TestAdios2BindingsFortranIO.F90
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ subroutine testing_adios_io_finalize()

! FIXME, shouldn't we be able to do this by handle?
call adios2_remove_io(result, adios, "TestIo", ierr)
if ((ierr /= 0) .or. (result .neqv. .true.)) stop "FAIL: adios2_remove_io"
if ((ierr /= 0) .or. (result .neqv. .true.)) then
write(*,*) "FAIL: adios2_remove_io"
stop 1
end if
call testing_adios_finalize()

end subroutine testing_adios_io_finalize
Expand Down Expand Up @@ -88,18 +91,27 @@ subroutine testing_adios_io_engine()
call adios2_set_engine(io, "file", ierr)

call adios2_io_engine_type(engine_type, io, ierr)
if (engine_type /= "file") stop "FAIL adios2_io_engine_type"
if (engine_type /= "file") then
write(*,*) "FAIL adios2_io_engine_type"
stop 1
end if
deallocate(engine_type)

call adios2_open(engine, io, "ftypes.bp", adios2_mode_write, ierr)

if (engine%type /= "BP5Writer") stop "FAIL engine%type"
if (engine%type /= "BP5Writer") then
write(*,*) "FAIL engine%type"
stop 1
end if
! // FIXME, I'd like to check that the engine type itself is correct, but
! // there's no (function-style) API to get it
! // FIXME, I'd like to check the engine's name, but there's no API to get it

call adios2_io_engine_type(engine_type, io, ierr)
if (engine_type /= "file") stop "FAIL adios2_io_engine_type"
if (engine_type /= "file") then
write(*,*) "FAIL adios2_io_engine_type"
stop 1
end if
deallocate(engine_type)

call testing_adios_io_finalize()
Expand All @@ -123,18 +135,27 @@ subroutine testing_adios_io_engine_default()
call adios2_set_engine(io, "", ierr)

call adios2_io_engine_type(engine_type, io, ierr)
if (engine_type /= "") stop "FAIL adios2_io_engine_type"
if (engine_type /= "") then
write(*,*) "FAIL adios2_io_engine_type"
stop 1
end if
deallocate(engine_type)

call adios2_open(engine, io, "ftypes.bp", adios2_mode_write, ierr)

if (engine%type /= "BP5Writer") stop "FAIL engine%type"
if (engine%type /= "BP5Writer") then
write(*,*) "FAIL engine%type"
stop 1
end if
! // FIXME, I'd like to check that the engine type itself is correct, but
! // there's no (function-style) API to get it
! // FIXME, I'd like to check the engine's name, but there's no API to get it

call adios2_io_engine_type(engine_type, io, ierr)
if (engine_type /= "") stop "FAIL adios2_io_engine_type"
if (engine_type /= "") then
write(*,*) "FAIL adios2_io_engine_type"
stop 1
end if
deallocate(engine_type)

call testing_adios_io_finalize
Expand Down
30 changes: 24 additions & 6 deletions testing/adios2/bindings/fortran/TestBPMemorySpace.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,26 @@ program TestBPMemorySpace
start_dims(1) = 0
count_dims(1) = 10

if( adios%valid .eqv. .true. ) stop 'Invalid adios default'
if( variable%valid .eqv. .true. ) stop 'Invalid variables default'
if( adios%valid .eqv. .true. ) then
write(*,*) 'Invalid adios default'
stop 1
end if
if( variable%valid .eqv. .true. ) then
write(*,*) 'Invalid variables default'
stop 1
end if

call adios2_init(adios, ierr)
if( adios%valid .eqv. .false. ) stop 'Invalid adios2_init'
if( adios%valid .eqv. .false. ) then
write(*,*) 'Invalid adios2_init'
stop 1
end if

call adios2_declare_io(ioWrite, adios, "ioWrite", ierr)
if( ioWrite%valid .eqv. .false. ) stop 'Invalid adios2_declare_io'
if( ioWrite%valid .eqv. .false. ) then
write(*,*) 'Invalid adios2_declare_io'
stop 1
end if

call adios2_set_engine(ioWrite, 'File', ierr)

Expand All @@ -31,11 +43,17 @@ program TestBPMemorySpace

! check that the default execution space is Detect
call adios2_get_memory_space(mem, variable, ierr)
if (mem /= adios2_memory_space_detect) stop 'Invalid adios2_memory_space'
if (mem /= adios2_memory_space_detect) then
write(*,*) 'Invalid adios2_memory_space'
stop 1
end if

! check that the execution space is updated to Host
call adios2_set_memory_space(variable, adios2_memory_space_host, ierr)
call adios2_get_memory_space(mem, variable, ierr)
if (mem /= adios2_memory_space_host) stop 'Invalid adios2_memory_space'
if (mem /= adios2_memory_space_host) then
write(*,*) 'Invalid adios2_memory_space'
stop 1
end if

end program TestBPMemorySpace
30 changes: 24 additions & 6 deletions testing/adios2/bindings/fortran/TestBPMemorySpaceGPU.F90
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,26 @@ program TestBPMemorySpace
start_dims(1) = 0
count_dims(1) = 10

if( adios%valid .eqv. .true. ) stop 'Invalid adios default'
if( variable%valid .eqv. .true. ) stop 'Invalid variables default'
if( adios%valid .eqv. .true. ) then
write(*,*) 'Invalid adios default'
stop 1
end if
if( variable%valid .eqv. .true. ) then
write(*,*) 'Invalid variables default'
stop 1
end if

call adios2_init(adios, ierr)
if( adios%valid .eqv. .false. ) stop 'Invalid adios2_init'
if( adios%valid .eqv. .false. ) then
write(*,*) 'Invalid adios2_init'
stop 1
end if

call adios2_declare_io(ioWrite, adios, "ioWrite", ierr)
if( ioWrite%valid .eqv. .false. ) stop 'Invalid adios2_declare_io'
if( ioWrite%valid .eqv. .false. ) then
write(*,*) 'Invalid adios2_declare_io'
stop 1
end if

call adios2_set_engine(ioWrite, 'File', ierr)

Expand All @@ -31,11 +43,17 @@ program TestBPMemorySpace

! check that the default execution space is Detect
call adios2_get_memory_space(mem, variable, ierr)
if (mem /= adios2_memory_space_detect) stop 'Invalid adios2_memory_space'
if (mem /= adios2_memory_space_detect) then
write(*,*) 'Invalid adios2_memory_space'
stop 1
end if

! check that the execution space is updated to GPU
call adios2_set_memory_space(variable, adios2_memory_space_gpu, ierr)
call adios2_get_memory_space(mem, variable, ierr)
if (mem /= adios2_memory_space_gpu) stop 'Invalid adios2_memory_space'
if (mem /= adios2_memory_space_gpu) then
write(*,*) 'Invalid adios2_memory_space'
stop 1
end if

end program TestBPMemorySpace
11 changes: 8 additions & 3 deletions testing/adios2/bindings/fortran/TestBPReadGlobalsByName.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ program TestBPReadGlobalsByName
call adios2_put(writer, "sml_outpsi", 0.295477_8, ierr)
call adios2_close(writer, ierr)

if(ierr /= 0) stop 'Problems writing'
if(ierr /= 0) then
write(*,*) 'Problems writing'
stop 1
end if
call MPI_Barrier(MPI_COMM_WORLD, ierr)

! reader
Expand All @@ -60,11 +63,13 @@ program TestBPReadGlobalsByName
print *, irank, 'sml_outpsi', sml_outpsi

if( diag_1d_nsp /= 1 ) then
stop 'diag_1d_nsp is not 1'
write(*,*) 'diag_1d_nsp is not 1'
stop 1
end if

if( sml_outpsi /= 0.295477_8 ) then
stop 'sml_outpsi is not 0.295477'
write(*,*) 'sml_outpsi is not 0.295477'
stop 1
end if

call MPI_Finalize(ierr)
Expand Down
Loading

0 comments on commit a2375f0

Please sign in to comment.