Re: [petsc-users] Using PETSc Testing System

2023-03-28 Thread Daniele Prada
Will do, thanks!

On Tue, Mar 28, 2023 at 7:28 PM Jed Brown  wrote:

> 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.
>
> Daniele Prada  writes:
>
> > 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
> >
> > On Mon, Mar 27, 2023 at 4:38 PM Matthew Knepley 
> wrote:
> >
> >> On Mon, Mar 27, 2023 at 10:19 AM Jacob Faibussowitsch <
> jacob@gmail.com>
> >> wrote:
> >>
> >>> Our testing framework was pretty much tailor-made for the PETSc src
> tree
> >>> and as such has many hard-coded paths and decisions. I’m going to go
> out on
> >>> a limb and say you probably won’t get this to work...
> >>>
> >>
> >> I think we can help you get this to work. I have wanted to generalize
> the
> >> test framework for a long time. Everything is build by
> >>
> >>   confg/gmakegentest.py
> >>
> >> and I think we can get away with just changing paths here and everything
> >> will work.
> >>
> >>   Thanks!
> >>
> >>  Matt
> >>
> >>
> >>> That being said, one of the “base” paths that the testing harness uses
> to
> >>> initially find tests is the `TESTSRCDIR` variable in
> >>> `${PETSC_DIR}/gmakefile.test`. It is currently defined as
> >>> ```
> >>> # TESTSRCDIR is always relative to gmakefile.test
> >>> #  This must be before includes
> >>> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
> >>> TESTSRCDIR := $(dir $(mkfile_path))src
> >>> ```
> >>> You should start by changing this to
> >>> ```
> >>> # TESTSRCDIR is always relative to gmakefile.test
> >>> #  This must be before includes
> >>> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
> >>> TESTSRCDIR ?= $(dir $(mkfile_path))src
> >>> ```
> >>> That way you could run your tests via
> >>> ```
> >>> $ make test TESTSRCDIR=/path/to/your/src/dir
> >>> ```
> >>> I am sure there are many other modifications you will need to make.
> >>>
> >>> Best regards,
> >>>
> >>> Jacob Faibussowitsch
> >>> (Jacob Fai - booss - oh - vitch)
> >>>
> >>> > On Mar 27, 2023, at 06:14, Daniele Prada 
> >>> wrote:
> >>> >
> >>> > Hello everyone,
> >>> >
> >>> > I would like to use the PETSc Testing System for testing a package
> that
> >>> I am developing.
> >>> >
> >>> > I have read the PETSc developer documentation and have written some
> >>> tests using the PETSc Test Description Language. I am going through the
> >>> files in ${PETSC_DIR}/config but I am not able to make the testing
> system
> >>> look into the directory tree of my project.
> >>> >
> >>> > Any suggestions?
> >>> >
> >>> > Thanks in advance
> >>> > Daniele
> >>>
> >>>
> >>
> >> --
> >> What most experimenters take for granted before they begin their
> >> experiments is infinitely more interesting than any results to which
> their
> >> experiments lead.
> >> -- Norbert Wiener
> >>
> >> https://www.cse.buffalo.edu/~knepley/
> >> 
> >>
>


Re: [petsc-users] Using PETSc Testing System

2023-03-28 Thread Jed Brown
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. 

Daniele Prada  writes:

> 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
>
> On Mon, Mar 27, 2023 at 4:38 PM Matthew Knepley  wrote:
>
>> On Mon, Mar 27, 2023 at 10:19 AM Jacob Faibussowitsch 
>> wrote:
>>
>>> Our testing framework was pretty much tailor-made for the PETSc src tree
>>> and as such has many hard-coded paths and decisions. I’m going to go out on
>>> a limb and say you probably won’t get this to work...
>>>
>>
>> I think we can help you get this to work. I have wanted to generalize the
>> test framework for a long time. Everything is build by
>>
>>   confg/gmakegentest.py
>>
>> and I think we can get away with just changing paths here and everything
>> will work.
>>
>>   Thanks!
>>
>>  Matt
>>
>>
>>> That being said, one of the “base” paths that the testing harness uses to
>>> initially find tests is the `TESTSRCDIR` variable in
>>> `${PETSC_DIR}/gmakefile.test`. It is currently defined as
>>> ```
>>> # TESTSRCDIR is always relative to gmakefile.test
>>> #  This must be before includes
>>> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
>>> TESTSRCDIR := $(dir $(mkfile_path))src
>>> ```
>>> You should start by changing this to
>>> ```
>>> # TESTSRCDIR is always relative to gmakefile.test
>>> #  This must be before includes
>>> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
>>> TESTSRCDIR ?= $(dir $(mkfile_path))src
>>> ```
>>> That way you could run your tests via
>>> ```
>>> $ make test TESTSRCDIR=/path/to/your/src/dir
>>> ```
>>> I am sure there are many other modifications you will need to make.
>>>
>>> Best regards,
>>>
>>> Jacob Faibussowitsch
>>> (Jacob Fai - booss - oh - vitch)
>>>
>>> > On Mar 27, 2023, at 06:14, Daniele Prada 
>>> wrote:
>>> >
>>> > Hello everyone,
>>> >
>>> > I would like to use the PETSc Testing System for testing a package that
>>> I am developing.
>>> >
>>> > I have read the PETSc developer documentation and have written some
>>> tests using the PETSc Test Description Language. I am going through the
>>> files in ${PETSC_DIR}/config but I am not able to make the testing system
>>> look into the directory tree of my project.
>>> >
>>> > Any suggestions?
>>> >
>>> > Thanks in advance
>>> > Daniele
>>>
>>>
>>
>> --
>> What most experimenters take for granted before they begin their
>> experiments is infinitely more interesting than any results to which their
>> experiments lead.
>> -- Norbert Wiener
>>
>> https://www.cse.buffalo.edu/~knepley/
>> 
>>


Re: [petsc-users] Using PETSc Testing System

2023-03-28 Thread Daniele Prada
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

On Mon, Mar 27, 2023 at 4:38 PM Matthew Knepley  wrote:

> On Mon, Mar 27, 2023 at 10:19 AM Jacob Faibussowitsch 
> wrote:
>
>> Our testing framework was pretty much tailor-made for the PETSc src tree
>> and as such has many hard-coded paths and decisions. I’m going to go out on
>> a limb and say you probably won’t get this to work...
>>
>
> I think we can help you get this to work. I have wanted to generalize the
> test framework for a long time. Everything is build by
>
>   confg/gmakegentest.py
>
> and I think we can get away with just changing paths here and everything
> will work.
>
>   Thanks!
>
>  Matt
>
>
>> That being said, one of the “base” paths that the testing harness uses to
>> initially find tests is the `TESTSRCDIR` variable in
>> `${PETSC_DIR}/gmakefile.test`. It is currently defined as
>> ```
>> # TESTSRCDIR is always relative to gmakefile.test
>> #  This must be before includes
>> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
>> TESTSRCDIR := $(dir $(mkfile_path))src
>> ```
>> You should start by changing this to
>> ```
>> # TESTSRCDIR is always relative to gmakefile.test
>> #  This must be before includes
>> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
>> TESTSRCDIR ?= $(dir $(mkfile_path))src
>> ```
>> That way you could run your tests via
>> ```
>> $ make test TESTSRCDIR=/path/to/your/src/dir
>> ```
>> I am sure there are many other modifications you will need to make.
>>
>> Best regards,
>>
>> Jacob Faibussowitsch
>> (Jacob Fai - booss - oh - vitch)
>>
>> > On Mar 27, 2023, at 06:14, Daniele Prada 
>> wrote:
>> >
>> > Hello everyone,
>> >
>> > I would like to use the PETSc Testing System for testing a package that
>> I am developing.
>> >
>> > I have read the PETSc developer documentation and have written some
>> tests using the PETSc Test Description Language. I am going through the
>> files in ${PETSC_DIR}/config but I am not able to make the testing system
>> look into the directory tree of my project.
>> >
>> > Any suggestions?
>> >
>> > Thanks in advance
>> > Daniele
>>
>>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which their
> experiments lead.
> -- Norbert Wiener
>
> https://www.cse.buffalo.edu/~knepley/
> 
>


Re: [petsc-users] Using PETSc Testing System

2023-03-27 Thread Matthew Knepley
On Mon, Mar 27, 2023 at 10:19 AM Jacob Faibussowitsch 
wrote:

> Our testing framework was pretty much tailor-made for the PETSc src tree
> and as such has many hard-coded paths and decisions. I’m going to go out on
> a limb and say you probably won’t get this to work...
>

I think we can help you get this to work. I have wanted to generalize the
test framework for a long time. Everything is build by

  confg/gmakegentest.py

and I think we can get away with just changing paths here and everything
will work.

  Thanks!

 Matt


> That being said, one of the “base” paths that the testing harness uses to
> initially find tests is the `TESTSRCDIR` variable in
> `${PETSC_DIR}/gmakefile.test`. It is currently defined as
> ```
> # TESTSRCDIR is always relative to gmakefile.test
> #  This must be before includes
> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
> TESTSRCDIR := $(dir $(mkfile_path))src
> ```
> You should start by changing this to
> ```
> # TESTSRCDIR is always relative to gmakefile.test
> #  This must be before includes
> mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
> TESTSRCDIR ?= $(dir $(mkfile_path))src
> ```
> That way you could run your tests via
> ```
> $ make test TESTSRCDIR=/path/to/your/src/dir
> ```
> I am sure there are many other modifications you will need to make.
>
> Best regards,
>
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
>
> > On Mar 27, 2023, at 06:14, Daniele Prada 
> wrote:
> >
> > Hello everyone,
> >
> > I would like to use the PETSc Testing System for testing a package that
> I am developing.
> >
> > I have read the PETSc developer documentation and have written some
> tests using the PETSc Test Description Language. I am going through the
> files in ${PETSC_DIR}/config but I am not able to make the testing system
> look into the directory tree of my project.
> >
> > Any suggestions?
> >
> > Thanks in advance
> > Daniele
>
>

-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener

https://www.cse.buffalo.edu/~knepley/ 


Re: [petsc-users] Using PETSc Testing System

2023-03-27 Thread Jacob Faibussowitsch
Our testing framework was pretty much tailor-made for the PETSc src tree and as 
such has many hard-coded paths and decisions. I’m going to go out on a limb and 
say you probably won’t get this to work...

That being said, one of the “base” paths that the testing harness uses to 
initially find tests is the `TESTSRCDIR` variable in 
`${PETSC_DIR}/gmakefile.test`. It is currently defined as 
```
# TESTSRCDIR is always relative to gmakefile.test
#  This must be before includes
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
TESTSRCDIR := $(dir $(mkfile_path))src
```
You should start by changing this to
```
# TESTSRCDIR is always relative to gmakefile.test
#  This must be before includes
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
TESTSRCDIR ?= $(dir $(mkfile_path))src
```
That way you could run your tests via
```
$ make test TESTSRCDIR=/path/to/your/src/dir
```
I am sure there are many other modifications you will need to make.

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)

> On Mar 27, 2023, at 06:14, Daniele Prada  wrote:
> 
> Hello everyone,
> 
> I would like to use the PETSc Testing System for testing a package that I am 
> developing.
> 
> I have read the PETSc developer documentation and have written some tests 
> using the PETSc Test Description Language. I am going through the files in 
> ${PETSC_DIR}/config but I am not able to make the testing system look into 
> the directory tree of my project.
> 
> Any suggestions?
> 
> Thanks in advance
> Daniele



[petsc-users] Using PETSc Testing System

2023-03-27 Thread Daniele Prada
Hello everyone,

I would like to use the PETSc Testing System for testing a package that I
am developing.

I have read the PETSc developer documentation and have written some tests
using the PETSc Test Description Language. I am going through the files in
${PETSC_DIR}/config but I am not able to make the testing system look into
the directory tree of my project.

Any suggestions?

Thanks in advance
Daniele