This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
B::walksymtable improperly documented?
[perl5.git] / t / lib / b-debug.t
CommitLineData
87a42246
MS
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 if ($^O eq 'MacOS') {
6 @INC = qw(: ::lib ::macos:lib);
7 } else {
8 @INC = '.';
9 push @INC, '../lib';
10 }
11}
12
13$| = 1;
14use warnings;
15use strict;
16use Config;
17
18print "1..3\n";
19
20my $test = 1;
21
22sub ok { print "ok $test\n"; $test++ }
23
24
25my $a;
26my $Is_VMS = $^O eq 'VMS';
27my $Is_MacOS = $^O eq 'MacOS';
28
29my $path = join " ", map { qq["-I$_"] } @INC;
30my $redir = $Is_MacOS ? "" : "2>&1";
31
32$a = `$^X $path "-MO=Debug" -e 1 $redir`;
33print "not " unless $a =~
34/\bLISTOP\b.*\bOP\b.*\bCOP\b.*\bOP\b/s;
35ok;
36
37
38$a = `$^X $path "-MO=Terse" -e 1 $redir`;
39print "not " unless $a =~
40/\bLISTOP\b.*leave.*\n OP\b.*enter.*\n COP\b.*nextstate.*\n OP\b.*null/s;
41ok;
42
43$a = `$^X $path "-MO=Terse" -ane "s/foo/bar/" $redir`;
44$a =~ s/\(0x[^)]+\)//g;
45$a =~ s/\[[^\]]+\]//g;
46$a =~ s/-e syntax OK//;
47$a =~ s/[^a-z ]+//g;
48$a =~ s/\s+/ /g;
49$a =~ s/\b(s|foo|bar|ullsv)\b\s?//g;
50$a =~ s/^\s+//;
51$a =~ s/\s+$//;
52my $is_thread = $Config{use5005threads} && $Config{use5005threads} eq 'define';
53if ($is_thread) {
54 $b=<<EOF;
55leave enter nextstate label leaveloop enterloop null and defined null
56threadsv readline gv lineseq nextstate aassign null pushmark split pushre
57threadsv const null pushmark rvav gv nextstate subst const unstack nextstate
58EOF
59} else {
60 $b=<<EOF;
61leave enter nextstate label leaveloop enterloop null and defined null
62null gvsv readline gv lineseq nextstate aassign null pushmark split pushre
63null gvsv const null pushmark rvav gv nextstate subst const unstack nextstate
64EOF
65}
66$b=~s/\n/ /g;$b=~s/\s+/ /g;
67$b =~ s/\s+$//;
68print "# [$a]\n# vs\n# [$b]\nnot " if $a ne $b;
69ok;
70