hoplite report for DBI : Part 2
Tim, I made another update today, here are the details of the changes: 07kids.t - changed it to a skip_all for DBI::PurePerl - Increased the number of tests from 11 to 20 - Added tests to exercise the $dbh's Kids/ActiveKids attributes more by creating and manipulating a statement handle - removed the $dbh HandleError stuff, and replaced it with do BLOCK scoping instead - add comments and cleaned up formatting 15array.t - Changed tests with stringified Data::Dumper output to use Test::More::eq_array instead. - made sure all tests have a test name - improve organization of tests in the file and add comments - added 2 more tests (for a total of 42) both were 'isa_ok' tests Let me know if they cause any problems. I was sure to update from svn and then rebuild and test again, so it should be okay. Steve
Re: reporting bugs to RT
I wonder if rt.cpan.org is broken. I'm trying to close ticket #2658 for Log::Procmail, but I can't tell rt when it's been fixed, since it show only version 0.01 to 0.05, when CPAN already holds 0.08 (0.06 and 0.07 have come and gone, since I try to tidy up behind me). I believe that at one point, Jesse Vincent was having problems with RT, and was moving, and got hacked, all within about a week of each other or so, so syncing with CPAN didn't happen. Something like that. xoa -- Andy Lester [EMAIL PROTECTED], AIM:petdance http://petdance.com/ http://use.perl.org/~petdance/
Re: hoplite report for DBI : Part 2
Why should you guys have all the fun? Here's my patch. * Adds a -T flag ('cause really, shouldn't all of DBI be able to run under taint mode?) * Uses Test::More instead of Test. * Escapes out properly with skip_all. * Adds an isa_ok() for all object creation statements. * Added some comments here and there. xoxo, Andy Index: t/42prof_data.t === --- t/42prof_data.t (revision 335) +++ t/42prof_data.t (working copy) @@ -1,24 +1,17 @@ -#!perl -w +#!perl -wT use strict; -# -# test script for DBI::ProfileData -# +use Test::More; -use DBI; -use DBI::ProfileDumper; -use DBI::ProfileData; +plan skip_all = profiling not supported for DBI::PurePerl if $DBI::PurePerl; BEGIN { -if ($DBI::PurePerl) { - print 1..0 # Skipped: profiling not supported for DBI::PurePerl\n; - exit 0; -} +plan tests=33; +use_ok( 'DBI' ); +use_ok( 'DBI::ProfileDumper' ); +use_ok( 'DBI::ProfileData' ); } -use Test; -BEGIN { plan tests = 18; } - use Data::Dumper; $Data::Dumper::Indent = 1; $Data::Dumper::Terse = 1; @@ -27,10 +20,12 @@ my $dbh = DBI-connect(dbi:ExampleP:, '', '', { RaiseError=1, Profile=6/DBI::ProfileDumper }); +isa_ok( $dbh, 'DBI::db', 'Created connection' ); # do a little work foreach (1,2,3) { my $sth = $dbh-prepare($sql); + isa_ok( $sth, 'DBI::st', 'Created handle' ); for my $loop (1..20) { $sth-execute(.); $sth-fetchrow_hashref; @@ -43,31 +38,30 @@ # wrote the profile to disk? -ok(-s dbi.prof); +ok(-s dbi.prof, Profile written to disk, non-zero size ); # load up my $prof = DBI::ProfileData-new(); -ok($prof); -ok(ref $prof eq 'DBI::ProfileData'); +isa_ok( $prof, 'DBI::ProfileData' ); +cmp_ok( $prof-count, '=', 3, 'At least 3 profile data items' ); -ok($prof-count() = 3); - # try a few sorts my $nodes = $prof-nodes; $prof-sort(field = longest); my $longest = $nodes-[0][4]; -ok($longest); +ok( $longest, 'Longest is non-zero' ); $prof-sort(field = longest, reverse = 1); -ok($nodes-[0][4] $longest); +cmp_ok( $nodes-[0][4], '', $longest ); $prof-sort(field = count); my $most = $nodes-[0]; ok($most); $prof-sort(field = count, reverse = 1); -ok($nodes-[0][0] $most-[0]); +cmp_ok( $nodes-[0][0], '', $most-[0] ); # remove the top count and make sure it's gone my $clone = $prof-clone(); +isa_ok( $clone, 'DBI::ProfileData' ); $clone-sort(field = count); ok($clone-exclude(key1 = $most-[7])); @@ -78,6 +72,7 @@ # there can only be one $clone = $prof-clone(); +isa_ok( $clone, 'DBI::ProfileData' ); ok($clone-match(key1 = $clone-nodes-[0][7])); ok($clone-match(key2 = $clone-nodes-[0][8])); ok($clone-count == 1); @@ -90,6 +85,7 @@ # test escaping of \n and \r in keys $dbh = DBI-connect(dbi:ExampleP:, '', '', { RaiseError=1, Profile=6/DBI::ProfileDumper }); +isa_ok( $dbh, 'DBI::db', 'Created connection' ); my $sql2 = 'select size from . where name = LITERAL: \r\n'; my $sql3 = select size from . where name = \EXPANDED: \r\n\; @@ -97,10 +93,12 @@ # do a little work foreach (1,2,3) { my $sth2 = $dbh-prepare($sql2); + isa_ok( $sth2, 'DBI::st' ); $sth2-execute(); $sth2-fetchrow_hashref; $sth2-finish; my $sth3 = $dbh-prepare($sql3); + isa_ok( $sth3, 'DBI::st' ); $sth3-execute(); $sth3-fetchrow_hashref; $sth3-finish; @@ -109,7 +107,7 @@ # load dbi.prof $prof = DBI::ProfileData-new(); -ok($prof and ref $prof eq 'DBI::ProfileData'); +isa_ok( $prof, 'DBI::ProfileData' ); # make sure the keys didn't get garbled $Data = $prof-Data; -- Andy Lester = [EMAIL PROTECTED] = www.petdance.com = AIM:petdance
Re: hoplite report for DBI : Part 2
OK, one more for tonight. It's the last of the Test.pm-using .t files. Index: t/41prof_dump.t === --- t/41prof_dump.t (revision 335) +++ t/41prof_dump.t (working copy) @@ -1,36 +1,27 @@ -#!perl -w +#!perl -Tw use strict; -# -# test script for DBI::ProfileDumper -# +use Test::More; -use DBI; -use DBI::ProfileDumper; +plan skip_all = profiling not supported for DBI::PurePerl if $DBI::PurePerl; BEGIN { -if ($DBI::PurePerl) { - print 1..0 # Skipped: profiling not supported for DBI::PurePerl\n; - exit 0; -} +plan tests = 11; +use_ok( 'DBI' ); +use_ok( 'DBI::ProfileDumper' ); } -use Test; -BEGIN { plan tests = 7; } - -use Data::Dumper; -$Data::Dumper::Indent = 1; -$Data::Dumper::Terse = 1; - my $dbh = DBI-connect(dbi:ExampleP:, '', '', { RaiseError=1, Profile=DBI::ProfileDumper }); -ok(ref $dbh-{Profile}, DBI::ProfileDumper); -ok(ref $dbh-{Profile}{Data}, 'HASH'); -ok(ref $dbh-{Profile}{Path}, 'ARRAY'); +isa_ok( $dbh, 'DBI::db' ); +isa_ok( $dbh-{Profile}, DBI::ProfileDumper ); +isa_ok( $dbh-{Profile}{Data}, 'HASH' ); +isa_ok( $dbh-{Profile}{Path}, 'ARRAY' ); # do a little work my $sql = select mode,size,name from ?; my $sth = $dbh-prepare($sql); +isa_ok( $sth, 'DBI::st' ); $sth-execute(.); $sth-{Profile}-flush_to_disk(); @@ -42,22 +33,21 @@ undef $dbh; # wrote the profile to disk? -ok(-s dbi.prof); +ok( -s dbi.prof, 'Profile is on disk and nonzero size' ); open(PROF, dbi.prof) or die $!; my $prof = join('', PROF); close PROF; # has a header? -ok($prof =~ /^DBI::ProfileDumper\s+([\d.]+)/); +ok( $prof =~ /^DBI::ProfileDumper\s+([\d.]+)/, 'Found a version number' ); +# Can't use like() because we need $1 # version matches VERSION? (DBI::ProfileDumper uses $self-VERSION so # it's a stringified version object that looks like N.N.N) -ok($1, DBI::ProfileDumper-VERSION); +is( $1, DBI::ProfileDumper-VERSION, 'Version numbers match' ); # check that expected key is there -ok($prof =~ /\+\s+1\s+\Q$sql\E/m); +like( $prof, qr/\+\s+1\s+\Q$sql\E/m ); # unlink(dbi.prof); # now done by 'make clean' - -1; -- Andy Lester = [EMAIL PROTECTED] = www.petdance.com = AIM:petdance
hoplite report for DBI
I have committed my first set of changes to the DBI svn repository. I am mostly still working on converting the scripts to use Test::More, but I have managed to slip in some additional tests here and there. The changes are as follows: 01basics.t - Changed file from custom ok routine to use Test::More. - Increased number of tests from 47 to 109, this is mostly because I added tests for *all* the sql_types and sql_cursor_types constants, rather than just spot checks as they were previously - Changed all if blocks to be Test::More style SKIP blocks - made sure all tests had a test name - re-organized the tests into logical groupings and added comments 02dbidrv.t - Changed file from using Test to using Test::More - Increased the number of tests from 36 to 48, mostly this is just doing 'isa_ok' tests on all returned objects. - Changed all if blocks to be Test::More style SKIP blocks - made sure all tests had a test name Still to do: - improve organization of tests in the file and add comments 07kids.t - Changed file from using Test to using Test::More - Increased the number of tests from 9 to 11 - Changed all if blocks to be Test::More style SKIP blocks - made sure all tests had a test name Still to do: - I am sure there is more I can test here, I will see what i can find - change it to a skip_all for DBI::PurePerl - add comments 10example.t - Changed file from custom ok routine to use Test::More. - Added one more test to bring it to 247 - Changed all if blocks to be Test::More style SKIP blocks Still to do: - make sure all tests have a test name - clean up this file, likely by break this up probably into several smaller test files and maybe into re-usable functions as well 15array.t - Changed file from using Test to using Test::More - Increased the number of tests from 39 to 41, mostly just 'isa_ok' tests Still to do: - make sure all tests have a test name - improve organization of tests in the file and add comments 30subclass.t - Changed file from custom ok routine to use Test::More. Still to do: - clean up the existing test orgainization - make sure all tests have a test name - add 'isa_ok' tests where appropriate There of course, is still more to come. But I thought I would commit my changes thus far. Thanks, Stevan Little [EMAIL PROTECTED] --- On two occasions I have been asked by members of Parliament, Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out? I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. -- Charles Babbage, 1792-1871
Re: hoplite report for DBI
On May 10, 2004, at 1:46 PM, H.Merijn Brand wrote: On Mon 10 May 2004 19:40, stevan little [EMAIL PROTECTED] wrote: I have committed my first set of changes to the DBI svn repository. I am mostly still working on converting the scripts to use Test::More, but I have managed to slip in some additional tests here and there. The changes are as follows: All looks great. Once you're done (or think you are), can we please have a snapshot (I don't do cvs), so I can test on the usual bunch of OS's and perls I have available. Yes, I will be sure to do that. - Steve
Re: hoplite report for DBI
On Mon, May 10, 2004 at 01:51:48PM -0400, stevan little wrote: On May 10, 2004, at 1:46 PM, H.Merijn Brand wrote: On Mon 10 May 2004 19:40, stevan little [EMAIL PROTECTED] wrote: I have committed my first set of changes to the DBI svn repository. I am mostly still working on converting the scripts to use Test::More, but I have managed to slip in some additional tests here and there. The changes are as follows: All looks great. Once you're done (or think you are), can we please have a snapshot (I don't do cvs), Neither does DBI. It's in Subversion. Subversion is *trivial* to use and I highly recommend it. http://search.cpan.org/~timb/DBI-1.42/DBI.pm#How_to_create_a_patch_using_Subversion so I can test on the usual bunch of OS's and perls I have available. Thanks. Yes, I will be sure to do that. No. *I'll* do that! (Only one person should make DBI releases, and that's me :) Perhaps in a week or so. Subversion is the way to go for anyone who wants more immediate access to the bleading edge. Tim.
Re: hoplite report for DBI
On Mon, May 10, 2004 at 01:40:55PM -0400, stevan little wrote: I have committed my first set of changes to the DBI svn repository. Thanks! I got an assortment of warnings from various tests. I suspect you didn't run a plain make test before the checkin (please do). I've checked in fixes for those. The changes have turned up a warning that ought to have been produced before: DBI handle cleared whilst still active at t/40profile.t line 143 so that's a good sign. I'm fixing that now. There of course, is still more to come. But I thought I would commit my changes thus far. Thanks. Please do. (Better regular chunks of changes than a few massive ones.) Tim.
Re: hoplite report for DBI
On Mon, May 10, 2004 at 10:29:53PM +0100, Tim Bunce wrote: On Mon, May 10, 2004 at 01:40:55PM -0400, stevan little wrote: I have committed my first set of changes to the DBI svn repository. The changes have turned up a warning that ought to have been produced before: DBI handle cleared whilst still active at t/40profile.t line 143 so that's a good sign. I'm fixing that now. Umm, I think that may have been caused by something else. Anyway, it's fixed now. Thanks. Tim.
Re: hoplite report for DBI
On May 10, 2004, at 5:29 PM, Tim Bunce wrote: On Mon, May 10, 2004 at 01:40:55PM -0400, stevan little wrote: I have committed my first set of changes to the DBI svn repository. Thanks! I got an assortment of warnings from various tests. I suspect you didn't run a plain make test before the checkin (please do). I've checked in fixes for those. I actually did run make test, and there were warnings, but they were in files I had not modified, and has been there since I first downloaded it. In particular 40profile.t was giving me trouble. I just assumed that something was under development and that was why it was breaking. I usually do a perl Makefile.PL make then I use the prove utility from Test::Harness to test as I go, then I run make clean and then a full perl Makefile.PL make make test. What were the warnings you saw? This is what I get when I run make test (with the latest code from svn (333)) PERL_DL_NONLAZY=1 /usr/local/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/01basicsok 6/109 skipped: various reasons t/02dbidrvok t/03handleok t/04mods..ok t/05thrclone..skipped all skipped: this darwin perl 5.008 not configured to support iThreads t/06attrs.ok t/07kids..ok t/08keeperr...ok t/09trace.ok t/10examp.ok t/15array.ok t/20meta..ok t/30subclass..ok t/40profile...ok 37/59DBI handle cleared whilst still active at t/40profile.t line 140. t/40profile...NOK 40# Test 40 got: '4' (t/40profile.t at line 146) #Expected: '5' t/40profile...NOK 45# Failed test 45 in t/40profile.t at line 151 t/40profile...FAILED tests 40, 45 Failed 2/59 tests, 96.61% okay t/41prof_dump.ok t/42prof_data.ok t/50dbm...ok t/60preparse..ok t/80proxy.skipped all skipped: modules required for proxy are probably not installed (e.g., RPC/PlClient.pm) t/pod.skipped all skipped: Test::Pod 1.00 required for testing POD t/zvpp_01basics...ok 6/109 skipped: various reasons t/zvpp_02dbidrv...ok 7/48 skipped: various reasons t/zvpp_03handle...ok t/zvpp_04mods.ok t/zvpp_05thrclone.skipped all skipped: this darwin perl 5.008 not configured to support iThreads t/zvpp_06attrsok t/zvpp_07kids.skipped all skipped: $h-{Kids} attribute not supported for DBI::PurePerl t/zvpp_08keeperr..ok t/zvpp_09traceok t/zvpp_10exampok 38/247 skipped: various reasons t/zvpp_15arrayok t/zvpp_20meta.ok t/zvpp_30subclass.ok t/zvpp_40profile..skipped all skipped: profiling not supported for DBI::PurePerl t/zvpp_41prof_dumpskipped all skipped: profiling not supported for DBI::PurePerl t/zvpp_42prof_dataskipped all skipped: profiling not supported for DBI::PurePerl t/zvpp_50dbm..ok t/zvpp_60preparse.skipped all skipped: preparse not supported for DBI::PurePerl t/zvpp_80proxyskipped all skipped: modules required for proxy are probably not installed (e.g., RPC/PlClient.pm) Failed Test Stat Wstat Total Fail Failed List of Failed --- t/40profile.t 592 3.39% 40 45 10 tests and 57 subtests skipped. Failed 1/39 test scripts, 97.44% okay. 2/1830 subtests failed, 99.89% okay. The changes have turned up a warning that ought to have been produced before: DBI handle cleared whilst still active at t/40profile.t line 143 so that's a good sign. I'm fixing that now. There of course, is still more to come. But I thought I would commit my changes thus far. Thanks. Please do. (Better regular chunks of changes than a few massive ones.) Tim.
Re: reporting bugs to RT
Le mercredi 05 mai 2004 à 17:16, Andy Lester écrivait: On Thu, May 06, 2004 at 12:44:58AM -0200, Gabor Szabo ([EMAIL PROTECTED]) wrote: I guess this answer also means that there is no script similar to perlbug that would report bugs about CPAN modules ? Wouldn't this help increasing the use or RT ? Not everyone uses RT. Many authors ignore it, I'm sure. I wonder if rt.cpan.org is broken. I'm trying to close ticket #2658 for Log::Procmail, but I can't tell rt when it's been fixed, since it show only version 0.01 to 0.05, when CPAN already holds 0.08 (0.06 and 0.07 have come and gone, since I try to tidy up behind me). What's happening? Did I remove distributions too quickly from CPAN? -- Philippe BooK Bruhat Friends are people who are there when you need them. (also applies to dogs) (Moral from Groo The Wanderer #43 (Epic))
Re: more B::Concise stuff (PATCH - updated)
Jim Cromie wrote: folks, attached patch has following adjustments to B::Concise and its tests. heres 2nd rev of that patch, now against 22802 - crossposted to perl-qa for its test related aspects. items 1-9 from prev post are all improved or solved a. goto-bug squashed - reset_sequence() now resets $lastnext too. formerly carrying 'state' from one rendering to next. b. showlex bug fixed - was due to signature change of B::Concise::fmt_line() c. rendering-match-rex now tighter, esp wrt opcode args and [] vs () bracing. this may be more brittle - if pad-tmp-var numbering isnt consistent across platforms. (consider this a test - it wont be hard to re-broaden parts of regex to accomodate d. 4 TODOs pass intentionally 2 were myvar optimizations of 'my $a=()' I think done by RGS' 2nd varinit optimization (dunno patch # or title) i left as TODO to get ack / fact check / closure. 2 are placeholders for {} and [] as args to B::Concise::compile, {} is good for splaying a stash, ex \%:: [] dunno yet. could do for BEGIN, END etc (already done) handler chains too. e. package SPLAYING is un-touched. One sticking point is err: sub has no -START. I think this happens on stub functions, so msg should maybe change accordingly. This should do no harm, esp if you dont use it ... NEW STUFF Showlex.pm can now 'walk' a coderef, ala B::Concise. (was formerly only a function name, looked up in the STASH). Added 7 more tests to showlex.t, using compile(), walk_output(). also added -newlex option, which does a different PAD display: it combines name and value on 1 line, 2x info density. B::Showlex::compile(CODE(0x821a99c)) CODE(0x821a99c) Pad has 17 entries 0: SPECIAL #1 PL_sv_undef 1: PVNV (0x821a960) $self = NULL (0x821a96c) 2: PVNV (0x821a948) %props = HV (0x821a93c) HASH 3: SPECIAL #1 PL_sv_undef = NULL (0x821a954) 4: SPECIAL #1 PL_sv_undef = NULL (0x821a930) 5: PVNV (0x821a918) $total = NULL (0x821a924) 6: PVNV (0x821a900) @fib = AV (0x821a8f4) undef 7: SPECIAL #1 PL_sv_undef = NULL (0x821a8dc) 8: PVNV (0x821a8c4) $i = NULL (0x821a8d0) 9: SPECIAL #1 PL_sv_undef = NULL (0x821a8a0) 10: SPECIAL #1 PL_sv_undef = NULL (0x821a888) 11: SPECIAL #1 PL_sv_undef = NULL (0x821a870) 12: SPECIAL #1 PL_sv_undef = NULL (0x821a864) 13: PVNV (0x821a84c) $i = NULL (0x821a858) 14: SPECIAL #1 PL_sv_undef = PVNV (0x821a828) undef 15: SPECIAL #1 PL_sv_undef = PVNV (0x821a81c) undef 16: SPECIAL #1 PL_sv_undef = NULL (0x821a810) Since theres no back compat issues with -newlex, Im open to suggestions on how info can be cleaner / more user-friendly 1. replace most SPECIAL #1 undefs with PadTmp$i where $i is col 1 above these would correlate with t3 as represented in Concise output. (or is this just wrong?) 2. suppress ' = NULL (0x)' it provides almost no info. most porters seem to use Devel::Peek when they want this kind of info, so showlex can specialize towards more overview. A good option - suppress normal chatter - print when unusual 3. get it to display [$i:start-ln,end-ln] where appropriate. 4. use Getopt::Std. may be issues vs O.pm conventions. ALSO NOTE: Showlex output (not -newlex ) for coderefs differs a bit from comppadlist. There were no tests of comppadlist output, so I dont know whether this diff is expected, or its something I broke / changed. diffs show up in lex-values array - 0 displays as AV, not SPECIAL AVs now have trailing 'undef' when theyve got no value. HVs have 'HASH', put there by ?? B::SV::terse, which gets it from concise_sv [EMAIL PROTECTED] latest]$ ./perl ext/B/t/showlex.t 9 # any arg forces verbose ... Pad of lexical values for comppadlist has 3 entries 0: SPECIAL #1 PL_sv_undef 1: NULL (0x8180f68) 2: NULL (0x818efd8) vs Pad of lexical values for CODE(0x821aa54) has 4 entries 0: AV (0x821aa0c) undef 1: NULL (0x821aa24) 2: AV (0x821a9f4) undef undef added by concise_sv tweak 3: HV (0x821a9dc) HASH TEST GENERATION support This optree regression testing framework needs tests in order to find bugs. To that end, OptreeCheck has support for developing new tests, according to the following model: 1. write a set of sample code into a single file, one per paragraph. f_map and f_sort in ext/B/t/ are examples. 2. run OptreeCheck as a program on the file ./perl -Ilib ext/B/t/OptreeCheck.pm -w ext/B/t/f_map ./perl -Ilib ext/B/t/OptreeCheck.pm -w ext/B/t/f_sort As prog, it reads the samples of code from the file, runs each to generate a reference rendering, folds this rendering into an optreeCheck() statement, and prints it to stdout. 3. run the output file as above, redirect to files, then rerun as a test on same build (for sanity check), and on thread-opposite build. With editor in 1 window, and cmd in other, its fairly easy to cut-paste the gots into the expects, easier than running step 2 on both builds then trying to sdiff them together. 4. my reason for this unholiness is that as a former