1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-08-24 22:21:43 +02:00

conditional HDF5 tests based on the trexio_has_backend function

This commit is contained in:
q-posev 2021-11-02 11:06:03 +01:00
parent 954ee4216c
commit e18dcd5c4a
2 changed files with 24 additions and 19 deletions

View File

@ -1,7 +1,4 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "trexio.h"
#include <assert.h>
#include <stdio.h>
@ -16,14 +13,16 @@ int main() {
/*============== Main test launcher ================*/
int rc;
#ifdef HAVE_HDF5
rc = system("rm -f test_all.h5");
bool have_hdf5 = trexio_has_backend(TREXIO_HDF5);
if(have_hdf5) {
rc = system("rm -f -- test_all.h5");
assert (rc == 0);
test_write("test_all.h5", TREXIO_HDF5);
test_read ("test_all.h5", TREXIO_HDF5);
rc = system("rm -f test_all.h5");
rc = system("rm -f -- test_all.h5");
assert (rc == 0);
#endif
}
rc = system("rm -rf test_all.dir");
assert (rc == 0);

View File

@ -1,7 +1,10 @@
program test_trexio
use trexio
use, intrinsic :: iso_c_binding
implicit none
logical :: have_hdf5
print * , "============================================"
print'(a,a)' , " TREXIO VERSION STRING : ", TREXIO_PACKAGE_VERSION
print'(a,i3)', " TREXIO MAJOR VERSION : ", TREXIO_VERSION_MAJOR
@ -19,14 +22,17 @@ program test_trexio
! No way to conditionally check whether compilation was done with HDF5
! So temporarily disable the test for HDF5 back end at the moment
! call system('rm -rf test_write_f.h5')
! print *, 'call test_write(''test_write_f.h5'', TREXIO_HDF5)'
! call test_write('test_write_f.h5', TREXIO_HDF5)
! print *, 'call test_read(''test_write_f.h5'', TREXIO_HDF5)'
! call test_read('test_write_f.h5', TREXIO_HDF5)
! call system('rm -rf test_write_f.h5')
!
! call test_read_void('test_write_f.h5', TREXIO_HDF5)
have_hdf5 = trexio_has_backend(TREXIO_HDF5)
if (have_hdf5) then
call system('rm -f -- test_write_f.h5')
print *, 'call test_write(''test_write_f.h5'', TREXIO_HDF5)'
call test_write('test_write_f.h5', TREXIO_HDF5)
print *, 'call test_read(''test_write_f.h5'', TREXIO_HDF5)'
call test_read('test_write_f.h5', TREXIO_HDF5)
call system('rm -f -- test_write_f.h5')
call test_read_void('test_write_f.h5', TREXIO_HDF5)
endif
end program test_trexio