1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-10-02 14:31:05 +02:00

better make for tests

This commit is contained in:
q-posev 2021-03-25 11:42:13 +01:00
parent aa160d9bea
commit ebb5ff62d3
2 changed files with 16 additions and 8 deletions

View File

@ -34,6 +34,7 @@ FFLAGS=fPIC -g -O2
LIBS=-lm
endif
RM=rm -f
OBJECT_FILES= trexio.o trexio_text.o trexio_hdf5.o
HEADER_FILES= trexio.h trexio_text.h trexio_hdf5.h trexio_s.h
@ -48,14 +49,21 @@ libtrexio.so: $(OBJECT_FILES) $(HEADER_FILES)
fortran: libtrexio.so trexio_f.f90
$(FC) $(FFLAGS) -c trexio_f.f90 -o trexio_f.o
test: libtrexio.so test.c test.f90 trexio_f.o
rm -f -r test_text_fort/
$(CC) $(CFLAGS) $(INCLUDE) -Wl,-rpath,$(PWD) -L. test.c -ltrexio $(LIBS) -o test
test_c: libtrexio.so test.c
$(CC) $(CFLAGS) $(INCLUDE) -Wl,-rpath,$(PWD) -L. test.c -ltrexio $(LIBS) -o test_c
test_f: libtrexio.so test.f90 trexio_f.o
$(CC) $(CFLAGS) $(INCLUDE) -Wl,-rpath,$(PWD) -L. test.f90 trexio_f.o -ltrexio $(LIBS) -o test_f
test: test_c test_f
$(RM) -r trexio_test
$(RM) -r trexio_test_fort
./test_c
./test_f
clean:
rm -f *.o libtrexio.so test test_*.h5 test_f
rm -r test_text_fort/
$(RM) *.o libtrexio.so test_*.h5 test_f test_c
$(RM) -r trexio_test/ trexio_test_fort/
%.o: %.c $(HEADER_FILES)
$(CC) $(CFLAGS) $(INCLUDE) -c $*.c -o $*.o

View File

@ -34,7 +34,7 @@ subroutine test_write()
2.14171677 , 1.23652075 , 0.00000000 , &
0.00000000 , 2.47304151 , 0.00000000 /)
! trex_file = trexio_open('test_text_fort', 'w', TREXIO_TEXT)
! trex_file = trexio_open('trexio_test_fort', 'w', TREXIO_TEXT)
trex_file = trexio_open('test_hdf5_fort.h5', 'w', TREXIO_HDF5)
rc = trexio_write_nucleus_num(trex_file, num)
@ -55,7 +55,7 @@ subroutine test_write()
! hdf5 backend -> open with 'a'
! ---------------------------------- !
!! trex_file = trexio_open('test_text_fort', 'w', TREXIO_TEXT);
!! trex_file = trexio_open('trexio_test_fort', 'w', TREXIO_TEXT);
!! trex_file = trexio_open('test_hdf5_fort.h5', 'a', TREXIO_HDF5)
! coord(1) = 666.666
@ -84,7 +84,7 @@ subroutine test_read()
num = 12
! trex_file = trexio_open('test_text_fort', 'r', TREXIO_TEXT)
! trex_file = trexio_open('trexio_test_fort', 'r', TREXIO_TEXT)
trex_file = trexio_open('test_hdf5_fort.h5', 'r', TREXIO_HDF5)
rc = trexio_read_nucleus_num(trex_file, num_read)