<div dir="ltr">Will do, thanks! <br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 28, 2023 at 7:28 PM Jed Brown <<a href="mailto:jed@jedbrown.org">jed@jedbrown.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Great that you got it working. We would accept a merge request that made our infrastructure less PETSc-specific so long as it doesn't push more complexity on the end user. That would likely make it easier for you to pull updates in the future. <br>
<br>
Daniele Prada <<a href="mailto:daniele.prada85@gmail.com" target="_blank">daniele.prada85@gmail.com</a>> writes:<br>
<br>
> Dear Matthew, dear Jacob,<br>
><br>
> Thank you very much for your useful remarks. I managed to use the PETSc<br>
> Testing System by doing as follows:<br>
><br>
> 1. Redefined TESTDIR when running make<br>
> 2. Used a project tree similar to that of PETSc. For examples, tests for<br>
> 'package1' are in $MYLIB/src/package1/tests/<br>
> 3. cp $PETSC_DIR/gmakefile.test $MYLIB/gmakefile.test<br>
><br>
> Inside gmakefile.test:<br>
><br>
> 4. Right AFTER "-include <a href="http://petscdir.mk" rel="noreferrer" target="_blank">petscdir.mk</a>" added "-include <a href="http://mylib.mk" rel="noreferrer" target="_blank">mylib.mk</a>" to have<br>
> $MYLIB exported (note: this affects TESTSRCDIR)<br>
> 5. Redefined variable pkgs as "pkgs := package1"<br>
> 6. Introduced a few variables to make PETSC_COMPILE.c work:<br>
><br>
> CFLAGS := -I$(MYLIB)/include<br>
> LDFLAGS = -L$(MYLIB)/lib<br>
> LDLIBS = -lmylib<br>
><br>
> 7. Changed the call to gmakegentest.py as follows<br>
><br>
> $(PYTHON) $(CONFIGDIR)/gmakegentest.py --petsc-dir=$(PETSC_DIR)<br>
> --petsc-arch=$(PETSC_ARCH) --testdir=$(TESTDIR) --srcdir=$(MYLIB)/src<br>
> --pkg-pkgs=$(pkgs)<br>
><br>
> 8. Changed the rule $(testexe.c) as follows:<br>
><br>
> $(call quiet,CLINKER) $(EXEFLAGS) $(LDFLAGS) -o $@ $^ $(PETSC_TEST_LIB)<br>
> $(LDLIBS)<br>
><br>
> 9. Added the option --srcdir=$(TESTSRCDIR) and set --petsc-dir=$(MYLIB)<br>
> when calling query_tests.py, for example:<br>
><br>
> TESTTARGETS := $(shell $(PYTHON) $(CONFIGDIR)/query_tests.py<br>
> --srcdir=$(TESTSRCDIR) --testdir=$(TESTDIR) --petsc-dir=$(MYLIB)<br>
> --petsc-arch=$(PETSC_ARCH) --searchin=$(searchin) 'name' '$(search)')<br>
><br>
><br>
><br>
> What do you think?<br>
><br>
> Best,<br>
> Daniele<br>
><br>
> On Mon, Mar 27, 2023 at 4:38 PM Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:<br>
><br>
>> On Mon, Mar 27, 2023 at 10:19 AM Jacob Faibussowitsch <<a href="mailto:jacob.fai@gmail.com" target="_blank">jacob.fai@gmail.com</a>><br>
>> wrote:<br>
>><br>
>>> Our testing framework was pretty much tailor-made for the PETSc src tree<br>
>>> and as such has many hard-coded paths and decisions. I’m going to go out on<br>
>>> a limb and say you probably won’t get this to work...<br>
>>><br>
>><br>
>> I think we can help you get this to work. I have wanted to generalize the<br>
>> test framework for a long time. Everything is build by<br>
>><br>
>>   confg/gmakegentest.py<br>
>><br>
>> and I think we can get away with just changing paths here and everything<br>
>> will work.<br>
>><br>
>>   Thanks!<br>
>><br>
>>      Matt<br>
>><br>
>><br>
>>> That being said, one of the “base” paths that the testing harness uses to<br>
>>> initially find tests is the `TESTSRCDIR` variable in<br>
>>> `${PETSC_DIR}/gmakefile.test`. It is currently defined as<br>
>>> ```<br>
>>> # TESTSRCDIR is always relative to gmakefile.test<br>
>>> #  This must be before includes<br>
>>> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))<br>
>>> TESTSRCDIR := $(dir $(mkfile_path))src<br>
>>> ```<br>
>>> You should start by changing this to<br>
>>> ```<br>
>>> # TESTSRCDIR is always relative to gmakefile.test<br>
>>> #  This must be before includes<br>
>>> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))<br>
>>> TESTSRCDIR ?= $(dir $(mkfile_path))src<br>
>>> ```<br>
>>> That way you could run your tests via<br>
>>> ```<br>
>>> $ make test TESTSRCDIR=/path/to/your/src/dir<br>
>>> ```<br>
>>> I am sure there are many other modifications you will need to make.<br>
>>><br>
>>> Best regards,<br>
>>><br>
>>> Jacob Faibussowitsch<br>
>>> (Jacob Fai - booss - oh - vitch)<br>
>>><br>
>>> > On Mar 27, 2023, at 06:14, Daniele Prada <<a href="mailto:daniele.prada85@gmail.com" target="_blank">daniele.prada85@gmail.com</a>><br>
>>> wrote:<br>
>>> ><br>
>>> > Hello everyone,<br>
>>> ><br>
>>> > I would like to use the PETSc Testing System for testing a package that<br>
>>> I am developing.<br>
>>> ><br>
>>> > I have read the PETSc developer documentation and have written some<br>
>>> tests using the PETSc Test Description Language. I am going through the<br>
>>> files in ${PETSC_DIR}/config but I am not able to make the testing system<br>
>>> look into the directory tree of my project.<br>
>>> ><br>
>>> > Any suggestions?<br>
>>> ><br>
>>> > Thanks in advance<br>
>>> > Daniele<br>
>>><br>
>>><br>
>><br>
>> --<br>
>> What most experimenters take for granted before they begin their<br>
>> experiments is infinitely more interesting than any results to which their<br>
>> experiments lead.<br>
>> -- Norbert Wiener<br>
>><br>
>> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br>
>> <<a href="http://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">http://www.cse.buffalo.edu/~knepley/</a>><br>
>><br>
</blockquote></div>