#489: t/tools/ops2pm/*.t: Failures in 3 test files
---------------------+------------------------------------------------------
Reporter: jkeenan | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: none | Version:
Severity: medium | Keywords: ops ops2pm
Lang: | Patch: applied
Platform: all |
---------------------+------------------------------------------------------
Changes (by jkeenan):
* patch: => applied
Comment:
The failure occurs in the test of `prepare_real_ops()`. Here's the error
message we get when we call `prove -v
t/tools/ops2pm/09-prepare_real_ops.t`:
{{{
op load_language_s: sequence mismatch: ops.num 235 vs. core.ops 1245 at
/home/jimk/work/parrot/lib/Parrot/Ops2pm.pm line 248.
}}}
Here's the method in which the failure occurred:
{{{
sub prepare_real_ops {
my $self = shift;
my $real_ops = Parrot::OpsFile->new( [], $self->{nolines} );
$real_ops->{PREAMBLE} = $self->{ops}{PREAMBLE};
$real_ops->version( $self->{ops}->version );
# verify opcode numbers
my $seq = 0;
for my $el ( @{ $self->{ops}{OPS} } ) {
next if $el->{CODE} < 0; # skip
my $opname = $el->full_name;
my $n = $self->{optable}{$opname}; # former global
if ( $n != $el->{CODE} ) {
die "op $opname: number mismatch: ops.num $n vs. core.ops
$el->{CODE}";
}
if ( $seq != $el->{CODE} ) {
die "op $opname: sequence mismatch: ops.num $seq vs. core.ops
$el->{CODE}"; # <- line 248
}
push @{ $real_ops->{OPS} }, $el;
++$seq;
}
$self->{real_ops} = $real_ops;
}
}}}
Here are the parts of r37670 that triggered the test failure:
{{{
Index: trunk/src/ops/ops.num
===================================================================
--- a/trunk/src/ops/ops.num
+++ b/trunk/src/ops/ops.num
@@ -1267,2 +1267,4 @@
find_sub_not_null_p_s 1243
find_sub_not_null_p_sc 1244
+load_language_s 1245
+load_language_sc 1246
}}}
So two new opcodes were added. In the pre-1.0 world, we would have wanted
to run `make opsrenumber` to renumber the opcodes such that they would
have the same order as imposed by `Parrot::Ops2pm:sort_ops()` -- the
method called immediately before `prepare_real_ops()`. This condition was
enforced by this part of `prepare_real_ops()`:
{{{
if ( $seq != $el->{CODE} ) {
die "op $opname: sequence mismatch: ops.num $seq vs. core.ops
$el->{CODE}";
}
}}}
I deleted this `if` block in r37816. In that revision, I also corrected
the apparent error discussed in comments 4 and 5 of this ticket, thereby
making the `load_language` opcodes available.
Thank you very much.[[BR]]
kid51
--
Ticket URL: <https://trac.parrot.org/parrot/ticket/489#comment:6>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets