summaryrefslogtreecommitdiffstats
path: root/scripts/t
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/t')
-rw-r--r--scripts/t/Dpkg_Changelog.t486
-rw-r--r--scripts/t/Dpkg_Shlibs.t713
-rw-r--r--scripts/t/Dpkg_Shlibs/anglebrackets.cpp23
-rw-r--r--scripts/t/Dpkg_Shlibs/anglebrackets.symbols7
-rw-r--r--scripts/t/Dpkg_Shlibs/objdump.anglebrackets71
-rwxr-xr-xscripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl1
-rw-r--r--scripts/t/Dpkg_Shlibs_Cppfilt.t40
7 files changed, 834 insertions, 507 deletions
diff --git a/scripts/t/Dpkg_Changelog.t b/scripts/t/Dpkg_Changelog.t
index c3e7413..c4cc8b7 100644
--- a/scripts/t/Dpkg_Changelog.t
+++ b/scripts/t/Dpkg_Changelog.t
@@ -33,10 +33,10 @@ my $datadir = test_get_data_path();
my $vendor = get_current_vendor();
-#########################
-
-foreach my $file ("$datadir/countme", "$datadir/shadow", "$datadir/fields",
- "$datadir/regressions", "$datadir/date-format", "$datadir/stop-modeline") {
+sub setup_changelog
+{
+ my $name = shift;
+ my $file = "$datadir/$name";
my $changes = Dpkg::Changelog::Debian->new(verbose => 0);
$changes->load($file);
@@ -45,170 +45,208 @@ foreach my $file ("$datadir/countme", "$datadir/shadow", "$datadir/fields",
cmp_ok($content, 'eq', "$changes", "string output of Dpkg::Changelog on $file");
my $errors = $changes->get_parse_errors();
- my $basename = basename( $file );
- is($errors, '', "Parse example changelog $file without errors" );
+ my $basename = basename($file);
+ is($errors, '', "Parse example changelog $file without errors");
my @data = @$changes;
- ok(@data, 'data is not empty');
-
- if ($file eq "$datadir/countme") {
- # test range options
- cmp_ok(@data, '==', 7, 'no options -> count');
- my $all_versions = join( '/', map { $_->get_version() } @data);
-
- sub check_options {
- my (%opts) = @_;
-
- my @cnt = $changes->get_range($opts{range});
- cmp_ok(@cnt, '==', $opts{count}, "$opts{name} -> count");
- if ($opts{count} == @{$opts{data}}) {
- is_deeply(\@cnt, $opts{data}, "$opts{name} -> returns all");
- } else {
- is_deeply([ map { $_->get_version() } @cnt ],
- $opts{versions}, "$opts{name} -> versions" );
- }
- }
-
- my %ref = (
- changes => $changes,
- data => \@data,
- );
-
- check_options(%ref, range => { count => 3 },
- count => 3,
- versions => [ '2:2.0-1', '1:2.0~rc2-3', '1:2.0~rc2-2' ],
- name => 'positive count');
- check_options(%ref, range => { count => 3, reverse => 1 },
- count => 3,
- versions => [ '1:2.0~rc2-2', '1:2.0~rc2-3', '2:2.0-1' ],
- name => 'positive reverse count');
- check_options(%ref, range => { count => -3 },
- count => 3,
- versions => [
- '1:2.0~rc2-1sarge2',
- '1:2.0~rc2-1sarge1',
- '1.5-1',
- ],
- name => 'negative count');
- check_options(%ref, range => { count => 1 },
- count => 1,
- versions => [ '2:2.0-1' ],
- name => 'count 1');
- check_options(%ref, range => { count => 1, default_all => 1 },
- count => 1,
- versions => [ '2:2.0-1' ],
- name => 'count 1 (d_a 1)');
- check_options(%ref, range => { count => -1 },
- count => 1,
- versions => [ '1.5-1' ],
- name => 'count -1');
-
- check_options(%ref, range => { count => 3, offset => 2 },
- count => 3,
- versions => [
- '1:2.0~rc2-2',
- '1:2.0~rc2-1sarge3',
- '1:2.0~rc2-1sarge2',
- ],
- name => 'positive count + positive offset');
- check_options(%ref, range => { count => -3, offset => 4 },
- count => 3,
- versions => [
- '1:2.0~rc2-3',
- '1:2.0~rc2-2',
- '1:2.0~rc2-1sarge3',
- ],
- name => 'negative count + positive offset');
-
- check_options(%ref, range => { count => 4, offset => 5 },
- count => 2,
- versions => [ '1:2.0~rc2-1sarge1', '1.5-1' ],
- name => 'positive count + positive offset (>max)');
- check_options(%ref, range => { count => -4, offset => 2 },
- count => 2,
- versions => [ '2:2.0-1', '1:2.0~rc2-3' ],
- name => 'negative count + positive offset (<0)');
-
- check_options(%ref, range => { count => 3, offset => -4 },
- count => 3,
- versions => [
- '1:2.0~rc2-1sarge3',
- '1:2.0~rc2-1sarge2',
- '1:2.0~rc2-1sarge1',
- ],
- name => 'positive count + negative offset');
- check_options(%ref, range => { count => -3, offset => -3 },
- count => 3,
- versions => [
- '1:2.0~rc2-3',
- '1:2.0~rc2-2',
- '1:2.0~rc2-1sarge3',
- ],
- name => 'negative count + negative offset');
-
- check_options(%ref, range => { count => 5, offset => -2 },
- count => 2,
- versions => [ '1:2.0~rc2-1sarge1', '1.5-1' ],
- name => 'positive count + negative offset (>max)');
- check_options(%ref, range => { count => -5, offset => -4 },
- count => 3,
- versions => [ '2:2.0-1', '1:2.0~rc2-3', '1:2.0~rc2-2' ],
- name => 'negative count + negative offset (<0)');
-
- check_options(%ref, range => { count => 7 },
- count => 7,
- name => 'count 7 (max)');
- check_options(%ref, range => { count => -7 },
- count => 7,
- name => 'count -7 (-max)');
- check_options(%ref, range => { count => 10 },
- count => 7,
- name => 'count 10 (>max)');
- check_options(%ref, range => { count => -10 },
- count => 7,
- name => 'count -10 (<-max)');
-
- check_options(%ref, range => { from => '1:2.0~rc2-1sarge3' },
- count => 4,
- versions => [
- '2:2.0-1',
- '1:2.0~rc2-3',
- '1:2.0~rc2-2',
- '1:2.0~rc2-1sarge3',
- ],
- name => 'from => "1:2.0~rc2-1sarge3"');
- check_options(%ref, range => { since => '1:2.0~rc2-1sarge3' },
- count => 3,
- versions => [
- '2:2.0-1',
- '1:2.0~rc2-3',
- '1:2.0~rc2-2',
- ],
- name => 'since => "1:2.0~rc2-1sarge3"');
- $SIG{__WARN__} = sub {};
- check_options(%ref, range => { since => 0 },
- count => 7,
- name => 'since => 0 returns all');
- delete $SIG{__WARN__};
- check_options(%ref, range => { to => '1:2.0~rc2-1sarge2' },
- count => 3,
- versions => [
- '1:2.0~rc2-1sarge2',
- '1:2.0~rc2-1sarge1',
- '1.5-1',
- ],
- name => 'to => "1:2.0~rc2-1sarge2"');
- ## no critic (ControlStructures::ProhibitUntilBlocks)
- check_options(%ref, range => { until => '1:2.0~rc2-1sarge2' },
- count => 2,
- versions => [ '1:2.0~rc2-1sarge1', '1.5-1' ],
- name => 'until => "1:2.0~rc2-1sarge2"');
- ## use critic
- #TODO: test combinations
+ ok(@data, "data from $file is not empty");
+
+ SKIP: {
+ skip('avoid spurious warning with only one entry', 2)
+ if @data == 1;
+
+ my $str;
+ my $oldest_version = $data[-1]->{Version};
+ $str = $changes->format_range('dpkg', { since => $oldest_version });
+
+ $str = $changes->format_range('rfc822');
+
+ ok(1, 'TODO check rfc822 output');
+
+ $str = $changes->format_range('rfc822', { since => $oldest_version });
+
+ ok(1, 'TODO check rfc822 output with ranges');
+ }
+
+ return ($changes, \@data);
+}
+
+#########################
+
+my $changes;
+my $data;
+
+
+## File: countme
+
+($changes, $data) = setup_changelog('countme');
+
+# Test range options.
+cmp_ok(@{$data}, '==', 7, 'no options -> count');
+my $all_versions = join('/', map { $_->get_version() } @{$data});
+
+sub check_options {
+ my (%opts) = @_;
+
+ my @cnt = $changes->get_range($opts{range});
+ cmp_ok(@cnt, '==', $opts{count}, "$opts{name} -> count");
+ if ($opts{count} == @{$opts{data}}) {
+ is_deeply(\@cnt, $opts{data}, "$opts{name} -> returns all");
+ } else {
+ is_deeply([ map { $_->get_version() } @cnt ],
+ $opts{versions}, "$opts{name} -> versions");
}
- if ($file eq "$datadir/fields") {
- my $str = $changes->format_range('dpkg', { all => 1 });
- my $expected = 'Source: fields
+}
+
+my %ref = (
+ changes => $changes,
+ data => $data,
+);
+
+check_options(%ref, range => { count => 3 },
+ count => 3,
+ versions => [ '2:2.0-1', '1:2.0~rc2-3', '1:2.0~rc2-2' ],
+ name => 'positive count');
+check_options(%ref, range => { count => 3, reverse => 1 },
+ count => 3,
+ versions => [ '1:2.0~rc2-2', '1:2.0~rc2-3', '2:2.0-1' ],
+ name => 'positive reverse count');
+check_options(%ref, range => { count => -3 },
+ count => 3,
+ versions => [
+ '1:2.0~rc2-1sarge2',
+ '1:2.0~rc2-1sarge1',
+ '1.5-1',
+ ],
+ name => 'negative count');
+check_options(%ref, range => { count => 1 },
+ count => 1,
+ versions => [ '2:2.0-1' ],
+ name => 'count 1');
+check_options(%ref, range => { count => 1, default_all => 1 },
+ count => 1,
+ versions => [ '2:2.0-1' ],
+ name => 'count 1 (d_a 1)');
+check_options(%ref, range => { count => -1 },
+ count => 1,
+ versions => [ '1.5-1' ],
+ name => 'count -1');
+
+check_options(%ref, range => { count => 3, offset => 2 },
+ count => 3,
+ versions => [
+ '1:2.0~rc2-2',
+ '1:2.0~rc2-1sarge3',
+ '1:2.0~rc2-1sarge2',
+ ],
+ name => 'positive count + positive offset');
+check_options(%ref, range => { count => -3, offset => 4 },
+ count => 3,
+ versions => [
+ '1:2.0~rc2-3',
+ '1:2.0~rc2-2',
+ '1:2.0~rc2-1sarge3',
+ ],
+ name => 'negative count + positive offset');
+
+check_options(%ref, range => { count => 4, offset => 5 },
+ count => 2,
+ versions => [ '1:2.0~rc2-1sarge1', '1.5-1' ],
+ name => 'positive count + positive offset (>max)');
+check_options(%ref, range => { count => -4, offset => 2 },
+ count => 2,
+ versions => [ '2:2.0-1', '1:2.0~rc2-3' ],
+ name => 'negative count + positive offset (<0)');
+
+check_options(%ref, range => { count => 3, offset => -4 },
+ count => 3,
+ versions => [
+ '1:2.0~rc2-1sarge3',
+ '1:2.0~rc2-1sarge2',
+ '1:2.0~rc2-1sarge1',
+ ],
+ name => 'positive count + negative offset');
+check_options(%ref, range => { count => -3, offset => -3 },
+ count => 3,
+ versions => [
+ '1:2.0~rc2-3',
+ '1:2.0~rc2-2',
+ '1:2.0~rc2-1sarge3',
+ ],
+ name => 'negative count + negative offset');
+
+check_options(%ref, range => { count => 5, offset => -2 },
+ count => 2,
+ versions => [ '1:2.0~rc2-1sarge1', '1.5-1' ],
+ name => 'positive count + negative offset (>max)');
+check_options(%ref, range => { count => -5, offset => -4 },
+ count => 3,
+ versions => [ '2:2.0-1', '1:2.0~rc2-3', '1:2.0~rc2-2' ],
+ name => 'negative count + negative offset (<0)');
+
+check_options(%ref, range => { count => 7 },
+ count => 7,
+ name => 'count 7 (max)');
+check_options(%ref, range => { count => -7 },
+ count => 7,
+ name => 'count -7 (-max)');
+check_options(%ref, range => { count => 10 },
+ count => 7,
+ name => 'count 10 (>max)');
+check_options(%ref, range => { count => -10 },
+ count => 7,
+ name => 'count -10 (<-max)');
+
+check_options(%ref, range => { from => '1:2.0~rc2-1sarge3' },
+ count => 4,
+ versions => [
+ '2:2.0-1',
+ '1:2.0~rc2-3',
+ '1:2.0~rc2-2',
+ '1:2.0~rc2-1sarge3',
+ ],
+ name => 'from => "1:2.0~rc2-1sarge3"');
+check_options(%ref, range => { since => '1:2.0~rc2-1sarge3' },
+ count => 3,
+ versions => [
+ '2:2.0-1',
+ '1:2.0~rc2-3',
+ '1:2.0~rc2-2',
+ ],
+ name => 'since => "1:2.0~rc2-1sarge3"');
+$SIG{__WARN__} = sub {};
+check_options(%ref, range => { since => 0 },
+ count => 7,
+ name => 'since => 0 returns all');
+delete $SIG{__WARN__};
+check_options(%ref, range => { to => '1:2.0~rc2-1sarge2' },
+ count => 3,
+ versions => [
+ '1:2.0~rc2-1sarge2',
+ '1:2.0~rc2-1sarge1',
+ '1.5-1',
+ ],
+ name => 'to => "1:2.0~rc2-1sarge2"');
+## no critic (ControlStructures::ProhibitUntilBlocks)
+check_options(%ref, range => { until => '1:2.0~rc2-1sarge2' },
+ count => 2,
+ versions => [ '1:2.0~rc2-1sarge1', '1.5-1' ],
+ name => 'until => "1:2.0~rc2-1sarge2"');
+## use critic
+#TODO: test combinations
+
+
+## File: shadow
+
+($changes, $data) = setup_changelog('shadow');
+
+
+## File: fields
+
+($changes, $data) = setup_changelog('fields');
+
+ my $str = $changes->format_range('dpkg', { all => 1 });
+ my $expected = 'Source: fields
Version: 2.0-0etch1
Distribution: stable
Urgency: high
@@ -245,13 +283,13 @@ Xb-Userfield2: foobar
Xc-Userfield: foobar
';
- if ($vendor eq 'Ubuntu') {
- $expected =~ s/^(Closes:.*)/$1\nLaunchpad-Bugs-Fixed: 12345 54321 424242 2424242/m;
- }
- cmp_ok($str, 'eq', $expected, 'fields handling');
+ if ($vendor eq 'Ubuntu') {
+ $expected =~ s/^(Closes:.*)/$1\nLaunchpad-Bugs-Fixed: 12345 54321 424242 2424242/m;
+ }
+ cmp_ok($str, 'eq', $expected, 'fields handling');
- $str = $changes->format_range('dpkg', { offset => 1, count => 2 });
- $expected = 'Source: fields
+ $str = $changes->format_range('dpkg', { offset => 1, count => 2 });
+ $expected = 'Source: fields
Version: 2.0-1
Distribution: unstable frozen
Urgency: medium
@@ -278,13 +316,13 @@ Changes:
Xc-Userfield: foobar
';
- if ($vendor eq 'Ubuntu') {
- $expected =~ s/^(Closes:.*)/$1\nLaunchpad-Bugs-Fixed: 12345 424242/m;
- }
- cmp_ok($str, 'eq', $expected, 'fields handling 2');
+ if ($vendor eq 'Ubuntu') {
+ $expected =~ s/^(Closes:.*)/$1\nLaunchpad-Bugs-Fixed: 12345 424242/m;
+ }
+ cmp_ok($str, 'eq', $expected, 'fields handling 2');
- $str = $changes->format_range('rfc822', { offset => 2, count => 2 });
- $expected = 'Source: fields
+ $str = $changes->format_range('rfc822', { offset => 2, count => 2 });
+ $expected = 'Source: fields
Version: 2.0~b1-1
Distribution: unstable
Urgency: low
@@ -312,63 +350,59 @@ Changes:
Xb-Userfield2: foobar
';
- cmp_ok($str, 'eq', $expected, 'fields handling 3');
-
- # Test Dpkg::Changelog::Entry methods
- is($data[1]->get_version(), '2.0-1', 'get_version');
- is($data[1]->get_source(), 'fields', 'get_source');
- is(scalar $data[1]->get_distributions(), 'unstable', 'get_distribution');
- is(join('|', $data[1]->get_distributions()), 'unstable|frozen',
- 'get_distributions');
- is($data[3]->get_optional_fields(),
- "Urgency: high\nCloses: 1000000\nXb-Userfield2: foobar\n",
- 'get_optional_fields');
- is($data[1]->get_maintainer(), 'Frank Lichtenheld <djpig@debian.org>',
- 'get_maintainer');
- is($data[1]->get_timestamp(), 'Sun, 12 Jan 2008 15:49:19 +0100',
- 'get_timestamp');
- my @items = $data[1]->get_change_items();
- is($items[0], " [ Frank Lichtenheld ]\n", 'change items 1');
- is($items[4], ' * New upstream release.
+ cmp_ok($str, 'eq', $expected, 'fields handling 3');
+
+ # Test Dpkg::Changelog::Entry methods
+ is($data->[1]->get_version(), '2.0-1', 'get_version');
+ is($data->[1]->get_source(), 'fields', 'get_source');
+ is(scalar $data->[1]->get_distributions(), 'unstable', 'get_distribution');
+ is(join('|', $data->[1]->get_distributions()), 'unstable|frozen',
+ 'get_distributions');
+ is($data->[3]->get_optional_fields(),
+ "Urgency: high\nCloses: 1000000\nXb-Userfield2: foobar\n",
+ 'get_optional_fields');
+ is($data->[1]->get_maintainer(), 'Frank Lichtenheld <djpig@debian.org>',
+ 'get_maintainer');
+ is($data->[1]->get_timestamp(), 'Sun, 12 Jan 2008 15:49:19 +0100',
+ 'get_timestamp');
+ my @items = $data->[1]->get_change_items();
+ is($items[0], " [ Frank Lichtenheld ]\n", 'change items 1');
+ is($items[4], ' * New upstream release.
- implements a
- implements b
', 'change items 2');
- is($items[5], " * Update S-V.\n", 'change items 3');
- }
- if ($file eq "$datadir/date-format") {
- is($data[0]->get_timestamp(), '01 Jul 2100 23:59:59 -1200',
- 'get date w/o DoW, and negative timezone offset');
- is($data[1]->get_timestamp(), 'Tue, 27 Feb 2050 12:00:00 +1245',
- 'get date w/ DoW, and positive timezone offset');
- is($data[2]->get_timestamp(), 'Mon, 01 Jan 2000 00:00:00 +0000',
- 'get date w/ DoW, and zero timezone offset');
- }
- if ($file eq "$datadir/stop-modeline") {
- is($changes->get_unparsed_tail(), "vim: et\n",
- 'get unparsed modeline at EOF');
- }
- if ($file eq "$datadir/regressions") {
- my $f = ($changes->format_range('dpkg'))[0];
- is("$f->{Version}", '0', 'version 0 correctly parsed');
- }
+ is($items[5], " * Update S-V.\n", 'change items 3');
- SKIP: {
- skip('avoid spurious warning with only one entry', 2)
- if @data == 1;
- my $str;
- my $oldest_version = $data[-1]->{Version};
- $str = $changes->format_range('dpkg', { since => $oldest_version });
+## File: date-format
- $str = $changes->format_range('rfc822');
+($changes, $data) = setup_changelog('date-format');
- ok(1, 'TODO check rfc822 output');
+is($data->[0]->get_timestamp(), '01 Jul 2100 23:59:59 -1200',
+ 'get date w/o DoW, and negative timezone offset');
+is($data->[1]->get_timestamp(), 'Tue, 27 Feb 2050 12:00:00 +1245',
+ 'get date w/ DoW, and positive timezone offset');
+is($data->[2]->get_timestamp(), 'Mon, 01 Jan 2000 00:00:00 +0000',
+ 'get date w/ DoW, and zero timezone offset');
- $str = $changes->format_range('rfc822', { since => $oldest_version });
- ok(1, 'TODO check rfc822 output with ranges');
- }
-}
+## File: stop-modeline
+
+($changes, $data) = setup_changelog('stop-modeline');
+
+is($changes->get_unparsed_tail(), "vim: et\n",
+ 'get unparsed modeline at EOF');
+
+
+## File: regressions
+
+($changes, $data) = setup_changelog('regressions');
+
+my $f = ($changes->format_range('dpkg'))[0];
+is("$f->{Version}", '0', 'version 0 correctly parsed');
+
+
+## Files
foreach my $test (([ "$datadir/misplaced-tz", 6 ],
[ "$datadir/unreleased", 5, 7 ])) {
@@ -379,5 +413,5 @@ foreach my $test (([ "$datadir/misplaced-tz", 6 ],
my @errors = $changes->get_parse_errors();
ok(@errors, 'errors occured');
- is_deeply( [ map { $_->[1] } @errors ], $test, 'check line numbers' );
+ is_deeply([ map { $_->[1] } @errors ], $test, 'check line numbers');
}
diff --git a/scripts/t/Dpkg_Shlibs.t b/scripts/t/Dpkg_Shlibs.t
index 774f409..3430d54 100644
--- a/scripts/t/Dpkg_Shlibs.t
+++ b/scripts/t/Dpkg_Shlibs.t
@@ -40,6 +40,17 @@ my %tmp;
my $datadir = test_get_data_path();
+sub load_objdump_obj {
+ my $name = shift;
+
+ my $obj = Dpkg::Shlibs::Objdump::Object->new();
+ open my $objdump, '<', "$datadir/objdump.$name"
+ or die "$datadir/objdump.$name: $!";
+ $obj->parse_objdump_output($objdump);
+ close $objdump;
+ return $obj;
+}
+
my @librarypaths;
{
@@ -67,26 +78,23 @@ Dpkg::Shlibs::parse_ldso_conf('t/Dpkg_Shlibs/ld.so.conf');
chdir($cwd);
@librarypaths = Dpkg::Shlibs::get_library_paths();
-is_deeply(\@librarypaths,
- [ qw(/nonexistent32 /nonexistent/lib64
- /usr/local/lib /nonexistent/lib128) ], 'parsed library paths');
+is_deeply(\@librarypaths, [ qw(
+ /nonexistent32
+ /nonexistent/lib64
+ /usr/local/lib
+ /nonexistent/lib128
+ ) ],
+ 'parsed library paths');
use_ok('Dpkg::Shlibs::Objdump');
-my $obj = Dpkg::Shlibs::Objdump::Object->new;
+my $obj;
-open my $objdump, '<', "$datadir/objdump.dbd-pg"
- or die "$datadir/objdump.dbd-pg: $!";
-$obj->parse_objdump_output($objdump);
-close $objdump;
+$obj = load_objdump_obj('dbd-pg');
ok(!$obj->is_public_library(), 'Pg.so is not a public library');
ok(!$obj->is_executable(), 'Pg.so is not an executable');
-open $objdump, '<', "$datadir/objdump.ls"
- or die "$datadir/objdump.ls: $!";
-$obj->reset();
-$obj->parse_objdump_output($objdump);
-close $objdump;
+$obj = load_objdump_obj('ls');
ok(!$obj->is_public_library(), 'ls is not a public library');
ok($obj->is_executable(), 'ls is an executable');
@@ -94,22 +102,12 @@ my $sym = $obj->get_symbol('optarg@GLIBC_2.0');
ok($sym, 'optarg@GLIBC_2.0 exists');
ok(!$sym->{defined}, 'R_*_COPY relocations are taken into account');
-open $objdump, '<', "$datadir/objdump.space"
- or die "$datadir/objdump.space: $!";
-$obj->reset();
-$obj->parse_objdump_output($objdump);
-close $objdump;
-
# Non-regression test for #506139
+$obj = load_objdump_obj('space');
$sym = $obj->get_symbol('singlespace');
ok($sym, 'version less symbol separated by a single space are correctly parsed');
-open $objdump, '<', "$datadir/objdump.libc6-2.6"
- or die "$datadir/objdump.libc6-2.6: $!";
-$obj->reset();
-$obj->parse_objdump_output($objdump);
-close $objdump;
-
+$obj = load_objdump_obj('libc6-2.6');
ok($obj->is_public_library(), 'libc6 is a public library');
ok($obj->is_executable(), 'libc6 is an executable');
@@ -122,32 +120,46 @@ is_deeply($obj->{NEEDED}, [ 'ld-linux.so.2' ], 'NEEDED');
is_deeply([ $obj->get_needed_libraries ], [ 'ld-linux.so.2' ], 'NEEDED');
$sym = $obj->get_symbol('_sys_nerr@GLIBC_2.3');
-is_deeply( $sym, { name => '_sys_nerr', version => 'GLIBC_2.3',
- soname => 'libc.so.6', objid => 'libc.so.6',
- section => '.rodata', dynamic => 1,
- debug => '', type => 'O', weak => '',
- local => '', global => 1, visibility => '',
- hidden => 1, defined => 1 }, 'Symbol' );
+is_deeply($sym, {
+ name => '_sys_nerr',
+ version => 'GLIBC_2.3',
+ soname => 'libc.so.6',
+ objid => 'libc.so.6',
+ section => '.rodata',
+ dynamic => 1,
+ debug => '',
+ type => 'O',
+ weak => '',
+ local => '',
+ global => 1,
+ visibility => '',
+ hidden => 1,
+ defined => 1,
+ },
+ 'Symbol');
$sym = $obj->get_symbol('_IO_stdin_used');
-is_deeply( $sym, { name => '_IO_stdin_used', version => '',
- soname => 'libc.so.6', objid => 'libc.so.6',
- section => '*UND*', dynamic => 1,
- debug => '', type => ' ', weak => 1,
- local => '', global => '', visibility => '',
- hidden => '', defined => '' }, 'Symbol 2' );
+is_deeply($sym, {
+ name => '_IO_stdin_used',
+ version => '',
+ soname => 'libc.so.6',
+ objid => 'libc.so.6',
+ section => '*UND*',
+ dynamic => 1,
+ debug => '',
+ type => ' ',
+ weak => 1,
+ local => '',
+ global => '',
+ visibility => '',
+ hidden => '',
+ defined => '',
+ },
+ 'Symbol 2');
my @syms = $obj->get_exported_dynamic_symbols;
-is( scalar @syms, 2231, 'defined && dynamic' );
+is(scalar @syms, 2231, 'defined && dynamic');
@syms = $obj->get_undefined_dynamic_symbols;
-is( scalar @syms, 9, 'undefined && dynamic' );
-
-
-my $obj_old = Dpkg::Shlibs::Objdump::Object->new;
-
-open $objdump, '<', "$datadir/objdump.libc6-2.3"
- or die "$datadir/objdump.libc6-2.3: $!";
-$obj_old->parse_objdump_output($objdump);
-close $objdump;
+is(scalar @syms, 9, 'undefined && dynamic');
use_ok('Dpkg::Shlibs::SymbolFile');
@@ -157,36 +169,52 @@ my $sym_file = Dpkg::Shlibs::SymbolFile->new(file => "$datadir/symbol_file.tmp")
my $sym_file_dup = Dpkg::Shlibs::SymbolFile->new(file => "$datadir/symbol_file.tmp");
my $sym_file_old = Dpkg::Shlibs::SymbolFile->new(file => "$datadir/symbol_file.tmp");
+my $obj_old = load_objdump_obj('libc6-2.3');
+
$sym_file->merge_symbols($obj_old, '2.3.6.ds1-13');
$sym_file_old->merge_symbols($obj_old, '2.3.6.ds1-13');
-ok( $sym_file->has_object('libc.so.6'), 'SONAME in sym file' );
+ok($sym_file->has_object('libc.so.6'), 'SONAME in sym file');
$sym_file->merge_symbols($obj, '2.6-1');
-ok( $sym_file->get_new_symbols($sym_file_old), 'has new symbols' );
-ok( $sym_file_old->get_lost_symbols($sym_file), 'has lost symbols' );
+ok($sym_file->get_new_symbols($sym_file_old), 'has new symbols');
+ok($sym_file_old->get_lost_symbols($sym_file), 'has lost symbols');
-is( $sym_file_old->lookup_symbol('__bss_start@Base', ['libc.so.6']),
- undef, 'internal symbols are ignored' );
+is($sym_file_old->lookup_symbol('__bss_start@Base', ['libc.so.6']),
+ undef, 'internal symbols are ignored');
%tmp = $sym_file->lookup_symbol('_errno@GLIBC_2.0', ['libc.so.6'], 1);
isa_ok($tmp{symbol}, 'Dpkg::Shlibs::Symbol');
-is_deeply(\%tmp, { symbol => Dpkg::Shlibs::Symbol->new(symbol => '_errno@GLIBC_2.0',
- minver => '2.3.6.ds1-13', dep_id => 0,
- deprecated => '2.6-1'), soname => 'libc.so.6' },
- 'deprecated symbol');
+is_deeply(\%tmp, {
+ symbol => Dpkg::Shlibs::Symbol->new(
+ symbol => '_errno@GLIBC_2.0',
+ minver => '2.3.6.ds1-13',
+ dep_id => 0,
+ deprecated => '2.6-1',
+ ),
+ soname => 'libc.so.6'
+ },
+ 'deprecated symbol');
# Wildcard test
my $pat = $sym_file_old->create_symbol('*@GLIBC_PRIVATE 2.3.6.wildcard');
$sym_file_old->add_symbol($pat, 'libc.so.6');
$sym_file_old->merge_symbols($obj, '2.6-1');
$sym = $sym_file_old->lookup_symbol('__nss_services_lookup@GLIBC_PRIVATE', 'libc.so.6');
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => '__nss_services_lookup@GLIBC_PRIVATE',
- minver => '2.3.6.wildcard', dep_id => 0, deprecated => 0,
- tags => { symver => undef, optional => undef },
- tagorder => [ 'symver', 'optional' ],
- matching_pattern => $pat ), 'wildcarded symbol');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => '__nss_services_lookup@GLIBC_PRIVATE',
+ minver => '2.3.6.wildcard',
+ dep_id => 0,
+ deprecated => 0,
+ tags => {
+ symver => undef,
+ optional => undef,
+ },
+ tagorder => [ 'symver', 'optional' ],
+ matching_pattern => $pat,
+ ),
+ 'wildcarded symbol');
# Save -> Load test
use File::Temp;
@@ -209,24 +237,24 @@ sub save_load_test {
}
}
-save_load_test( $sym_file, 'save -> load' );
+save_load_test($sym_file, 'save -> load');
# Test ignoring internal symbols
-open $objdump, '<', "$datadir/objdump.internal"
- or die "objdump.internal: $!";
-$obj->reset();
-$obj->parse_objdump_output($objdump);
-close $objdump;
+$obj = load_objdump_obj('internal');
# Do not ignore any internal symbols
$sym_file = Dpkg::Shlibs::SymbolFile->new(file => "$datadir/symbols.internal-filter");
$sym_file->merge_symbols($obj, '100.MISSING');
$sym = $sym_file->lookup_symbol('symbol@Base', ['libinternal.so.0']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol@Base',
- minver => '1.0', dep_id => 0, deprecated => 0),
- 'symbol unaffected w/o including internal symbols');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol@Base',
+ minver => '1.0',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'symbol unaffected w/o including internal symbols');
$sym = $sym_file->lookup_symbol('.gomp_critical_user_foo@Base', ['libinternal.so.0']);
is($sym, undef, 'gomp symbol omitted while filtering internal symbols');
@@ -242,96 +270,158 @@ $sym_file = Dpkg::Shlibs::SymbolFile->new(file => "$datadir/symbols.internal-all
$sym_file->merge_symbols($obj, '100.MISSING');
$sym = $sym_file->lookup_symbol('symbol@Base', ['libinternal.so.0']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol@Base',
- minver => '1.0', dep_id => 0, deprecated => 0),
- 'symbol unaffected while including internal symbols via symbol tag');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol@Base',
+ minver => '1.0',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'symbol unaffected while including internal symbols via symbol tag');
$sym = $sym_file->lookup_symbol('.gomp_critical_user_foo@Base', ['libinternal.so.0']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => '.gomp_critical_user_foo@Base',
- minver => '2.0', dep_id => 0, deprecated => 0,
- tags => { 'allow-internal' => undef },
- tagorder => [ 'allow-internal' ]),
- 'internal gomp symbol included via symbol tag');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => '.gomp_critical_user_foo@Base',
+ minver => '2.0',
+ dep_id => 0,
+ deprecated => 0,
+ tags => {
+ 'allow-internal' => undef,
+ },
+ tagorder => [ 'allow-internal' ],
+ ),
+ 'internal gomp symbol included via symbol tag');
$sym = $sym_file->lookup_symbol('__aeabi_lcmp@GCC_3.0', ['libinternal.so.0']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => '__aeabi_lcmp@GCC_3.0',
- minver => '3.0', dep_id => 0, deprecated => 0,
- tags => { 'allow-internal' => undef },
- tagorder => [ 'allow-internal' ]),
- 'internal known aeabi symbol included via symbol tag');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => '__aeabi_lcmp@GCC_3.0',
+ minver => '3.0',
+ dep_id => 0,
+ deprecated => 0,
+ tags => {
+ 'allow-internal' => undef,
+ },
+ tagorder => [ 'allow-internal' ],
+ ),
+ 'internal known aeabi symbol included via symbol tag');
$sym = $sym_file->lookup_symbol('__aeabi_unknown@GCC_4.0', ['libinternal.so.0']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => '__aeabi_unknown@GCC_4.0',
- minver => '4.0', dep_id => 0, deprecated => 0,
- tags => { 'allow-internal' => undef },
- tagorder => [ 'allow-internal' ]),
- 'internal unknown aeabi symbol omitted via symbol tag');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => '__aeabi_unknown@GCC_4.0',
+ minver => '4.0',
+ dep_id => 0,
+ deprecated => 0,
+ tags => {
+ 'allow-internal' => undef,
+ },
+ tagorder => [ 'allow-internal' ],
+ ),
+ 'internal unknown aeabi symbol omitted via symbol tag');
# Include internal symbols using the Allow-Internal-Symbol-Groups field
$sym_file = Dpkg::Shlibs::SymbolFile->new(file => "$datadir/symbols.internal-allow-groups");
$sym_file->merge_symbols($obj, '100.MISSING');
$sym = $sym_file->lookup_symbol('symbol@Base', ['libinternal.so.0']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol@Base',
- minver => '1.0', dep_id => 0, deprecated => 0),
- 'symbol unaffected w/o including internal symbols');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol@Base',
+ minver => '1.0',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'symbol unaffected w/o including internal symbols');
$sym = $sym_file->lookup_symbol('.gomp_critical_user_foo@Base', ['libinternal.so.0']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => '.gomp_critical_user_foo@Base',
- minver => '2.0', dep_id => 0, deprecated => 0),
- 'internal gomp symbol included via library field');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => '.gomp_critical_user_foo@Base',
+ minver => '2.0',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'internal gomp symbol included via library field');
$sym = $sym_file->lookup_symbol('__aeabi_lcmp@GCC_3.0', ['libinternal.so.0']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => '__aeabi_lcmp@GCC_3.0',
- minver => '3.0', dep_id => 0, deprecated => 0),
- 'internal known aeabi symbol included via library field');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => '__aeabi_lcmp@GCC_3.0',
+ minver => '3.0',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'internal known aeabi symbol included via library field');
$sym = $sym_file->lookup_symbol('__aeabi_unknown@GCC_4.0', ['libinternal.so.0']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => '__aeabi_unknown@GCC_4.0',
- minver => '4.0', dep_id => 0, deprecated => 0),
- 'internal unknown aeabi symbol included via library field');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => '__aeabi_unknown@GCC_4.0',
+ minver => '4.0',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'internal unknown aeabi symbol included via library field');
# Test include mechanism of SymbolFile
$sym_file = Dpkg::Shlibs::SymbolFile->new(file => "$datadir/symbols.include-1");
$sym = $sym_file->lookup_symbol('symbol_before@Base', ['libfake.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol_before@Base',
- minver => '0.9', dep_id => 0, deprecated => 0),
- 'symbol before include not lost');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol_before@Base',
+ minver => '0.9',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'symbol before include not lost');
$sym = $sym_file->lookup_symbol('symbol_after@Base', ['libfake.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol_after@Base',
- minver => '1.1', dep_id => 0, deprecated => 0),
- 'symbol after include not lost');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol_after@Base',
+ minver => '1.1',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'symbol after include not lost');
$sym = $sym_file->lookup_symbol('symbol1_fake1@Base', ['libfake.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol1_fake1@Base',
- minver => '1.0', dep_id => 0, deprecated => 0),
- 'overrides order with #include');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol1_fake1@Base',
+ minver => '1.0',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'overrides order with #include');
$sym = $sym_file->lookup_symbol('symbol3_fake1@Base', ['libfake.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol3_fake1@Base',
- minver => '0', dep_id => 0, deprecated => 0),
- 'overrides order with #include');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol3_fake1@Base',
+ minver => '0',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'overrides order with #include');
is($sym_file->get_smallest_version('libfake.so.1'), '0',
- 'get_smallest_version with null version');
+ 'get_smallest_version with null version');
$sym = $sym_file->lookup_symbol('symbol_in_libdivert@Base', ['libdivert.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol_in_libdivert@Base',
- minver => '1.0~beta1', dep_id => 0, deprecated => 0),
- '#include can change current object');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol_in_libdivert@Base',
+ minver => '1.0~beta1',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ '#include can change current object');
$sym_file = Dpkg::Shlibs::SymbolFile->new(file => "$datadir/symbols.include-2");
$sym = $sym_file->lookup_symbol('symbol1_fake2@Base', ['libfake.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol1_fake2@Base',
- minver => '1.0', dep_id => 1, deprecated => 0),
- 'overrides order with circular #include');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol1_fake2@Base',
+ minver => '1.0',
+ dep_id => 1,
+ deprecated => 0,
+ ),
+ 'overrides order with circular #include');
is($sym_file->get_smallest_version('libfake.so.1'), '1.0',
- 'get_smallest_version');
+ 'get_smallest_version');
my $io_data;
my $io;
@@ -351,46 +441,55 @@ is($io_data,
# Check parsing of objdump output on ia64 (local symbols
# without versions and with visibility attribute)
-$obj = Dpkg::Shlibs::Objdump::Object->new;
-
-open $objdump, '<', "$datadir/objdump.glib-ia64"
- or die "$datadir/objdump.glib-ia64: $!";
-$obj->parse_objdump_output($objdump);
-close $objdump;
+$obj = load_objdump_obj('glib-ia64');
ok($obj->is_public_library(), 'glib-ia64 is a public library');
ok(!$obj->is_executable(), 'glib-ia64 is not an executable');
$sym = $obj->get_symbol('IA__g_free');
-is_deeply( $sym, { name => 'IA__g_free', version => '',
- soname => 'libglib-2.0.so.0', objid => 'libglib-2.0.so.0',
- section => '.text', dynamic => 1,
- debug => '', type => 'F', weak => '',
- local => 1, global => '', visibility => 'hidden',
- hidden => '', defined => 1 },
- 'symbol with visibility without version' );
+is_deeply($sym, {
+ name => 'IA__g_free', version => '',
+ soname => 'libglib-2.0.so.0',
+ objid => 'libglib-2.0.so.0',
+ section => '.text',
+ dynamic => 1,
+ debug => '',
+ type => 'F',
+ weak => '',
+ local => 1,
+ global => '',
+ visibility => 'hidden',
+ hidden => '',
+ defined => 1,
+ },
+ 'symbol with visibility without version');
# Check parsing of objdump output when symbol names contain spaces
-$obj = Dpkg::Shlibs::Objdump::Object->new;
-
-open $objdump, '<', "$datadir/objdump.spacesyms"
- or die "$datadir/objdump.spacesyms: $!";
-$obj->parse_objdump_output($objdump);
-close $objdump;
+$obj = load_objdump_obj('spacesyms');
sub check_spacesym {
my ($name, $version, $visibility) = @_;
$visibility //= '';
$sym = $obj->get_symbol($name . "@" . $version);
- is_deeply($sym, { name => $name, version => $version,
- soname => 'libspacesyms.so.1',
- objid => 'libspacesyms.so.1',
- section => '.text', dynamic => 1,
- debug => '', type => 'F', weak => '',
- local => '', global => 1, visibility => $visibility,
- hidden => '', defined => 1 }, $name);
+ is_deeply($sym, {
+ name => $name,
+ version => $version,
+ soname => 'libspacesyms.so.1',
+ objid => 'libspacesyms.so.1',
+ section => '.text',
+ dynamic => 1,
+ debug => '',
+ type => 'F',
+ weak => '',
+ local => '',
+ global => 1,
+ visibility => $visibility,
+ hidden => '',
+ defined => 1,
+ },
+ $name);
ok(defined $obj->{dynrelocs}{$name . "@@" . $version},
- "dynreloc found for $name");
+ "dynreloc found for $name");
}
check_spacesym('symdefaultvernospacedefault', 'Base');
@@ -461,23 +560,15 @@ is($io_data,
symbol51_untagged@Base 5.1
', 'template vs. non-template on i386');
-ok (defined $sym_file->{objects}{'libbasictags.so.1'}{syms}{'symbol21_amd64@Base'},
- 'syms keys are symbol names without quotes');
+ok(defined $sym_file->{objects}{'libbasictags.so.1'}{syms}{'symbol21_amd64@Base'},
+ 'syms keys are symbol names without quotes');
# Preload objdumps
-my $tags_obj_i386 = Dpkg::Shlibs::Objdump::Object->new();
-open $objdump, '<', "$datadir/objdump.basictags-i386"
- or die "$datadir/objdump.basictags-i386: $!";
-$tags_obj_i386->parse_objdump_output($objdump);
-close $objdump;
+my $tags_obj_i386 = load_objdump_obj('basictags-i386');
$sym_file->merge_symbols($tags_obj_i386, '100.MISSING');
is_deeply($sym_file, $sym_file_dup, 'is objdump.basictags-i386 and basictags.symbols in sync');
-my $tags_obj_amd64 = Dpkg::Shlibs::Objdump::Object->new();
-open $objdump, '<', "$datadir/objdump.basictags-amd64"
- or die "$datadir/objdump.basictags-amd64: $!";
-$tags_obj_amd64->parse_objdump_output($objdump);
-close $objdump;
+my $tags_obj_amd64 = load_objdump_obj('basictags-amd64');
# Merge/get_{new,lost} tests for optional tag:
# - disappeared
@@ -486,33 +577,56 @@ delete $tags_obj_i386->{dynsyms}{'symbol11_optional@Base'};
$sym_file->merge_symbols($tags_obj_i386, '100.MISSING');
$sym = $sym_file->lookup_symbol('symbol11_optional@Base', ['libbasictags.so.1'], 1);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol11_optional@Base',
- symbol_templ => 'symbol11_optional@Base',
- minver => '1.1', dep_id => 1, deprecated => '100.MISSING',
- tags => { optional => undef }, tagorder => [ 'optional' ]),
- 'disappeared optional symbol gets deprecated');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol11_optional@Base',
+ symbol_templ => 'symbol11_optional@Base',
+ minver => '1.1',
+ dep_id => 1,
+ deprecated => '100.MISSING',
+ tags => {
+ optional => undef,
+ },
+ tagorder => [ 'optional' ],
+ ),
+ 'disappeared optional symbol gets deprecated');
$sym_file->merge_symbols($tags_obj_i386, '101.MISSING');
$sym = $sym_file->lookup_symbol('symbol11_optional@Base', ['libbasictags.so.1'], 1);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol11_optional@Base',
- symbol_templ => 'symbol11_optional@Base',
- minver => '1.1', dep_id => 1, deprecated => '101.MISSING',
- tags => { optional => undef }, tagorder => [ 'optional' ]),
- 'deprecated text of MISSING optional symbol gets rebumped each merge');
-
-is( scalar($sym_file->get_lost_symbols($sym_file_dup)), 0, 'missing optional symbol is not LOST');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol11_optional@Base',
+ symbol_templ => 'symbol11_optional@Base',
+ minver => '1.1',
+ dep_id => 1,
+ deprecated => '101.MISSING',
+ tags => {
+ optional => undef,
+ },
+ tagorder => [ 'optional' ],
+ ),
+ 'deprecated text of MISSING optional symbol gets rebumped each merge');
+
+is(scalar($sym_file->get_lost_symbols($sym_file_dup)), 0,
+ 'missing optional symbol is not LOST');
# - reappeared (undeprecate, minver should be 1.1, not 100.MISSED)
$tags_obj_i386->add_dynamic_symbol($symbol11);
$sym_file->merge_symbols($tags_obj_i386, '100.MISSING');
$sym = $sym_file->lookup_symbol('symbol11_optional@Base', ['libbasictags.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol11_optional@Base',
- symbol_templ => 'symbol11_optional@Base',
- minver => '1.1', dep_id => 1, deprecated => 0,
- tags => { optional => undef }, tagorder => [ 'optional' ]),
- 'reappeared optional symbol gets undeprecated + minver');
-is( scalar($sym_file->get_lost_symbols($sym_file_dup) +
- $sym_file->get_new_symbols($sym_file_dup)), 0, 'reappeared optional symbol: neither NEW nor LOST');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol11_optional@Base',
+ symbol_templ => 'symbol11_optional@Base',
+ minver => '1.1',
+ dep_id => 1,
+ deprecated => 0,
+ tags => {
+ optional => undef,
+ },
+ tagorder => [ 'optional' ],
+ ),
+ 'reappeared optional symbol gets undeprecated + minver');
+is(scalar($sym_file->get_lost_symbols($sym_file_dup) +
+ $sym_file->get_new_symbols($sym_file_dup)), 0,
+ 'reappeared optional symbol: neither NEW nor LOST');
# Merge/get_{new,lost} tests for arch tag:
# - arch specific appears on wrong arch: 'arch' tag should be removed
@@ -520,13 +634,19 @@ my $symbol21 = $tags_obj_amd64->get_symbol('symbol21_amd64@Base');
$tags_obj_i386->add_dynamic_symbol($symbol21);
$sym_file->merge_symbols($tags_obj_i386, '100.MISSING');
$sym = $sym_file->lookup_symbol('symbol21_amd64@Base', ['libbasictags.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol21_amd64@Base',
- symbol_templ => 'symbol21_amd64@Base', symbol_quoted => "'",
- minver => '2.1', dep_id => 0, deprecated => 0),
- 'symbol appears on foreign arch, arch tag should be removed');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol21_amd64@Base',
+ symbol_templ => 'symbol21_amd64@Base',
+ symbol_quoted => "'",
+ minver => '2.1',
+ dep_id => 0,
+ deprecated => 0,
+ ),
+ 'symbol appears on foreign arch, arch tag should be removed');
@tmp = map { $_->{symbol}->get_symbolname() } $sym_file->get_new_symbols($sym_file_dup);
-is_deeply( \@tmp, [ 'symbol21_amd64@Base' ], 'symbol from foreign arch is NEW');
-is( $sym->get_symbolspec(1), ' symbol21_amd64@Base 2.1', 'no tags => no quotes in the symbol name' );
+is_deeply(\@tmp, [ 'symbol21_amd64@Base' ], 'symbol from foreign arch is NEW');
+is($sym->get_symbolspec(1), ' symbol21_amd64@Base 2.1',
+ 'no tags => no quotes in the symbol name');
# - arch specific symbol disappears
delete $tags_obj_i386->{dynsyms}{'symbol22_i386@Base'};
@@ -537,76 +657,134 @@ delete $tags_obj_i386->{dynsyms}{'symbol41_i386_and_optional@Base'};
$sym_file->merge_symbols($tags_obj_i386, '100.MISSING');
$sym = $sym_file->lookup_symbol('symbol22_i386@Base', ['libbasictags.so.1'], 1);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol22_i386@Base',
- symbol_templ => 'symbol22_i386@Base',
- minver => '2.2', dep_id => 0, deprecated => '100.MISSING',
- tags => { arch => '!amd64 !ia64 !mips' },
- tagorder => [ 'arch' ]),
- 'disappeared arch specific symbol gets deprecated');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol22_i386@Base',
+ symbol_templ => 'symbol22_i386@Base',
+ minver => '2.2',
+ dep_id => 0,
+ deprecated => '100.MISSING',
+ tags => {
+ arch => '!amd64 !ia64 !mips',
+ },
+ tagorder => [ 'arch' ],
+ ),
+ 'disappeared arch specific symbol gets deprecated');
$sym = $sym_file->lookup_symbol('symbol24_32@Base', ['libbasictags.so.1'], 1);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol24_32@Base',
- symbol_templ => 'symbol24_32@Base',
- minver => '2.4', dep_id => 0, deprecated => '100.MISSING',
- tags => { 'arch-bits' => '32' },
- tagorder => [ 'arch-bits' ]),
- 'disappeared arch bits specific symbol gets deprecated');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol24_32@Base',
+ symbol_templ => 'symbol24_32@Base',
+ minver => '2.4',
+ dep_id => 0,
+ deprecated => '100.MISSING',
+ tags => {
+ 'arch-bits' => '32',
+ },
+ tagorder => [ 'arch-bits' ],
+ ),
+ 'disappeared arch bits specific symbol gets deprecated');
$sym = $sym_file->lookup_symbol('symbol26_little@Base', ['libbasictags.so.1'], 1);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol26_little@Base',
- symbol_templ => 'symbol26_little@Base',
- minver => '2.6', dep_id => 0, deprecated => '100.MISSING',
- tags => { 'arch-endian' => 'little' },
- tagorder => [ 'arch-endian' ]),
- 'disappeared arch endian specific symbol gets deprecated');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol26_little@Base',
+ symbol_templ => 'symbol26_little@Base',
+ minver => '2.6',
+ dep_id => 0,
+ deprecated => '100.MISSING',
+ tags => {
+ 'arch-endian' => 'little',
+ },
+ tagorder => [ 'arch-endian' ],
+ ),
+ 'disappeared arch endian specific symbol gets deprecated');
$sym = $sym_file->lookup_symbol('symbol28_little_32@Base', ['libbasictags.so.1'], 1);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol28_little_32@Base',
- symbol_templ => 'symbol28_little_32@Base',
- minver => '2.8', dep_id => 0, deprecated => '100.MISSING',
- tags => { 'arch-bits' => '32', 'arch-endian' => 'little' },
- tagorder => [ 'arch-bits', 'arch-endian' ]),
- 'disappeared arch bits and endian specific symbol gets deprecated');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol28_little_32@Base',
+ symbol_templ => 'symbol28_little_32@Base',
+ minver => '2.8',
+ dep_id => 0,
+ deprecated => '100.MISSING',
+ tags => {
+ 'arch-bits' => '32',
+ 'arch-endian' => 'little',
+ },
+ tagorder => [ 'arch-bits', 'arch-endian' ],
+ ),
+ 'disappeared arch bits and endian specific symbol gets deprecated');
$sym = $sym_file->lookup_symbol('symbol41_i386_and_optional@Base', ['libbasictags.so.1'], 1);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol41_i386_and_optional@Base',
- symbol_templ => 'symbol41_i386_and_optional@Base',
- symbol_quoted => '"',
- minver => '4.1', dep_id => 0, deprecated => '100.MISSING',
- tags => { arch => 'i386', optional => 'reason' },
- tagorder => [ 'arch', 'optional' ]),
- 'disappeared optional arch specific symbol gets deprecated');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol41_i386_and_optional@Base',
+ symbol_templ => 'symbol41_i386_and_optional@Base',
+ symbol_quoted => '"',
+ minver => '4.1',
+ dep_id => 0,
+ deprecated => '100.MISSING',
+ tags => {
+ arch => 'i386',
+ optional => 'reason',
+ },
+ tagorder => [ 'arch', 'optional' ],
+ ),
+ 'disappeared optional arch specific symbol gets deprecated');
@tmp = sort map { $_->{symbol}->get_symbolname() } $sym_file->get_lost_symbols($sym_file_dup);
-is_deeply(\@tmp, [ 'symbol22_i386@Base', 'symbol24_32@Base',
- 'symbol26_little@Base', 'symbol28_little_32@Base' ],
- "missing arch specific is LOST, but optional arch specific isn't");
+is_deeply(\@tmp, [
+ 'symbol22_i386@Base',
+ 'symbol24_32@Base',
+ 'symbol26_little@Base',
+ 'symbol28_little_32@Base',
+ ],
+ "missing arch specific is LOST, but optional arch specific isn't");
# Tests for tagged #includes
$sym_file = Dpkg::Shlibs::SymbolFile->new(file => "$datadir/symbols.include-3", arch => 'i386');
$sym = $sym_file->lookup_symbol('symbol2_fake1@Base', ['libbasictags.so.2']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol2_fake1@Base',
- minver => '1.0',
- tags => { optional => undef, 'random tag' => 'random value' },
- tagorder => [ 'optional', 'random tag' ] ),
- 'symbols from #included file inherits tags');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol2_fake1@Base',
+ minver => '1.0',
+ tags => {
+ optional => undef,
+ 'random tag' => 'random value',
+ },
+ tagorder => [ 'optional', 'random tag' ],
+ ),
+ 'symbols from #included file inherits tags');
$sym = $sym_file->lookup_symbol('symbol41_i386_and_optional@Base', ['libbasictags.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol41_i386_and_optional@Base',
- symbol_templ => 'symbol41_i386_and_optional@Base',
- symbol_quoted => '"',
- minver => '4.1',
- tags => { optional => 'reason', t => 'v', arch => 'i386' },
- tagorder => [ 'optional', 't', 'arch' ]),
- 'symbols in #included file can override tag values');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol41_i386_and_optional@Base',
+ symbol_templ => 'symbol41_i386_and_optional@Base',
+ symbol_quoted => '"',
+ minver => '4.1',
+ tags => {
+ optional => 'reason',
+ t => 'v',
+ arch => 'i386',
+ },
+ tagorder => [ 'optional', 't', 'arch' ],
+ ),
+ 'symbols in #included file can override tag values');
$sym = $sym_file->lookup_symbol('symbol51_untagged@Base', ['libbasictags.so.1']);
-is_deeply($sym, Dpkg::Shlibs::Symbol->new(symbol => 'symbol51_untagged@Base',
- minver => '5.1',
- tags => { optional => 'from parent', t => 'v' },
- tagorder => [ 'optional', 't' ]),
- 'symbols are properly cloned when #including');
+is_deeply($sym, Dpkg::Shlibs::Symbol->new(
+ symbol => 'symbol51_untagged@Base',
+ minver => '5.1',
+ tags => {
+ optional => 'from parent',
+ t => 'v',
+ },
+ tagorder => [ 'optional', 't' ],
+ ),
+ 'symbols are properly cloned when #including');
# Test Symbol::clone()
-$sym = Dpkg::Shlibs::Symbol->new(symbol => 'foobar', testfield => 1, teststruct => { foo => 1 });
+$sym = Dpkg::Shlibs::Symbol->new(
+ symbol => 'foobar',
+ testfield => 1,
+ teststruct => {
+ foo => 1,
+ },
+);
$tmp = $sym->clone();
$tmp->{teststruct}{foo} = 3;
$tmp->{testfield} = 3;
-is ( $sym->{teststruct}{foo}, 1, 'original field "foo" not changed' );
-is ( $sym->{testfield}, 1, 'original field "testfield" not changed' );
+is($sym->{teststruct}{foo}, 1, 'original field "foo" not changed');
+is($sym->{testfield}, 1, 'original field "testfield" not changed');
############ Test symbol patterns ###########
@@ -615,11 +793,7 @@ SKIP: {
skip 'c++filt not available', 41 if not can_run('c++filt');
sub load_patterns_obj {
- $obj = Dpkg::Shlibs::Objdump::Object->new();
- open $objdump, '<', "$datadir/objdump.patterns"
- or die "$datadir/objdump.patterns: $!";
- $obj->parse_objdump_output($objdump);
- close $objdump;
+ $obj = load_objdump_obj('patterns');
return $obj;
}
@@ -634,7 +808,7 @@ load_patterns_symbols();
save_load_test($sym_file, 'save -> load test of patterns template', template_mode => 1);
-isnt( $sym_file->get_patterns('libpatterns.so.1') , 0,
+isnt($sym_file->get_patterns('libpatterns.so.1'), 0,
'patterns.symbols has patterns');
$sym_file->merge_symbols($obj, '100.MISSING');
@@ -654,12 +828,13 @@ is($sym->{minver}, '1.method1', 'specific symbol preferred over pattern');
$sym = $sym_file->lookup_symbol('_ZN3NSB6Symver14symver_method2Ev@SYMVER_1', 'libpatterns.so.1');
is($sym->{minver}, '1.method2', 'c++ alias pattern preferred over generic pattern');
is($sym->get_pattern()->get_symbolname(), 'NSB::Symver::symver_method2()@SYMVER_1',
- 'c++ alias pattern preferred over generic pattern, on demangled name');
+ 'c++ alias pattern preferred over generic pattern, on demangled name');
$sym = $sym_file->lookup_symbol('_ZN3NSB6SymverD1Ev@SYMVER_1', 'libpatterns.so.1');
-is ( $sym->{minver}, '1.generic', 'generic (c++ & symver) pattern covers the rest (destructor)' );
+is($sym->{minver}, '1.generic',
+ 'generic (c++ & symver) pattern covers the rest (destructor)');
ok($sym->get_pattern()->equals($sym_file->create_symbol('(c++|symver)SYMVER_1 1.generic')),
- 'generic (c++ & symver) pattern covers the rest (destructor), compared');
+ 'generic (c++ & symver) pattern covers the rest (destructor), compared');
# Test old style wildcard support
load_patterns_symbols();
@@ -674,10 +849,10 @@ is_deeply($pat, $sym, 'old style wildcard is the same as (symver|optional)');
# Get rid of all SymverOptional symbols
foreach my $tmp (keys %{$obj->{dynsyms}}) {
- delete $obj->{dynsyms}{$tmp} if ($tmp =~ /SymverOptional/);
+ delete $obj->{dynsyms}{$tmp} if $tmp =~ /SymverOptional/;
}
$sym_file->merge_symbols($obj, '100.MISSING');
-is_deeply ( [ map { $_->get_symbolname() } $pat->get_pattern_matches() ],
+is_deeply([ map { $_->get_symbolname() } $pat->get_pattern_matches() ],
[], 'old style wildcard matches nothing.');
is($pat->{deprecated}, '100.MISSING', 'old style wildcard gets deprecated.');
@tmp = map { $_->{symbol}->get_symbolname() } $sym_file->get_lost_symbols($sym_file_dup);
@@ -688,7 +863,7 @@ load_patterns_obj();
@tmp = grep { $_->get_symbolname() =~ /Internal/ } $sym_file->get_symbols('libpatterns.so.1');
$sym = $sym_file->create_symbol('(regex|c++)^_Z(T[ISV])?N3NSA6ClassA8Internal.*@Base$ 1.internal');
$pat = $sym_file->lookup_pattern($sym, 'libpatterns.so.1');
-is_deeply ([ sort $pat->get_pattern_matches() ], [ sort @tmp ],
+is_deeply([ sort $pat->get_pattern_matches() ], [ sort @tmp ],
'Pattern covers all internal symbols');
is($tmp[0]->{minver}, '1.internal', 'internal pattern covers first symbol');
@@ -707,13 +882,13 @@ my @private_symnames = sort qw(
);
$sym = $sym_file->create_symbol('(c++|regex|optional)NSA::ClassA::Private(::.*)?@Base 1');
$pat = $sym_file->lookup_pattern($sym, 'libpatterns.so.1');
-isnt( $pat, undef, 'pattern for private class has been found' );
-is_deeply( [ sort map { $_->get_symbolname() } $pat->get_pattern_matches() ],
+isnt($pat, undef, 'pattern for private class has been found');
+is_deeply([ sort map { $_->get_symbolname() } $pat->get_pattern_matches() ],
\@private_symnames, 'private pattern matched expected symbols');
-ok( ($pat->get_pattern_matches())[0]->is_optional(),
- 'private symbol is optional like its pattern');
-ok( $sym_file->lookup_symbol(($pat->get_pattern_matches())[0], 'libpatterns.so.1'),
- 'lookup_symbol() finds symbols matched by pattern (after merge)');
+ok(($pat->get_pattern_matches())[0]->is_optional(),
+ 'private symbol is optional like its pattern');
+ok($sym_file->lookup_symbol(($pat->get_pattern_matches())[0], 'libpatterns.so.1'),
+ 'lookup_symbol() finds symbols matched by pattern (after merge)');
# Get rid of a private symbol, it should not be lost
delete $obj->{dynsyms}{$private_symnames[0]};
@@ -734,23 +909,23 @@ $sym_file->merge_symbols($obj, '100.MISSING');
$pat = $sym_file->lookup_pattern($sym, 'libpatterns.so.1', 1);
@tmp = $sym_file->get_lost_symbols($sym_file_dup);
-is_deeply( \@tmp, [ ],
- 'All private symbols gone, but pattern is not LOST because it is optional.');
-is( $pat->{deprecated}, '100.MISSING',
- 'All private symbols gone - pattern deprecated.');
+is_deeply(\@tmp, [ ],
+ 'All private symbols gone, but pattern is not LOST because it is optional.');
+is($pat->{deprecated}, '100.MISSING',
+ 'All private symbols gone - pattern deprecated.');
# Internal symbols. All covered by the pattern?
@tmp = grep { $_->get_symbolname() =~ /Internal/ } values %{$sym_file->{objects}{'libpatterns.so.1'}{syms}};
$sym = $sym_file->create_symbol('(regex|c++)^_Z(T[ISV])?N3NSA6ClassA8Internal.*@Base$ 1.internal');
$pat = $sym_file->lookup_pattern($sym, 'libpatterns.so.1');
-is_deeply ([ sort $pat->get_pattern_matches() ], [ sort @tmp ],
+is_deeply([ sort $pat->get_pattern_matches() ], [ sort @tmp ],
'Pattern covers all internal symbols');
is($tmp[0]->{minver}, '1.internal', 'internal pattern covers first symbol');
# Delete matches of the non-optional pattern
$sym = $sym_file->create_symbol('(c++)"non-virtual thunk to NSB::ClassD::generate_vt(char const*) const@Base" 1');
$pat = $sym_file->lookup_pattern($sym, 'libpatterns.so.1');
-isnt( $pat, undef, 'lookup_pattern() finds alias-based pattern' );
+isnt($pat, undef, 'lookup_pattern() finds alias-based pattern');
is(scalar($pat->get_pattern_matches()), 2, 'two matches for the generate_vt pattern');
foreach my $tmp ($pat->get_pattern_matches()) {
@@ -763,8 +938,8 @@ $pat = $sym_file->lookup_pattern($sym, 'libpatterns.so.1', 1);
@tmp = map { scalar $sym_file->lookup_pattern($_->{symbol}, 'libpatterns.so.1', 1) }
$sym_file->get_lost_symbols($sym_file_dup);
is_deeply(\@tmp, [ $pat ], 'No matches - generate_vt() pattern is LOST.');
-is( $pat->{deprecated}, '100.MISSING',
- 'No matches - generate_vt() pattern is deprecated.');
+is($pat->{deprecated}, '100.MISSING',
+ 'No matches - generate_vt() pattern is deprecated.');
# Pattern undeprecation when matches are discovered
load_patterns_obj();
@@ -776,12 +951,12 @@ $pat = $sym_file->lookup_pattern($sym, 'libpatterns.so.1');
$pat->{deprecated} = '0.1-1';
$sym_file->merge_symbols($obj, '100.FOUND');
-ok( ! $pat->{deprecated},
- 'Previously deprecated pattern with matches got undeprecated');
-is( $pat->{minver}, '100.FOUND',
- 'Previously deprecated pattern with matches got minver bumped');
+ok(! $pat->{deprecated},
+ 'Previously deprecated pattern with matches got undeprecated');
+is($pat->{minver}, '100.FOUND',
+ 'Previously deprecated pattern with matches got minver bumped');
@tmp = map { $_->{symbol}->get_symbolspec(1) } $sym_file->get_new_symbols($sym_file_dup);
-is_deeply( \@tmp, [ $pat->get_symbolspec(1) ],
+is_deeply(\@tmp, [ $pat->get_symbolspec(1) ],
'Previously deprecated pattern with matches is NEW. Matches themselves are not NEW.');
foreach my $sym ($pat->get_pattern_matches()) {
ok(!$sym->{deprecated}, $sym->get_symbolname() . ': not deprecated');
diff --git a/scripts/t/Dpkg_Shlibs/anglebrackets.cpp b/scripts/t/Dpkg_Shlibs/anglebrackets.cpp
new file mode 100644
index 0000000..0db112e
--- /dev/null
+++ b/scripts/t/Dpkg_Shlibs/anglebrackets.cpp
@@ -0,0 +1,23 @@
+#define EXPORT(x) x {}
+
+class AngleBrackets {
+public:
+ AngleBrackets();
+ ~AngleBrackets();
+
+ void operator>>(int a);
+ void operator>>=(int a);
+
+ template<typename T>
+ void operator>>(T a);
+
+ template<typename T>
+ void operator>>=(T a);
+};
+
+EXPORT(AngleBrackets::AngleBrackets())
+EXPORT(AngleBrackets::~AngleBrackets())
+EXPORT(void AngleBrackets::operator>>(int a))
+EXPORT(void AngleBrackets::operator>>=(int a))
+template<> void AngleBrackets::operator>><float>(float a) {}
+template<> void AngleBrackets::operator>>=<float>(float a) {}
diff --git a/scripts/t/Dpkg_Shlibs/anglebrackets.symbols b/scripts/t/Dpkg_Shlibs/anglebrackets.symbols
new file mode 100644
index 0000000..a98846d
--- /dev/null
+++ b/scripts/t/Dpkg_Shlibs/anglebrackets.symbols
@@ -0,0 +1,7 @@
+libanglebrackets.so.1 libanglebrackets1 #MINVER#
+ (c++)AngleBrackets::AngleBrackets() 1
+ (c++)AngleBrackets::~AngleBrackets() 1
+ (c++)AngleBrackets::operator>>=(int) 1
+ (c++)"void AngleBrackets::operator>>=<float>(float)" 1
+ (c++)AngleBrackets::operator>>(int) 1
+ (c++)"void AngleBrackets::operator>><float>(float)" 1
diff --git a/scripts/t/Dpkg_Shlibs/objdump.anglebrackets b/scripts/t/Dpkg_Shlibs/objdump.anglebrackets
new file mode 100644
index 0000000..68a1e1a
--- /dev/null
+++ b/scripts/t/Dpkg_Shlibs/objdump.anglebrackets
@@ -0,0 +1,71 @@
+
+./t/Dpkg_Shlibs/libobjdump.anglebrackets.so: file format elf32-i386
+architecture: i386, flags 0x00000150:
+HAS_SYMS, DYNAMIC, D_PAGED
+start address 0x00000000
+
+Program Header:
+ LOAD off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**12
+ filesz 0x000003f4 memsz 0x000003f4 flags r--
+ LOAD off 0x00001000 vaddr 0x00001000 paddr 0x00001000 align 2**12
+ filesz 0x000001a8 memsz 0x000001a8 flags r-x
+ LOAD off 0x00002000 vaddr 0x00002000 paddr 0x00002000 align 2**12
+ filesz 0x00000118 memsz 0x00000118 flags r--
+ LOAD off 0x00002f2c vaddr 0x00003f2c paddr 0x00003f2c align 2**12
+ filesz 0x000000d8 memsz 0x000000dc flags rw-
+ DYNAMIC off 0x00002f34 vaddr 0x00003f34 paddr 0x00003f34 align 2**2
+ filesz 0x000000b0 memsz 0x000000b0 flags rw-
+ NOTE off 0x00000154 vaddr 0x00000154 paddr 0x00000154 align 2**2
+ filesz 0x00000024 memsz 0x00000024 flags r--
+EH_FRAME off 0x00002000 vaddr 0x00002000 paddr 0x00002000 align 2**2
+ filesz 0x0000004c memsz 0x0000004c flags r--
+ STACK off 0x00000000 vaddr 0x00000000 paddr 0x00000000 align 2**4
+ filesz 0x00000000 memsz 0x00000000 flags rw-
+ RELRO off 0x00002f2c vaddr 0x00003f2c paddr 0x00003f2c align 2**0
+ filesz 0x000000d4 memsz 0x000000d4 flags r--
+
+Dynamic Section:
+ SONAME libanglebrackets.so.1
+ INIT 0x00001000
+ FINI 0x00001194
+ INIT_ARRAY 0x00003f2c
+ INIT_ARRAYSZ 0x00000004
+ FINI_ARRAY 0x00003f30
+ FINI_ARRAYSZ 0x00000004
+ GNU_HASH 0x00000178
+ STRTAB 0x0000028c
+ SYMTAB 0x000001bc
+ STRSZ 0x0000012d
+ SYMENT 0x00000010
+ PLTGOT 0x00003ff4
+ REL 0x000003bc
+ RELSZ 0x00000038
+ RELENT 0x00000008
+ RELCOUNT 0x00000003
+
+DYNAMIC SYMBOL TABLE:
+00000000 w D *UND* 00000000 __cxa_finalize
+00000000 w D *UND* 00000000 _ITM_registerTMCloneTable
+00000000 w D *UND* 00000000 _ITM_deregisterTMCloneTable
+00000000 w D *UND* 00000000 __gmon_start__
+00001170 g DF .text 00000001 _ZN13AngleBracketsrSEi
+00001190 g DF .text 00000001 _ZN13AngleBracketsrSIfEEvT_
+00001180 g DF .text 00000001 _ZN13AngleBracketsrsIfEEvT_
+00001160 g DF .text 00000001 _ZN13AngleBracketsrsEi
+00001140 g DF .text 00000001 _ZN13AngleBracketsC1Ev
+00001140 g DF .text 00000001 _ZN13AngleBracketsC2Ev
+00001150 g DF .text 00000001 _ZN13AngleBracketsD1Ev
+00001150 g DF .text 00000001 _ZN13AngleBracketsD2Ev
+
+
+DYNAMIC RELOCATION RECORDS
+OFFSET TYPE VALUE
+00003f2c R_386_RELATIVE *ABS*
+00003f30 R_386_RELATIVE *ABS*
+00004000 R_386_RELATIVE *ABS*
+00003fe4 R_386_GLOB_DAT __cxa_finalize
+00003fe8 R_386_GLOB_DAT _ITM_registerTMCloneTable
+00003fec R_386_GLOB_DAT _ITM_deregisterTMCloneTable
+00003ff0 R_386_GLOB_DAT __gmon_start__
+
+
diff --git a/scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl b/scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl
index 48434f4..2d1f326 100755
--- a/scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl
+++ b/scripts/t/Dpkg_Shlibs/spacesyms-c-gen.pl
@@ -30,6 +30,7 @@ foreach my $version (qw(defaultver longver shortver)) {
}
}
+print "extern void (*funcs[])(void);\n";
print "void (*funcs[])(void) = {\n";
foreach my $symbol (@symbols) {
print "$symbol,\n";
diff --git a/scripts/t/Dpkg_Shlibs_Cppfilt.t b/scripts/t/Dpkg_Shlibs_Cppfilt.t
index f5bd22e..eaf0b56 100644
--- a/scripts/t/Dpkg_Shlibs_Cppfilt.t
+++ b/scripts/t/Dpkg_Shlibs_Cppfilt.t
@@ -24,7 +24,7 @@ use Config;
test_needs_command('c++filt');
if (defined $Config{bin_ELF} && $Config{bin_ELF} eq 'define') {
- plan tests => 124;
+ plan tests => 154;
} else {
plan skip_all => 'only ELF is currently supported';
}
@@ -32,17 +32,23 @@ if (defined $Config{bin_ELF} && $Config{bin_ELF} eq 'define') {
use_ok('Dpkg::Shlibs::Cppfilt');
# Simple C++ demangling tests
-is ( cppfilt_demangle_cpp('_ZNSt10istrstreamC1EPKcl'),
- 'std::istrstream::istrstream(char const*, long)',
- 'demangle symbol' );
-is ( cppfilt_demangle_cpp('_ZNSt10istrstreamC1EPKcl@Base'),
- 'std::istrstream::istrstream(char const*, long)@Base',
- 'demangle symbol with extra postfix' );
-is ( cppfilt_demangle_cpp('foobar _ZNSt10istrstreamC1EPKcl@Base'),
- 'foobar std::istrstream::istrstream(char const*, long)@Base',
- 'demangle symbol with garbage around it' );
-is ( cppfilt_demangle_cpp('FoobarInvalidSymbol'), undef,
- 'non-demanglable string' );
+is(cppfilt_demangle_cpp('_ZNSt10istrstreamC1EPKcl'),
+ 'std::istrstream::istrstream(char const*, long)',
+ 'demangle symbol');
+is(cppfilt_demangle_cpp('_ZNSt10istrstreamC1EPKcl@Base'),
+ 'std::istrstream::istrstream(char const*, long)@Base',
+ 'demangle symbol with extra postfix');
+is(cppfilt_demangle_cpp('foobar _ZNSt10istrstreamC1EPKcl@Base'),
+ 'foobar std::istrstream::istrstream(char const*, long)@Base',
+ 'demangle symbol with garbage around it');
+is(cppfilt_demangle_cpp('_ZN13AngleBracketsrSEi'),
+ 'AngleBrackets::operator>>=(int)',
+ 'demangle symbol exempt from normalized angle brackets');
+is(cppfilt_demangle_cpp('_ZN13AngleBracketsrSIfEEvT_'),
+ 'void AngleBrackets::operator>>=<float>(float)',
+ 'demangle template symbol exempt from normalized angle brackets');
+is(cppfilt_demangle_cpp('FoobarInvalidSymbol'), undef,
+ 'non-demanglable string');
# Mass C++ demangling. Checking if c++filt does not hang and cppfilt_demangle()
# immediately provides a correct answer to the caller (i.e. no buffering).
@@ -65,6 +71,11 @@ my @mangledtext = split(/\n+/s, <<'END');
00000000000bff30 g DF .text 0000000000000019 _ZNSt18condition_variable10notify_oneEv@GLIBCXX_3.4.11
00000000000666a0 g DF .text 000000000000003f _ZNKSt3tr14hashIRKSbIwSt11char_traitsIwESaIwEEEclES6_@GLIBCXX_3.4.10
00000000002f6160 w DO .data.rel.ro 0000000000000050 _ZTTSt18basic_stringstreamIcSt11char_traitsIcESaIcEE@GLIBCXX_3.4
+
+0000000000001170 g DF .text 0000000000000001 _ZN13AngleBracketsrSEi
+0000000000001190 g DF .text 0000000000000001 _ZN13AngleBracketsrSIfEEvT_
+0000000000001180 g DF .text 0000000000000001 _ZN13AngleBracketsrsIfEEvT_
+0000000000001160 g DF .text 0000000000000001 _ZN13AngleBracketsrsEi
END
my @demangledtext = split(/\n+/s, <<'END');
@@ -86,6 +97,11 @@ my @demangledtext = split(/\n+/s, <<'END');
00000000000bff30 g DF .text 0000000000000019 std::condition_variable::notify_one()@GLIBCXX_3.4.11
00000000000666a0 g DF .text 000000000000003f std::tr1::hash<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&>::operator()(std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const&) const@GLIBCXX_3.4.10
00000000002f6160 w DO .data.rel.ro 0000000000000050 VTT for std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >@GLIBCXX_3.4
+
+0000000000001170 g DF .text 0000000000000001 AngleBrackets::operator>>=(int)
+0000000000001190 g DF .text 0000000000000001 void AngleBrackets::operator>>=<float>(float)
+0000000000001180 g DF .text 0000000000000001 void AngleBrackets::operator>><float>(float)
+0000000000001160 g DF .text 0000000000000001 AngleBrackets::operator>>(int)
END
for my $try (1 .. 7) {