1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-07-22 10:47:45 +02:00

Make test

This commit is contained in:
Anthony Scemama 2020-10-17 00:28:49 +02:00
parent 456c6fc100
commit 722d6dd540
7 changed files with 32 additions and 3 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "munit"]
path = munit
url = https://github.com/nemequ/munit/

View File

@ -13,6 +13,13 @@ See the [source code](https://github.com/TREX-CoE/qmckl/tree/main/src)
to read the documentation. to read the documentation.
To clone the repository, use:
```
git clone --recursive https://github.com/TREX-CoE/qmckl.git
```
to dowload also the [munit](https://github.com/nemequ/munit) unit testing
framework.
------------------------------ ------------------------------

1
munit Submodule

@ -0,0 +1 @@
Subproject commit fbbdf1467eb0d04a6ee465def2e529e4c87f2118

View File

@ -16,6 +16,9 @@ OBJECT_FILES=$(filter-out $(EXCLUDED_OBJECTS), $(patsubst %.org,%.o,$(ORG_SOURCE
libqmckl.so: Makefile.generated libqmckl.so: Makefile.generated
$(MAKE) -f Makefile.generated $(MAKE) -f Makefile.generated
test: Makefile.generated
$(MAKE) -f Makefile.generated test
clean: clean:
rm -f qmckl.h test_qmckl_*.c test_qmckl_*.f90 qmckl_*.f90 qmckl_*.c qmckl_*.o qmckl_*.h Makefile.generated libqmckl.so rm -f qmckl.h test_qmckl_*.c test_qmckl_*.f90 qmckl_*.f90 qmckl_*.c qmckl_*.o qmckl_*.h Makefile.generated libqmckl.so

View File

@ -35,6 +35,12 @@ for i in $(ls qmckl_*.f90) ; do
OBJECTS="${OBJECTS} ${FILE}.o" OBJECTS="${OBJECTS} ${FILE}.o"
done >> $OUTPUT done >> $OUTPUT
TESTS=""
for i in $(ls test_*.c) ; do
FILE=${i%.c}
TESTS="${TESTS} ${FILE}"
done >> $OUTPUT
# Write the Makefile # Write the Makefile
@ -45,6 +51,7 @@ CFLAGS=$CFLAGS
FC=$FC FC=$FC
FFLAGS=$FFLAGS FFLAGS=$FFLAGS
OBJECT_FILES=$OBJECTS OBJECT_FILES=$OBJECTS
TESTS=$TESTS
libqmckl.so: \$(OBJECT_FILES) libqmckl.so: \$(OBJECT_FILES)
\$(CC) -shared \$(OBJECT_FILES) -o libqmckl.so \$(CC) -shared \$(OBJECT_FILES) -o libqmckl.so
@ -55,6 +62,13 @@ libqmckl.so: \$(OBJECT_FILES)
%.o: %.f90 %.o: %.f90
\$(FC) \$(FFLAGS) -c \$*.f90 -o \$*.o \$(FC) \$(FFLAGS) -c \$*.f90 -o \$*.o
test_%: test_%.c
\$(CC) \$(CFLAGS) -Wl,-rpath,$PWD -L. \
-I../munit/ ../munit/munit.c test_\$*.c -lqmckl -o test_\$*
test: libqmckl.so \$(TESTS)
.PHONY: test
EOF EOF
for i in $(ls qmckl_*.c) ; do for i in $(ls qmckl_*.c) ; do
@ -67,3 +81,4 @@ for i in $(ls qmckl_*.f90) ; do
echo "${FILE}.o: ${FILE}.f90" echo "${FILE}.o: ${FILE}.f90"
done >> $OUTPUT done >> $OUTPUT

View File

@ -441,7 +441,7 @@ int qmckl_context_get_range(const qmckl_context context) {
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_context.c #+BEGIN_SRC C :tangle test_qmckl_context.c
return QMCKL_SUCCESS; return rc;
} }
#+END_SRC #+END_SRC

View File

@ -89,6 +89,6 @@ void qmckl_free(void *ptr) {
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_memory.c #+BEGIN_SRC C :tangle test_qmckl_memory.c
return QMCKL_SUCCESS; return rc;
} }
#+END_SRC #+END_SRC