Dear Matthew, dear Jacob,
Thank you very much for your useful remarks. I managed to use the PETSc Testing System by doing as follows:
1. Redefined TESTDIR when running make
2. Used a project tree similar to that of PETSc. For examples, tests for 'package1' are in $MYLIB/src/package1/tests/
3. cp $PETSC_DIR/gmakefile.test $MYLIB/gmakefile.test
Inside gmakefile.test:
4. Right AFTER "-include
petscdir.mk" added "-include
mylib.mk" to have $MYLIB exported (note: this affects TESTSRCDIR)
5. Redefined variable pkgs as "pkgs := package1"
6. Introduced a few variables to make PETSC_COMPILE.c work:
CFLAGS := -I$(MYLIB)/include
LDFLAGS = -L$(MYLIB)/lib
LDLIBS = -lmylib
7. Changed the call to gmakegentest.py as follows
$(PYTHON) $(CONFIGDIR)/gmakegentest.py --petsc-dir=$(PETSC_DIR) --petsc-arch=$(PETSC_ARCH) --testdir=$(TESTDIR) --srcdir=$(MYLIB)/src --pkg-pkgs=$(pkgs)
8. Changed the rule $(testexe.c) as follows:
$(call quiet,CLINKER) $(EXEFLAGS) $(LDFLAGS) -o $@ $^ $(PETSC_TEST_LIB) $(LDLIBS)
9. Added the option --srcdir=$(TESTSRCDIR) and set --petsc-dir=$(MYLIB) when calling query_tests.py, for example:
TESTTARGETS := $(shell $(PYTHON) $(CONFIGDIR)/query_tests.py --srcdir=$(TESTSRCDIR) --testdir=$(TESTDIR) --petsc-dir=$(MYLIB) --petsc-arch=$(PETSC_ARCH) --searchin=$(searchin) 'name' '$(search)')
What do you think?
Best,
Daniele