File: 81-suppressions-demangle.t

package info (click to toggle)
libtest-valgrind-perl 1.19-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 424 kB
  • sloc: perl: 2,779; makefile: 22
file content (34 lines) | stat: -rw-r--r-- 1,100 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!perl -T

use strict;
use warnings;

BEGIN { delete $ENV{PATH} }

use Test::More tests => 2 * 7;

use Test::Valgrind::Suppressions;

my @Z_tests = (
 [ 'malloc'            => 'malloc', 'not encoded' ],
 [ '_vgrZU_VG_Z_dongs' => qr/Symbol with a "VG_Z_" prefix is invalid/, 'VG_Z' ],
 [ '_vgrZU_dongs'      => qr/Symbol doesn't contain a function name/,
                                                           'no function name' ],
 [ '_vgrZU_libcZdsoZa_malloc'   => 'malloc',   'soname encoded' ],
 [ '_vgrZU_libcZdsoZa_arZZZAel' => 'arZZZAel', 'soname encoded 2' ],
 [ '_vgrZZ_libcZdsoZa_arZZZAel' => 'arZ@el',   'function name encoded' ],
 [ '_vgrZZ_libcZdsoZa_arZdZXZa' => qr/Invalid escape sequence/,
                                         'function name with invalid escapes' ],
);

for (@Z_tests) {
 my ($sym, $exp, $desc) = @$_;
 my $res = eval { Test::Valgrind::Suppressions->maybe_z_demangle($sym) };
 if (ref $exp) {
  like $@,   $exp,  "$desc croaks as expected";
  is   $res, undef, $desc;
 } else {
  is $@,   '',   "$desc does not croak as expected";
  is $res, $exp, $desc;
 }
}