Re: [perl #130603] Test (module) fails while all tests return ok
Thanks very much for the explanation, Tried the following to get the Test/TAP crying... use Test; is 1, 1, 'test 1'; say "ok 1 - pestering 1"; say "nok 5 - pestering 2"; done-testing; It then generates ok 1 - test 1 ok 1 - pestering 1 nok 5 - pestering 2 1..1 Failed -1/1 subtests Test Summary Report --- confuse-TAP.t (Wstat: 0 Tests: 2 Failed: 0) Parse errors: Tests out of sequence. Found (1) but expected (2) Bad plan. You planned 1 tests but ran 2. Files=1, Tests=2, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.15 cusr 0.01 csys = 0.19 CPU) Result: FAIL Looking back in the log I found a line with a test result at the end of the line. This might have been missed by TAP. 2017-01-20 13:04:40.446841 [T] 1: socket found ok 2 - Scanned 200 docs, bad searching Printing to stderr does not help and I get the same problems with the test above using 'note' instead of 'say'. It then comes down to refraining from printing anything to prevent any mishap. Of course, it is easy to prevent the 'ok ## - something' output but not when some real ok output ends up at the end of some other line. Btw. the perl version was retrieved from an installation on TRAVIS where rakudobrew is used. Regards, Marcel On 01/20/2017 10:04 PM, Zoffix Znet via RT wrote: On Fri, 20 Jan 2017 09:16:18 -0800, mt1...@gmail.com wrote: Hi Will, How can it happen that a test gets hurt in this way? If I know this I could better search for the problem. Regards, Marcel Hi, Here's how that error happens: The TAP protocol[^1] expects tests to be numbered and (as seen in your output) the test harness will complain if it spots tests missing or not in order. So if your tests produce junk output (that is something other than stuff produced by Test.pm6's routines), it could confuse the harness by making it interpret junk output as a test. Another harder way to accomplishing that is to run the tests in multiple threads, to trigger a data race in the Test.pm6's internal test counter and make it output wrong stuff. Yet another way is to use a buggy test harness that fails to recognize a test and so thinks something's missing. We had such a bug recently, though it got introduced on Jan 2nd and got fixed[^2] on Jan 5th. From your version, I see you're running Rakudo from some time in October, so this probably isn't it... I'd suggest you try using a release version of Rakudo or HEAD. I tried running that test on my box, but instead of TAP output it seems to be just producing time-stamped connection failures. [1] https://testanything.org/ [2] https://github.com/rakudo/rakudo/commit/b120ac401a0795f5f4c5fcd6e775848b4b755508
Re: [perl #130603] Test (module) fails while all tests return ok
test should be is 1, 1, 'test 1'; say "ok 1 - pestering 1"; say "not ok 5 - pestering 2"; resulting in ok 1 - test 1 ok 1 - pestering 1 not ok 5 - pestering 2 1..1 Failed -1/1 subtests Test Summary Report --- confuse-TAP.t (Wstat: 0 Tests: 3 Failed: 1) Failed test: 5 Parse errors: Tests out of sequence. Found (1) but expected (2) Tests out of sequence. Found (5) but expected (3) Bad plan. You planned 1 tests but ran 3. Files=1, Tests=3, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.16 cusr 0.01 csys = 0.19 CPU) Result: FAIL but problem on how to cope with mixed lines with real test output remains regards, Marcel
Re: [perl #130603] Test (module) fails while all tests return ok
Update... I've used --merge on prove! This merges the outputs into one. Removing this option and using note for the output will give correct results ok 1 - test 1 1..1 ok 1 - pestering 1 not ok 5 - pestering 2 ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.00 sys + 0.15 cusr 0.02 csys = 0.20 CPU) Result: PASS
[perl #130610] [BUG] Triangle-reduce operator `[\ ]` unexpectedly flattens each result
# New Ticket Created by Sam S. # Please include the string: [perl #130610] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130610 > The normal reduce meta-operator doesn't flatten anything: ➜ say [,] , , ; ((a b) (c d) (e f)) But the triangle-reduce operator flattens each of the intermediate results it returns: ➜ .say for [\,] , , ; (a b) (a b c d) (a b c d e f) The result I expected for that last statement, is: ((a b)) ((a b) (c d)) ((a b) (c d) (e f))
[perl #130611] hash slice assignment doesn't work for custom class
# New Ticket Created by Wenzel Peppmeyer # Please include the string: [perl #130611] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130611 > class C does Associative { method AT-KEY(\k){ dd 'at-key'; True }; method ASSIGN-KEY(\k, \v){ dd 'assign-key'~k~v } } C.new = 1; C.new = 1,2; # OUTPUT«"assign-keya1""at-key""at-key"Cannot modify an immutable Bool in block at line 1» # ASSIGN-KEY is never called for list keys as a result a custom class # (that is not a container itself) can not provide hash slices without # significiant hackery.
[perl #130612] [BUG] LTM doesn't use text order for tie break as expected
# New Ticket Created by Ron Schmidt # Please include the string: [perl #130612] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=130612 > # https://design.perl6.org/S05.html#Longest-token_matching says: # For matches of same length ... If the alternatives are in the same # grammar file, the textually earlier alternative takes precedence. use Test; grammar text-order { token alt-na_1 { | }; token alt-na_2 { | }; token n { + } token na_1 { <+alpha +digit> + } token na_2 { <+alpha +[0..9]> + } } is text-order.parse('1', :rule).keys[0], 'n', 'Match first textual rule OK'; is text-order.parse('1', :rule).keys[0], 'n', 'Match second textual rule fail'; result: ok 1 - Match first textual rule OK not ok 2 - Match second textual rule fail # Failed test 'Match second textual rule fail' # at line 17 # expected: 'n # got: 'na_2' Posted on IRC, https://irclog.perlgeek.de/perl6/2017-01-20#i_13960886 The IRC discussion notes that the tests should be expected to pass and the S05 rule is intended for implementation in current Perl 6 / Rakudo. See also roast issue: https://github.com/perl6/roast/issues/224
[perl #130613] [PERF] "if" without "else" much slower than "if" with empty "else"
On Sat, 21 Jan 2017 11:45:10 -0800, ale...@yahoo.com wrote: > Take a look at the following examples - the second is more than > 10x(!!!) faster: > m: my int $i = 0; loop { if $i++ == 10_000_000 { last }}; say now - > INIT now;rakudo-moar f97d5c: OUTPUT«2.0606382» > m: my int $i = 0; loop { if $i++ == 10_000_000 { last } else {} }; say > now - INIT now; > rakudo-moar f97d5c: OUTPUT«0.1727145» > > In my understanding of > https://github.com/rakudo/rakudo/blob/nom/src/Perl6/Actions.nqp#L1675 > the first example is equivalent to: > > m: my int $i = 0; loop { if $i++ == 10_000_000 { last } else { Empty } > }; say now - INIT now; > rakudo-moar f97d5c: OUTPUT«WARNINGS for :Useless use of constant > value Empty in sink context (line 1)2.120407471» That's because the two examples you are comparing are entirely different. The case with implicit or explicit Empty can be used in lists, in which the Empty slips away: m: sub stuff { if 0 {} }; dd [1, stuff(), 4] rakudo-moar 7f245f: OUTPUT«[1, 4]» But the explicit `else {}` results in a Nil, which leaves unwanted stuff in lists: m: sub stuff { if 0 {} else {} }; dd [1, stuff(), 4] rakudo-moar 7f245f: OUTPUT«[1, Any, 4]» --- So naturally, the optimizer can check whether whether the value of the conditional is ever used and avoid the Empty stuff, and it does so in some cases: m: sub stuff { if 0 {} else {}; 42 }; for ^100_000 { $ = [1, stuff(), 4] }; say now - INIT now; rakudo-moar 7f245f: OUTPUT«0.306001» m: sub stuff { if 0 {}; 42 }; for ^100_000 { $ = [1, stuff(), 4] }; say now - INIT now; rakudo-moar 7f245f: OUTPUT«0.3428267» It doesn't seem to do that for the OP case (even when you tack on an extra value after it so result isn't used). So perhaps it could be taught to do so. Note that I doubt you'd see much speedup from this in real-life code: "10 times" may sound impressive, but the average comes down to difference between 21.9 *nano*seconds vs 219 *nano*seconds.
[perl #130586] [REGEX] :sigspace does not affect spaces inside character classes
On Wed, 18 Jan 2017 18:16:20 -0800, c...@zoffix.com wrote: > the :sigspace adverb does not affect spaces inside character class. > Should it? > No, I don't think so. `<.ws>` can match any number of characters (including zero). A char class is defining something a matcher for a single character. > Note that having JUST space inside also causes a weird error to be > thrown: > > m: say " " ~~ m:s/<-[ ]>/ > rakudo-moar 1aeea1: OUTPUT«===SORRY!===Iteration past end > of iterator» > That one's certainly a bug. Since whitespace in a charclass is not significant, then it should complain about an empty charclass, preferably with a hint about space. > m: say " " ~~ m:s/<-[x ]>/ > rakudo-moar 1aeea1: OUTPUT«「 」» This matches because it's the same as m:s/<-[x]>/. You'd need to write <-[x\ ]> to make the space significant. > m: say " " ~~ m:s/<-[ x]>/ > rakudo-moar 1aeea1: OUTPUT«「 」» Ditto. /jnthn
[perl #130615] [PERF] Autoincrement much slower in sink context
On Sat, 21 Jan 2017 13:52:37 -0800, ale...@yahoo.com wrote: > m: my int $i = 0; while $i < 10_000_000 { $i++ }; say now - INIT > now;rakudo-moar 7f245f: OUTPUT«5.1848902» > m: my (int $i, int $nosink) = 0, 0; while $i < 10_000_000 { $nosink = > $i++ }; say now - INIT now;rakudo-moar 7f245f: OUTPUT«0.0816566» More accurately: it's much faster when not sunk, as it gets optimized. Turn off the optimizer and the difference vanishes: zoffix@VirtualBox:~$ perl6 -e 'my int $i = 0; while $i < 200_000 { $ = $i++; $ = 42 }; say now - INIT now;' 0.05608007 zoffix@VirtualBox:~$ perl6 -e 'my int $i = 0; while $i < 200_000 { $i++; $ = 42 }; say now - INIT now;' 0.1869925 zoffix@VirtualBox:~$ perl6 --optimize=off -e 'my int $i = 0; while $i < 200_000 { $ = $i++; $ = 42 }; say now - INIT now;' 0.2641866 zoffix@VirtualBox:~$ perl6 --optimize=off -e 'my int $i = 0; while $i < 200_000 { $i++; $ = 42 }; say now - INIT now;' 0.2896187