[perl #59940] [patch] convert perl tests to parrot
On Thu Oct 23 01:38:59 2008, mgrimes wrote: Christoph, Thanks for your help. This has been a great, low intensity, way to learn a bit of parrot. I think I have addressed everything, and I have attached a new patch. The patch no longer applies cleanly to objects.t, and I thought it'd be better to let you merge the recent changes from svn and add the .pcc_sub Looks like there were just a few changes to spacing. This patch applied cleanly to version 32115. I added the .pcc_sub tests to objects.t. It's a good idea to test for exception types rather than exact messages. This keeps the tests passing if the wording of the message is changed. The exception type is much more likely to remain constant. This recommended but not a blocker. I wanted to keep the changes to the code down to a minimum, so I was reluctant to add ExecptionHandler objects. If there is a simpler way (ie, testing with typeof, etc), I would be happy to look into changing it. Test messages for shouldn't be blank. If a test fails, it should be fairly Oops. Got a bit ahead of myself with complex.t. Messages have been added. This is a minor nit, but -ve and +ve generally expand to negative and Ah... should have known. Thanks. Again, thanks for working on this. Happy to help. Thanks to you and the rest of the team for doing the heavy lifting! -Mark Good times. I changed the register names to use the $P0 format, switched a few tests to isa_ok and made some minor changes (description updates, removing unneeded code/comments). The getting_null_attribute test was only throwing an exception because the old version was trying to print a null PMC. It tests nullness more sanely now. The exception-throwing tests are a little more defensive now. This doesn't matter when they pass but should make debugging easier if they ever fail. pmichaud confirmed that the typeof_class test tests the right thing, so I enabled that one too. Apart from those (mostly cosmetic) changes, the patch was good. It was committed as r32145 and r32149 after I checked that everything was sane and no tests got dropped in the conversion. Thanks.
Re: [perl #59940] [patch] convert perl tests to parrot
jerry gay wrote: On Fri, Oct 17, 2008 at 4:00 PM, Mark Grimes [EMAIL PROTECTED] wrote: The attached patch now includes the pir/pasm_error_output* tests in pir. I have also added t/pmc/complex.t. Couple of issues: 1) I am not sure how to deal with pcc_sub's so I put them into t/pmc/objects-pcc_sub.t 2) There appears to be a bug that shows up in complex.t - complex_divide_by_zero_*(). I have skip'ed those tests and will submit a simplified bug report and test. This drops the test run time for these from 24 seconds to less than 2. Also, this patch should hopefully apply cleanly. I had to make some changes to the $Id: line in the patch by hand. -Mark On Fri, Oct 17, 2008 at 10:35 AM, Mark Grimes [EMAIL PROTECTED] wrote: On Fri, Oct 17, 2008 at 12:39 AM, Christoph Otto via RT [EMAIL PROTECTED] wrote: You can fix the foo_error_bar tests by using an exception handler to catch the (appropriate type of) exception. The simplest way is to use push_eh with a label. If the exception is raised, control will jump to that label. t/pmc/resizablestringarray.t uses this style. Thanks Christoph. That is pretty straight forward. I'll update and send a new patch. when I was on my PIRifying binge, but I didn't have nearly enough patience at the time. Agreed. Takes quite a bit of patients, but I have put together a vim function and perl script that takes care of some of the more common test idioms automatically. I'll make it public after I clean it up a bit more. Any suggestion on how to deal the the .pcc_sub tests. I admit, I don't quite understand what pcc_sub are, and I get an error whenever they are included: error:imcc:syntax error, unexpected PCC_SUB, exprint $end ('.pcc_sub') There are two tests in object.t that use them. s/\.pcc_sub/\.sub/g; ## this will fix it ~jerry Hi Mark, I've reviewed the updated complex.t and string.t, and have a few suggestions. The patch no longer applies cleanly to objects.t, and I thought it'd be better to let you merge the recent changes from svn and add the .pcc_sub tests, given Jerry's suggestion. I'll be glad to review and commit an updated version. It's a good idea to test for exception types rather than exact messages. This keeps the tests passing if the wording of the message is changed. The exception type is much more likely to remain constant. This recommended but not a blocker. Test messages for shouldn't be blank. If a test fails, it should be fairly obvious from the output what went wrong. This makes debugging easier, which is always a good goal. In string.t, don't worry about preserving comments about failing tests if the relevant test passes. Use $P0 instead of P0. Both currently work, but the non-$ syntax is deprecated. This is a minor nit, but -ve and +ve generally expand to negative and positive. Changing out_of_bounds_substr_neg_ve_offset would increase readability, although it's already a mouthful. Again, thanks for working on this. Christoph
Re: [perl #59940] [patch] convert perl tests to parrot
On Fri, Oct 17, 2008 at 12:39 AM, Christoph Otto via RT [EMAIL PROTECTED] wrote: You can fix the foo_error_bar tests by using an exception handler to catch the (appropriate type of) exception. The simplest way is to use push_eh with a label. If the exception is raised, control will jump to that label. t/pmc/resizablestringarray.t uses this style. Thanks Christoph. That is pretty straight forward. I'll update and send a new patch. when I was on my PIRifying binge, but I didn't have nearly enough patience at the time. Agreed. Takes quite a bit of patients, but I have put together a vim function and perl script that takes care of some of the more common test idioms automatically. I'll make it public after I clean it up a bit more. Any suggestion on how to deal the the .pcc_sub tests. I admit, I don't quite understand what pcc_sub are, and I get an error whenever they are included: error:imcc:syntax error, unexpected PCC_SUB, exprint $end ('.pcc_sub') There are two tests in object.t that use them. Thanks, Mark
Re: [perl #59940] [patch] convert perl tests to parrot
On Fri, Oct 17, 2008 at 4:00 PM, Mark Grimes [EMAIL PROTECTED] wrote: The attached patch now includes the pir/pasm_error_output* tests in pir. I have also added t/pmc/complex.t. Couple of issues: 1) I am not sure how to deal with pcc_sub's so I put them into t/pmc/objects-pcc_sub.t 2) There appears to be a bug that shows up in complex.t - complex_divide_by_zero_*(). I have skip'ed those tests and will submit a simplified bug report and test. This drops the test run time for these from 24 seconds to less than 2. Also, this patch should hopefully apply cleanly. I had to make some changes to the $Id: line in the patch by hand. -Mark On Fri, Oct 17, 2008 at 10:35 AM, Mark Grimes [EMAIL PROTECTED] wrote: On Fri, Oct 17, 2008 at 12:39 AM, Christoph Otto via RT [EMAIL PROTECTED] wrote: You can fix the foo_error_bar tests by using an exception handler to catch the (appropriate type of) exception. The simplest way is to use push_eh with a label. If the exception is raised, control will jump to that label. t/pmc/resizablestringarray.t uses this style. Thanks Christoph. That is pretty straight forward. I'll update and send a new patch. when I was on my PIRifying binge, but I didn't have nearly enough patience at the time. Agreed. Takes quite a bit of patients, but I have put together a vim function and perl script that takes care of some of the more common test idioms automatically. I'll make it public after I clean it up a bit more. Any suggestion on how to deal the the .pcc_sub tests. I admit, I don't quite understand what pcc_sub are, and I get an error whenever they are included: error:imcc:syntax error, unexpected PCC_SUB, exprint $end ('.pcc_sub') There are two tests in object.t that use them. s/\.pcc_sub/\.sub/g; ## this will fix it ~jerry
[perl #59940] [patch] convert perl tests to parrot
On Thu Oct 16 17:43:28 2008, mgrimes wrote: Hi, The attached patch converts two perl based tests into parrot tests: t/pmc/string.t t/pmc/objects.t Each of these included pir_error_is type tests. I am not aware of any way to test those within parrot right now, so I kept them in perl tests and move them to t/pmc/string-errors.t and t/pmc/objects-errors.t. Converting these test to pir dropped their run time from 19 secs to 3 secs, and more than 2 of those seconds are spent in the *-errors.t tests. Unfortunately, I ran into a small issue applying the patch. Since I am changing lines near the # $Id:$ line, svn diff creates a patch that doesn't apply cleanly. The following one liner will clean up the $Id: line, so the patch applies cleanly. $ perl -i.bak -pe's/# \$Id: .*$/# \$Id\$/' t/pmc/string.t t/pmc/objects.t If there is a better way to make the patch, please let me know. Thanks, Mark You can fix the foo_error_bar tests by using an exception handler to catch the (appropriate type of) exception. The simplest way is to use push_eh with a label. If the exception is raised, control will jump to that label. t/pmc/resizablestringarray.t uses this style. The more fine-grained approach is to use an ExceptionHandler PMC. t/pmc/ro.t uses this style. This lets you set the types and min/max severity that the eh will handle and resume execution. t/pmc/exceptionhandler.t has some nice examples. Thanks for rewriting those two tests. I thought about tackling them when I was on my PIRifying binge, but I didn't have nearly enough patience at the time.
Perl tests
I have to write some unit tests for the Parrot::IO::* and Parrot::Docs::* modules and I'm wondering where to put them. How about creating t/perl and adding Parrot_IO_*.t etc? Or should I go for a t/perl/Parrot/IO/*.t approach? Someone help me make up my mind. No need for them to be run with make test, a perltest target can be added. Mike