Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing test in S32-array/adverbs.t and S32-hash/adverbs.t: Code does not die as expected with 'use <MODULE>' #4813

Closed
p6rt opened this issue Dec 5, 2015 · 14 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Dec 5, 2015

Migrated from rt.perl.org#126823 (status was 'resolved')

Searchable as RT126823$

@p6rt
Copy link
Author

p6rt commented Dec 5, 2015

From @usev6

There are two failing tests (one in S32-array/adverbs.t, one in S32-hash/adverbs.t) that do not die as expected in a spectest. The problem can be golfed as follows​:

1) This code dies when it is run standalone​:

$ ./perl6-m -e 'my %h = b => 2, c => 3; say %h<b>​:zorp'
Unexpected named parameter 'zorp' passed
  in block <unit> at -e​:1

2) Code dies the first time it is executed with 'use Test'. (After a fresh install without any installed rakudo.)

$ PERL6LIB=lib ./perl6-m -e 'use Test; my %h = b => 2, c => 3; say %h<b>​:zorp'
Unexpected named parameter 'zorp' passed
  in block <unit> at -e​:1

3) Code does _not_ die when it is executed a second, third ... time with 'use Test'.

$ PERL6LIB=lib ./perl6-m -e 'use Test; my %h = b => 2, c => 3; say %h<b>​:zorp'
2
$ PERL6LIB=lib ./perl6-m -e 'use Test; my %h = b => 2, c => 3; say %h<b>​:zorp'
2

4) If I add a new line with a comment to 'lib/Test.pm' the code again dies at the first execution -- but not afterwards​:

$ echo "#" >> lib/Test.pm
$ PERL6LIB=lib ./perl6-m -e 'use Test; my %h = b => 2, c => 3; say %h<b>​:zorp'
Unexpected named parameter 'zorp' passed
  in block <unit> at -e​:1
$ PERL6LIB=lib ./perl6-m -e 'use Test; my %h = b => 2, c => 3; say %h<b>​:zorp'
2
$ PERL6LIB=lib ./perl6-m -e 'use Test; my %h = b => 2, c => 3; say %h<b>​:zorp'
2

I suspect that this behaviour has somehow to do with precompilation of 'lib/Test.pm'.

@p6rt
Copy link
Author

p6rt commented Dec 5, 2015

From @lizmat

On 05 Dec 2015, at 19​:36, Christian Bartolomaeus (via RT) <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by Christian Bartolomaeus
# Please include the string​: [perl #​126823]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=126823 >

There are two failing tests (one in S32-array/adverbs.t, one in S32-hash/adverbs.t) that do not die as expected in a spectest. The problem can be golfed as follows​:

As an additional datapoint​: both tests fail as expected if RAKUDO_MODULE_DEBUG is set to a true value.

Liz

@p6rt
Copy link
Author

p6rt commented Dec 5, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 9, 2015

From @usev6

Looks like this has nothing to do with lib/Test.pm​:

$ echo '#' > Bar.pm6
$ ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp'
Unexpected named parameter 'zorp' passed
  in block <unit> at -e​:1
$ ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp'
2

Setting RAKUDO_MODULE_DEBUG=1 does still give '2'​:

$ RAKUDO_MODULE_DEBUG=1 ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp'
P6M RMD​: Loading settings CORE
P6M RMD​: Setting up default paths​: . blib
P6M RMD​: going to load Perl6​::BOOTSTRAP
P6M RMD​: Settings CORE loaded
$*W RMD​: Attempting 'Bar' as a pragma
$*W RMD​: 'Bar' is not a valid pragma
$*W RMD​: Attempting to load 'Bar'
$*W RMD​: Late loading 'Bar'
SET RMD​: going to load Bar​: {}
SET RMD​: Parsing specs​: .
SET RMD​: Loading precompiled /rakudo_work_8/.precomp/1360B36570FE355AB531D0ACA145759EB0779D67.1449692100.66513/81/8175F7AD3D8961369AF87490A7212D8C2BEC5AF7
$*W RMD​: Performing imports for 'Bar'
2

@p6rt
Copy link
Author

p6rt commented Dec 10, 2015

From @usev6

Another data point​: The evaluation works as expected with MVM_SPESH_DISABLE=1​:

$ echo '#' > Bar.pm6
$ MVM_SPESH_DISABLE=1 ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp'
Unexpected named parameter 'zorp' passed
  in block <unit> at -e​:1

$ MVM_SPESH_DISABLE=1 ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp'
Unexpected named parameter 'zorp' passed
  in block <unit> at -e​:1

$ ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp'
2

@p6rt
Copy link
Author

p6rt commented Dec 18, 2015

From @usev6

I just found that my golfed test case seems to be flapping​:

$ for run in {1..10}; do (echo '#' > Bar.pm6; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1) | grep -c 'Unexpected named parameter'; done
2
2
1
2
1
2
1
1
2
1

Sometimes the second evaluation returns '2', sometimes it gives the desired error. Setting MVM_SPESH_DISABLE=1 looks correct​:

$ for run in {1..10}; do (echo '#' > Bar.pm6; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1; MVM_SPESH_DISABLE=1 ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1) | grep -c 'Unexpected named parameter'; done
2
2
2
2
2
2
2
2
2
2

1 similar comment
@p6rt
Copy link
Author

p6rt commented Dec 18, 2015

From @usev6

I just found that my golfed test case seems to be flapping​:

$ for run in {1..10}; do (echo '#' > Bar.pm6; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1) | grep -c 'Unexpected named parameter'; done
2
2
1
2
1
2
1
1
2
1

Sometimes the second evaluation returns '2', sometimes it gives the desired error. Setting MVM_SPESH_DISABLE=1 looks correct​:

$ for run in {1..10}; do (echo '#' > Bar.pm6; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1; MVM_SPESH_DISABLE=1 ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1) | grep -c 'Unexpected named parameter'; done
2
2
2
2
2
2
2
2
2
2

@p6rt
Copy link
Author

p6rt commented Dec 19, 2015

From @bdw

Not sensitive to MVM_SPESH_OSR_DISABLE=1, MVM_SPESH_INLINE_DISABLE=1,
MVM_JIT_DISABLE=1;
Seems to be a 'true' spesh bug, which are pretty rare.

2015-12-18 22​:23 GMT+01​:00 Christian Bartolomaeus via RT <
bugs-comment@​bugs6.perl.org>​:

I just found that my golfed test case seems to be flapping​:

$ for run in {1..10}; do (echo '#' > Bar.pm6; ./perl6-m -I. -e 'use Bar;
my %h = b => 2; say %h<b>​:zorp' 2>&1; ./perl6-m -I. -e 'use Bar; my %h = b
=> 2; say %h<b>​:zorp' 2>&1) | grep -c 'Unexpected named parameter'; done
2
2
1
2
1
2
1
1
2
1

Sometimes the second evaluation returns '2', sometimes it gives the
desired error. Setting MVM_SPESH_DISABLE=1 looks correct​:

$ for run in {1..10}; do (echo '#' > Bar.pm6; ./perl6-m -I. -e 'use Bar;
my %h = b => 2; say %h<b>​:zorp' 2>&1; MVM_SPESH_DISABLE=1 ./perl6-m -I. -e
'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1) | grep -c 'Unexpected named
parameter'; done
2
2
2
2
2
2
2
2
2
2

@p6rt
Copy link
Author

p6rt commented Dec 21, 2015

From @lizmat

On 18 Dec 2015, at 22​:23, Christian Bartolomaeus via RT <bugs-comment@​bugs6.perl.org> wrote​:

I just found that my golfed test case seems to be flapping​:

$ for run in {1..10}; do (echo '#' > Bar.pm6; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1) | grep -c 'Unexpected named parameter'; done
2
2
1
2
1
2
1
1
2
1

Sometimes the second evaluation returns '2', sometimes it gives the desired error. Setting MVM_SPESH_DISABLE=1 looks correct​:

$ for run in {1..10}; do (echo '#' > Bar.pm6; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1; MVM_SPESH_DISABLE=1 ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1) | grep -c 'Unexpected named parameter'; done
2
2
2
2
2
2
2
2
2
2

Confirm that these tests work ok with MVM_SPESH_DISABLE=1 inside the spectest.

Liz

@p6rt
Copy link
Author

p6rt commented Apr 24, 2016

From @usev6

My golfed test cases do no longer fail.

$ for run in {1..10}; do (echo '#' > Bar.pm6; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1; ./perl6-m -I. -e 'use Bar; my %h = b => 2; say %h<b>​:zorp' 2>&1) | grep -c 'Unexpected named parameter'; done
2
2
2
2
2
2
2
2
2
2

Alas, the tests in S32-hash/adverbs.t and S32-array/adverbs.t still do not pass. Will try to find a new/better golf.

@p6rt
Copy link
Author

p6rt commented Apr 24, 2016

From @usev6

On Sun Apr 24 02​:45​:35 2016, bartolin@​gmx.de wrote​:

Alas, the tests in S32-hash/adverbs.t and S32-array/adverbs.t still do
not pass. Will try to find a new/better golf.

Not as short as I hoped (it needs Test.pm6), but this is what currently fails in S32-hash/adverbs.t​:

$ perl6-m -Ilib -e 'use Test; my %h; is %h<B>​:p(False), (B=>Any); throws-like q[%h<C>​:k​:v], Exception, "test 2"; throws-like q[say %h<D>​:baxter], Exception, "test 3";'
Use of uninitialized value %h of type Any in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /usr/home/christian/perl6/perl6-roast-data/rakudo.moar/lib/Test.pm6 (Test) line 136
Use of uninitialized value of type Any in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /usr/home/christian/perl6/perl6-roast-data/rakudo.moar/lib/Test.pm6 (Test) line 136
ok 1 -
  1..2
  ok 1 - '%h<C>​:k​:v' died
  ok 2 - right exception type (Exception)
ok 2 - test 2
  1..2
(Any)
  not ok 1 - 'say %h<D>​:baxter' died
 
# Failed test ''say %h<D>​:baxter' died'
# at -e line 1
  ok 2 - \# SKIP Code did not die, can not check exception
  # Looks like you failed 1 test of 2
not ok 3 - test 3

# Failed test 'test 3'
# at -e line 1

If one uses 'is-deeply' instead of 'is', the tests pass. Also with MVM_SPESH_DISABLE=1 the tests pass​:

$ MVM_SPESH_DISABLE=1 perl6-m -Ilib -e 'use Test; my %h; is %h<B>​:p(False), (B=>Any); throws-like q[%h<C>​:k​:v], Exception, "test 2"; throws-like q[say %h<D>​:baxter], Exception, "test 3";'
Use of uninitialized value %h of type Any in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /usr/home/christian/perl6/perl6-roast-data/rakudo.moar/lib/Test.pm6 (Test) line 136
Use of uninitialized value of type Any in string context
Any of .^name, .perl, .gist, or .say can stringify undefined things, if needed. in block at /usr/home/christian/perl6/perl6-roast-data/rakudo.moar/lib/Test.pm6 (Test) line 136
ok 1 -
  1..2
  ok 1 - '%h<C>​:k​:v' died
  ok 2 - right exception type (Exception)
ok 2 - test 2
  1..2
  ok 1 - 'say %h<D>​:baxter' died
  ok 2 - right exception type (Exception)
ok 3 - test 3

@p6rt
Copy link
Author

p6rt commented Nov 10, 2017

From @usev6

The tests in S32-array/adverbs. and S32-hash/adverbs.t (and all code snippets in this ticket) are passing again. I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 10, 2017

From @usev6

The tests in S32-array/adverbs. and S32-hash/adverbs.t (and all code snippets in this ticket) are passing again. I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

p6rt commented Nov 10, 2017

@usev6 - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Nov 10, 2017
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant