This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
porting/libperl.t: better diag output
authorDavid Mitchell <davem@iabyn.com>
Wed, 25 May 2016 17:50:10 +0000 (18:50 +0100)
committerDavid Mitchell <davem@iabyn.com>
Wed, 25 May 2016 18:33:42 +0000 (19:33 +0100)
when it complains about unexpected BSS symbols, list them

t/porting/libperl.t

index 161f716..9a1d362 100644 (file)
@@ -176,6 +176,7 @@ if (defined $fake_input) {
     }
     undef $nm_err_tmp; # In this case there will be no nm errors.
 } else {
+    print qq{# command: "$nm $nm_opt $libperl_a 2>$nm_err_tmp |"\n};
     open($nm_fh, "$nm $nm_opt $libperl_a 2>$nm_err_tmp |") or
         skip_all "$nm $nm_opt $libperl_a failed: $!";
 }
@@ -348,7 +349,13 @@ if ($GSP) {
     ok(!exists $data_symbols{PL_hash_seed}, "has no PL_hash_seed");
     ok(!exists $data_symbols{PL_ppaddr}, "has no PL_ppaddr");
 
-    ok(! exists $symbols{data}{bss}, "has no data bss symbols");
+    ok(! exists $symbols{data}{bss}, "has no data bss symbols")
+        or do {
+            my $bad = "BSS entries (there are supposed to be none):\n";
+            $bad .= "  bss sym: $_\n" for sort keys %{$symbols{data}{bss}};
+            diag($bad);
+        };
+
     ok(! exists $symbols{data}{data} ||
             # clang with ASAN seems to add this symbol to every object file:
             !grep($_ ne '__unnamed_1', keys %{$symbols{data}{data}}),
@@ -364,7 +371,13 @@ if ($GSP) {
     ok(!exists $data_symbols{PL_hash_seed}, "has no PL_hash_seed");
     ok(!exists $data_symbols{PL_ppaddr}, "has no PL_ppaddr");
 
-    ok(! exists $symbols{data}{bss}, "has no data bss symbols");
+    ok(! exists $symbols{data}{bss}, "has no data bss symbols")
+        or do {
+            my $bad = "BSS entries (there are supposed to be none):\n";
+            $bad .= "  bss sym: $_\n" for sort keys %{$symbols{data}{bss}};
+            diag($bad);
+        };
+
 
     # These PerlIO data symbols are left visible with
     # -DPERL_GLOBAL_STRUCT (as opposed to -DPERL_GLOBAL_STRUCT_PRIVATE)