[petsc-dev] Introducing new "test harness" to PETSc

Barry Smith bsmith at mcs.anl.gov
Tue Jan 17 19:58:29 CST 2017


> On Jan 17, 2017, at 7:44 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> On Tue, Jan 17, 2017 at 7:33 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 
> However, none of my localrunfiles are working. I have them defined this way
> 
>   test:
>     suffix: cgns_0
>     requires: cgns
>     args: -filename tut21.cgns -interpolate 1 -dm_view
>     localrunfiles: ../../../../../../share/petsc/datafiles/meshes/tut21.cgns
> 
> which works when gmakegentest.py is run, but not when executing the script

   localrunfiles is intended for truly local datafiles that are in the directory with the source code.

   Files at DATAFILESPATH and in PETSC_DIR/share/petsc/datafiles  are intended to be
handled in a different way (without copying the files)

   I don't know if Scott has defined the syntax for handling this yet.

   It could be as simple as 

    args: -filename ${PETSC_DIR}/share/petsc/datafiles/meshes/tut21.cgns -interpolate 1 -dm_view

  or 

    args: -filename ${DATAFILESPATH}/matrices/something -interpolate 1 -dm_view

Barry

> 
> arch-c-exodus-master/tests/src/dm/impls/plex/examples/tests/runex1_cgns_0.sh -v
> cp: ../../../../../../share/petsc/datafiles/meshes/tut21.cgns: No such file or directory
> 
>   Thanks,
> 
>      Matt
>  
> 
>     Matt
>  
>    args: -foo     # Foo test
> 
> 
> --- a/config/testparse.py
> +++ b/config/testparse.py
> @@ -59,6 +59,7 @@ def _stripIndent(block,srcfile):
>    ext=os.path.splitext(srcfile)[1]
>    for lline in block.split("\n"):
>      line=lline[1:] if lline.startswith("!") else lline
> +    line=line.split('#')[0]
>      if not line.strip(): continue
>      stripstr=" "
>      nspace=len(line)-len(line.lstrip(stripstr))
> @@ -70,6 +71,7 @@ def _stripIndent(block,srcfile):
>    newTestStr="\n"
>    for lline in block.split("\n"):
>      line=lline[1:] if lline.startswith("!") else lline
> +    line=line.split('#')[0]
>      if not line.strip(): continue
>      newline=line[nspace:]
>      newTestStr=newTestStr+newline.rstrip()+"\n"
> 
> On 1/17/17 5:11 PM, Matthew Knepley wrote:
> On Tue, Jan 17, 2017 at 6:08 PM, Barry Smith <bsmith at mcs.anl.gov
> <mailto:bsmith at mcs.anl.gov>> wrote:
> 
> 
>       Comments would be a new feature so belong in a new branch, so
>     create a branch off of master, call it say
>     scott/test-harness-comments then after you tested it (by adding at
>     least one comment to a current example) and then make a pull request
>     and we can get it into master very quickly.
> 
> 
> This works
> 
> --- a/config/testparse.py
> +++ b/config/testparse.py
> @@ -98,6 +98,7 @@ def parseTest(testStr,srcfile):
>    subdict={}
>    for line in striptest.split("\n"):
>      if not line.strip(): continue
> +    if len(line.split(":")) < 2: continue
>      var=line.split(":")[0].strip()
>      val=line.split(":")[1].strip()
>      # Start by seeing if we are in a subtest
> 
>    Matt
> 
> 
> 
>        Barry
> 
>     > On Jan 17, 2017, at 5:29 PM, Scott Kruger <kruger at txcorp.com
>     <mailto:kruger at txcorp.com>> wrote:
>     >
>     >
>     >
>     >
>     > The "This" is not at the same indentation level as the "test:"
>     >
>     > According the YAML standard, comments begin with #.
>     > I did not implement comments.
>     >
>     > Where do you want the fix pushed?
>     >
>     > Scott
>     >
>     >
>     > On 1/17/17 4:19 PM, Barry Smith wrote:
>     >>
>     >>   I don't see any difference in the spacing between the two
>     cases? We definitely don't want white space or lack of white space
>     to matter in the definitions, that is too hard to manage.
>     >>
>     >>
>     >>> On Jan 17, 2017, at 5:04 PM, Scott Kruger <kruger at txcorp.com
>     <mailto:kruger at txcorp.com>> wrote:
>     >>>
>     >>>
>     >>>
>     >>> It has to do with the spacing.  Looking at
>     src/sys/examples/test/ex1.c
>     >>>
>     >>> This works:
>     >>> /*TEST
>     >>>
>     >>>  This test does foo
>     >>>  test:
>     >>>     filter: egrep "(PETSC ERROR)" | egrep
>     "(main|CreateError|Error Created)" | cut -f1,2,3,4,5,6 -d" "
>     >>>
>     >>>
>     >>> TEST*/
>     >>>
>     >>> which I can see by doing this:
>     >>> ------------------------------------------------
>     >>> gabrielle 81: ../../../../config/testparse.py -t ex1.c -v 1
>     >>>
>     >>>
>     >>> ex1.c
>     >>>  runex1
>     >>>     filter: egrep "(PETSC ERROR)" | egrep
>     "(main|CreateError|Error Created)" | cut -f1,2,3,4,5,6 -d" "
>     >>> ------------------------------------------------
>     >>>
>     >>> but this does not:
>     >>>
>     >>> /*TEST
>     >>>
>     >>> This test does foo
>     >>>  test:
>     >>>     filter: egrep "(PETSC ERROR)" | egrep
>     "(main|CreateError|Error Created)" | cut -f1,2,3,4,5,6 -d" "
>     >>>
>     >>>
>     >>> TEST*/
>     >>>
>     >>> I would suggest that using # as a comment delimiter would be the
>     best approach to enabling comments.
>     >>>
>     >>> Scott
>     >>>
>     >>>
>     >>> On 1/17/17 3:53 PM, Matthew Knepley wrote:
>     >>>> On Tue, Jan 17, 2017 at 4:31 PM, Satish Balay
>     <balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>
>     >>>> <mailto:balay at mcs.anl.gov <mailto:balay at mcs.anl.gov>>> wrote:
>     >>>>
>     >>>>   On Tue, 17 Jan 2017, Matthew Knepley wrote:
>     >>>>
>     >>>>   > Also, how do I put comments inside these blocks to tell me
>     what the test is
>     >>>>   > about?
>     >>>>
>     >>>>   Looks like everything other than the define format is ignored..
>     >>>>
>     >>>>
>     >>>> It does not look that way to me:
>     >>>>
>     >>>> /usr/bin/python ./config/gmakegentest.py
>     --petsc-arch=arch-c-exodus-master
>     >>>> Traceback (most recent call last):
>     >>>> File "./config/gmakegentest.py", line 733, in <module>
>     >>>>   main(petsc_arch=opts.petsc_arch, output=opts.output,
>     >>>> verbose=opts.verbose, single_ex=opts.single_executable)
>     >>>> File "./config/gmakegentest.py", line 718, in main
>     >>>>
>     >>>>
>     dataDict=pEx.walktree(os.path.join(pEx.petsc_dir,'src'),action="genPetscTests")
>     >>>> File "./config/gmakegentest.py", line 613, in walktree
>     >>>>   eval("self."+action+"(root,dirs,files,dataDict)")
>     >>>> File "<string>", line 1, in <module>
>     >>>> File "./config/gmakegentest.py", line 593, in genPetscTests
>     >>>>   dataDict[root].update(testparse.parseTestFile(fullex))
>     >>>> File "/PETSc3/petsc/petsc-dev/config/testparse.py", line 175, in
>     >>>> parseTestFile
>     >>>>   testDict[basename]=parseTests(testString,srcfile)
>     >>>> File "/PETSc3/petsc/petsc-dev/config/testparse.py", line 140, in
>     >>>> parseTests
>     >>>>   testname,subdict=parseTest(test,srcfile)
>     >>>> File "/PETSc3/petsc/petsc-dev/config/testparse.py", line 102,
>     in parseTest
>     >>>>   val=line.split(":")[1].strip()
>     >>>> IndexError: list index out of range
>     >>>>
>     >>>>
>     >>>>  Matt
>     >>>>
>     >>>>
>     >>>>
>     >>>>   Satish
>     >>>>
>     >>>>
>     >>>>
>     >>>>
>     >>>> --
>     >>>> 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
>     >>>
>     >>> --
>     >>> Tech-X Corporation               kruger at txcorp.com
>     <mailto:kruger at txcorp.com>
>     >>> 5621 Arapahoe Ave, Suite A       Phone: (720) 974-1841
>     <tel:%28720%29%20974-1841>
>     >>> Boulder, CO 80303                Fax:   (303) 448-7756
>     <tel:%28303%29%20448-7756>
>     >>
>     >
>     > --
>     > Tech-X Corporation               kruger at txcorp.com
>     <mailto:kruger at txcorp.com>
>     > 5621 Arapahoe Ave, Suite A       Phone: (720) 974-1841
>     <tel:%28720%29%20974-1841>
>     > Boulder, CO 80303                Fax:   (303) 448-7756
>     <tel:%28303%29%20448-7756>
> 
> 
> 
> 
> --
> 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
> 
> -- 
> Tech-X Corporation               kruger at txcorp.com
> 5621 Arapahoe Ave, Suite A       Phone: (720) 974-1841
> Boulder, CO 80303                Fax:   (303) 448-7756
> 
> 
> 
> -- 
> 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
> 
> 
> 
> -- 
> 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




More information about the petsc-dev mailing list