From c24484b86a4d6c035ee89388814e7ea7c874b062 Mon Sep 17 00:00:00 2001 From: q-posev Date: Mon, 1 Nov 2021 11:57:03 +0100 Subject: [PATCH] adapt tests to optional HDF5 --- tests/io_all.c | 10 ++++++++-- tests/test_f.f90 | 18 ++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/tests/io_all.c b/tests/io_all.c index 81179cf..f99a4e6 100644 --- a/tests/io_all.c +++ b/tests/io_all.c @@ -1,3 +1,7 @@ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif #include "trexio.h" #include #include @@ -12,12 +16,14 @@ int main() { /*============== Main test launcher ================*/ int rc; - rc = system("rm -rf test_all.h5"); +#ifdef 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 -rf test_all.h5"); + rc = system("rm -f test_all.h5"); assert (rc == 0); +#endif rc = system("rm -rf test_all.dir"); assert (rc == 0); diff --git a/tests/test_f.f90 b/tests/test_f.f90 index 7f1e945..fe36f43 100644 --- a/tests/test_f.f90 +++ b/tests/test_f.f90 @@ -17,14 +17,16 @@ program test_trexio call test_read_void('test_write_f.dir', TREXIO_TEXT) - 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) + ! 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) end program test_trexio