1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-06-14 01:05:41 +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,9 +13,16 @@ See the [source code](https://github.com/TREX-CoE/qmckl/tree/main/src)
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.
------------------------------
![European flag](https://trex-coe.eu/sites/default/files/inline-images/euflag.jpg)
[TREX: Targeting Real Chemical Accuracy at the Exascale](https://trex-coe.eu) project has received funding from the European Unions Horizon 2020 - Research and Innovation program - under grant agreement no. 952165. The content of this document does not represent the opinion of the European Union, and the European Union is not responsible for any use that might be made of such content.

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
$(MAKE) -f Makefile.generated
test: Makefile.generated
$(MAKE) -f Makefile.generated test
clean:
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"
done >> $OUTPUT
TESTS=""
for i in $(ls test_*.c) ; do
FILE=${i%.c}
TESTS="${TESTS} ${FILE}"
done >> $OUTPUT
# Write the Makefile
@ -45,6 +51,7 @@ CFLAGS=$CFLAGS
FC=$FC
FFLAGS=$FFLAGS
OBJECT_FILES=$OBJECTS
TESTS=$TESTS
libqmckl.so: \$(OBJECT_FILES)
\$(CC) -shared \$(OBJECT_FILES) -o libqmckl.so
@ -55,6 +62,13 @@ libqmckl.so: \$(OBJECT_FILES)
%.o: %.f90
\$(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
for i in $(ls qmckl_*.c) ; do
@ -67,3 +81,4 @@ for i in $(ls qmckl_*.f90) ; do
echo "${FILE}.o: ${FILE}.f90"
done >> $OUTPUT

View File

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

View File

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