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

Matthew Knepley knepley at gmail.com
Tue Jan 17 19:44:00 CST 2017


On Tue, Jan 17, 2017 at 7:33 PM, Matthew Knepley <knepley at gmail.com> wrote:

> On Tue, Jan 17, 2017 at 6:27 PM, Scott Kruger <kruger at txcorp.com> wrote:
>
>>
>>
>> I think this is more YAML compliant as you can do this:
>>
>
> We need another parser fix:
>
>   test:
>     suffix: 2
>     args: -dim 2 -dm_view ::ascii_latex
>

This works for me:

@@ -98,8 +98,9 @@ def parseTest(testStr,srcfile):
   subdict={}
   for line in striptest.split("\n"):
     if not line.strip(): continue
     var=line.split(":")[0].strip()
-    val=line.split(":")[1].strip()
+    val=line.split(":", 1)[1].strip()
     # Start by seeing if we are in a subtest
     if line.startswith(" "):
       subdict[subtestname][var]=val

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

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'),acti
>>> on="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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170117/6405dc69/attachment.html>


More information about the petsc-dev mailing list