Ticket #219 (closed bug: fixed)

Opened 13 years ago

Last modified 13 years ago

t/tools/pmc2cutils/04-dump_pmc.t, t/tools/pmc2cutils/05-gen_c.t: Test failures

Reported by: jkeenan Owned by: cotto
Priority: normal Milestone:
Component: configure Version:
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

Changes made between 35932 and 35937 have started to cause failures in two of the build tools test files found in t/tools/pmc2cutils/. Please see attached file for output of prove on 04-dump_pmc.t and 05-gen_c.t.

A quick scan of the changes in this time frame suggests that the most likely suspect is this revision to lib/Parrot/Pmc2c/Parser.pm.

$ svn diff -r 35932:35937 ./lib  
Index: lib/Parrot/Pmc2c/Parser.pm
===================================================================
--- lib/Parrot/Pmc2c/Parser.pm  (revision 35932)
+++ lib/Parrot/Pmc2c/Parser.pm  (revision 35937)
@@ -76,7 +76,7 @@
     my $lineno = count_newlines($preamble) + $chewed_lines + 1;
     my $class_init;
 
-    ($lineno, $pmcbody)    = find_attrs(  $pmc, $pmcbody, $lineno, $filename);
+    ($lineno, $pmcbody)    = find_attrs(  $pmc, $pmcbody, $lineno, $filename, $pmc2cMain);
     ($lineno, $class_init) = find_methods($pmc, $pmcbody, $lineno, $filename);
 
     $pmc->postamble( Parrot::Pmc2c::Emitter->text( $post, $filename, $lineno ) );
@@ -90,8 +90,27 @@
 }
 
 sub find_attrs {
-    my ($pmc, $pmcbody, $lineno, $filename) = @_;
+    my ($pmc, $pmcbody, $lineno, $filename, $pmc2cMain) = @_;
 
+    #prepend parent ATTRs to this PMC's ATTR list, if possible
+    my $got_attrs_from = '';
+    foreach my $parent ( @{ $pmc->{parents} } ) {
+
+        my $parent_dump = $pmc2cMain->read_dump( lc($parent) . '.dump' );
+
+        if ( $got_attrs_from ne '' && $parent_dump->{has_attribute} ) {
+            die "$filename is trying to extend $got_attrs_from and $parent, ".
+                "but both these PMCs have ATTRs.";
+        }
+
+        if ( $parent_dump->{has_attribute} ) {
+            $got_attrs_from = $parent;
+            foreach my $parent_attrs ( @{ $parent_dump->{attributes} } ) {
+                $pmc->add_attribute($parent_attrs);
+            }
+        }
+    }
+
     # backreferences here are all +1 because below the qr is wrapped in quotes
     my $attr_re = qr{
         ^

Here's the most recent svn log on that file:

------------------------------------------------------------------------
r35934 | cotto | 2009-01-23 20:18:43 -0500 (Fri, 23 Jan 2009) | 2 lines

[pmc] make ATTRs implicitly be passed down the inheritance chain

Attachments

build.tools.test.failures.txt Download (4.9 KB) - added by jkeenan 13 years ago.
t/tools/pmc2cutils: failures in two files

Change History

Changed 13 years ago by jkeenan

t/tools/pmc2cutils: failures in two files

  Changed 13 years ago by jkeenan

  • owner set to cotto

Cotto,

Can you please see whether changes in Parrot::Pmc2c::Parser led to these test failures? Thanks.

kid51

follow-up: ↓ 3   Changed 13 years ago by cotto

My change lead to the failures (one of which seems to have been fixed). It looks like the remaining failure is an unintentional side-effect rather than an actual failure. The failure happens because the .dump for all the dependencies of a PMC aren't created during those tests. When find_attrs tries to load the .dump from a PMC's parent, it dies when that file doesn't exist. I'm looking into how to make the tests generate all the necessary .dumps, but I won't complain if someone beats me to it.

in reply to: ↑ 2   Changed 13 years ago by jkeenan

Replying to cotto:

My change lead to the failures (one of which seems to have been fixed). It looks like the remaining failure is an unintentional side-effect rather than an actual failure. The failure happens because the .dump for all the dependencies of a PMC aren't created during those tests. When find_attrs tries to load the .dump from a PMC's parent, it dies when that file doesn't exist. I'm looking into how to make the tests generate all the necessary .dumps, but I won't complain if someone beats me to it.

Thanks for looking into this. Since the tests were originally written to match the convoluted code in t/tools/pmc2c.pl, it's possible that the test no longer matches the interface. So if the test needs changing, please feel free to do so.

kid51

in reply to: ↑ description   Changed 13 years ago by jkeenan

Here is some debugging information. Adding some print statements to Parrot::Pmc2c::Dumper::dump_pmc(), it appears that the method is not failing on either of the default.pmc files but rather on the array.pmc file.

ok 18 - dump_vtable created vtable.dump
$VAR1 = [
          './src/pmc/default.pmc',
          '/tmp/g8Er4XmGIm/src/pmc/default.pmc',
          '/tmp/g8Er4XmGIm/src/pmc/array.pmc'
        ];
Attempting to parse ./src/pmc/default.pmc
Succeeded in parsing ./src/pmc/default.pmc
Attempting to parse /tmp/g8Er4XmGIm/src/pmc/default.pmc
Succeeded in parsing /tmp/g8Er4XmGIm/src/pmc/default.pmc
Attempting to parse /tmp/g8Er4XmGIm/src/pmc/array.pmc
 at /Users/jimk/work/parrot/lib/Parrot/Pmc2c/Pmc2cMain.pm line 155
        Parrot::Pmc2c::Pmc2cMain::read_dump('Parrot::Pmc2c::Pmc2cMain=HASH(0x18f1370)', 'default.dump') called at /Users/jimk/work/parrot/lib/Parrot/Pmc2c/Parser.pm line 99
        Parrot::Pmc2c::Parser::find_attrs('Parrot::Pmc2c::PMC=HASH(0x19a2580)', '\x{a}\x{a}/*\x{a}\x{a}=back\x{a}\x{a}=head2 Methods\x{a}\x{a}=over 4\x{a}\x{a}=item C<void class_init...', 103, '/tmp/g8Er4XmGIm/src/pmc/array.pmc', 'Parrot::Pmc2c::Pmc2cMain=HASH(0x18f1370)') called at /Users/jimk/work/parrot/lib/Parrot/Pmc2c/Parser.pm line 79
        Parrot::Pmc2c::Parser::parse_pmc('Parrot::Pmc2c::Pmc2cMain=HASH(0x18f1370)', '/tmp/g8Er4XmGIm/src/pmc/array.pmc') called at /Users/jimk/work/parrot/lib/Parrot/Pmc2c/Dumper.pm line 50
        Parrot::Pmc2c::Dumper::dump_pmc('Parrot::Pmc2c::Pmc2cMain=HASH(0x18f1370)') called at t/tools/pmc2cutils/04-dump_pmc.t line 112
cannot find file 'default.dump' in path '.', '/Users/jimk/work/parrot/t/tools/pmc2cutils/../..', '/Users/jimk/work/parrot/t/tools/pmc2cutils/../../src/pmc/', '/tmp/g8Er4XmGIm', '/tmp/g8Er4XmGIm/src/pmc', '/Users/jimk/work/parrot', '/Users/jimk/work/parrot/src/pmc' at /Users/jimk/work/parrot/lib/Parrot/Pmc2c/Pmc2cMain.pm line 235.
1..18
# Looks like your test died just after 18.
 Dubious, test returned 255 (wstat 65280, 0xff00)
 All 18 subtests passed 

kid51

follow-up: ↓ 7   Changed 13 years ago by cotto

The 04-dump_pmc.t tests were fixed in r35982. I just added some code to generate the dumps of the various dependencies manually. I don't think we care if the pmc2c code is smart enough to generate dumps as needed since other code already make sure that PMCs are build in the proper order.

  Changed 13 years ago by cotto

  • status changed from new to closed
  • resolution set to fixed

The same fix worked for the other failing test file. They're both passing as of r35984.

in reply to: ↑ 5   Changed 13 years ago by jkeenan

Replying to cotto:

I don't think we care if the pmc2c code is smart enough to generate dumps as needed since other code already make sure that PMCs are build in the proper order.

Thanks, cotto, for your attention to these tests. This enables me to run coverage analysis once again on the coverage and build tools, which will help me with other TTs currently pending.

I'm wondering: Where is the code that guarantees that PMCs are built in the proper order?

kid51

  Changed 13 years ago by coke

It's put in the generated makefile; e.g.:

src/pmc/resizablepmcarray.dump : vtable.dump src/pmc/default.dump src/pmc/fixedpmcarray.dump  src/pmc/resizablepmcarray.pmc $(PMC2C_FILES) lib/Parrot/Pmc2c/PCCMETHOD.pm src/pmc/pmc_fixedintegerarray.h
        $(PMC2CD) src/pmc/resizablepmcarray.pmc

This appears to be generated by config/auto/pmc.pm

Note: See TracTickets for help on using tickets.