Skip to content
Snippets Groups Projects
Commit 30c429a4 authored by Simon McVittie's avatar Simon McVittie
Browse files

tests: Use libxml2 instead of libjpeg to test versioned symbols


This avoids worrying about which SONAME we're dealing with, and is
maybe more common in smallish containers (in particular Exherbo's
Docker container has it, which was useful for testing).

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 03213463
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
...@@ -30,10 +30,6 @@ variables: ...@@ -30,10 +30,6 @@ variables:
# A known-good version of deb-build-snapshot # A known-good version of deb-build-snapshot
DEB_BUILD_SNAPSHOT_TAG: v0.20190828.0 DEB_BUILD_SNAPSHOT_TAG: v0.20190828.0
# Name of the package with libjpeg.so.62 in. Set to libjpeg62 in
# Ubuntu or really old versions of Debian
LIBJPEG62: libjpeg62-turbo
before_script: before_script:
- | - |
set -eux set -eux
...@@ -54,7 +50,7 @@ before_script: ...@@ -54,7 +50,7 @@ before_script:
libelf-dev \ libelf-dev \
libipc-run-perl \ libipc-run-perl \
libglib2.0-dev \ libglib2.0-dev \
${LIBJPEG62} \ libxml2 \
perl \ perl \
python3-debian \ python3-debian \
rsync \ rsync \
...@@ -131,7 +127,6 @@ build:bionic: ...@@ -131,7 +127,6 @@ build:bionic:
extends: .deb-build-snapshot extends: .deb-build-snapshot
variables: variables:
BUILD_IMAGE: 'ubuntu:bionic' BUILD_IMAGE: 'ubuntu:bionic'
LIBJPEG62: 'libjpeg62'
build:arch: build:arch:
when: manual when: manual
...@@ -157,8 +152,8 @@ build:arch: ...@@ -157,8 +152,8 @@ build:arch:
glib2 \ glib2 \
gtk-doc \ gtk-doc \
libelf \ libelf \
libjpeg6-turbo \
libtool \ libtool \
libxml2 \
libxslt \ libxslt \
make \ make \
perl \ perl \
......
...@@ -16,7 +16,7 @@ Build-Depends: ...@@ -16,7 +16,7 @@ Build-Depends:
libipc-run-perl, libipc-run-perl,
libglib2.0-0 <!nocheck>, libglib2.0-0 <!nocheck>,
libglib2.0-dev [amd64], libglib2.0-dev [amd64],
libjpeg62-turbo <!nocheck> | libjpeg62 (>= 6b1) <!nocheck>, libxml2 <!nocheck>,
perl:any | perl, perl:any | perl,
xsltproc, xsltproc,
zlib1g <!nocheck>, zlib1g <!nocheck>,
......
...@@ -11,7 +11,7 @@ Depends: ...@@ -11,7 +11,7 @@ Depends:
libcapsule-tools, libcapsule-tools,
libipc-run-perl, libipc-run-perl,
libglib2.0-0, libglib2.0-0,
libjpeg62 (>= 6b1) | libjpeg62-turbo, libxml2,
libtool, libtool,
perl, perl,
pkg-config, pkg-config,
......
...@@ -264,7 +264,7 @@ run_ok([qw(bwrap --ro-bind / / --ro-bind /), $host, ...@@ -264,7 +264,7 @@ run_ok([qw(bwrap --ro-bind / / --ro-bind /), $host,
qw(--dev-bind /dev /dev), qw(--dev-bind /dev /dev),
$CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/', $CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/',
"--dest=$libdir", "--provider=$host", "--dest=$libdir", "--provider=$host",
'soname-match:libjp*g.so.6*'], '>&2'); 'soname-match:lib*ml2.so.2*'], '>&2');
{ {
opendir(my $dir_iter, $libdir); opendir(my $dir_iter, $libdir);
foreach my $symlink (readdir $dir_iter) { foreach my $symlink (readdir $dir_iter) {
...@@ -273,8 +273,8 @@ run_ok([qw(bwrap --ro-bind / / --ro-bind /), $host, ...@@ -273,8 +273,8 @@ run_ok([qw(bwrap --ro-bind / / --ro-bind /), $host,
} }
closedir $dir_iter; closedir $dir_iter;
} }
like(readlink "$libdir/libjpeg.so.62", qr{^$LIBDIR/libjpeg\.so\.62(?:[0-9.]+)$}, like(readlink "$libdir/libxml2.so.2", qr{^$LIBDIR/libxml2\.so\.2(?:[0-9.]+)$},
'$libdir/libjpeg.so.62 is a symlink to /run/host + realpath of libjpeg-6b'); '$libdir/libxml2.so.2 is a symlink to /run/host + realpath of libxml2');
run_ok(['rm', '-fr', $libdir]); run_ok(['rm', '-fr', $libdir]);
mkdir($libdir); mkdir($libdir);
...@@ -492,8 +492,8 @@ SKIP: { ...@@ -492,8 +492,8 @@ SKIP: {
$other_multiarch = 'x86_64-linux-gnu'; $other_multiarch = 'x86_64-linux-gnu';
} }
skip "$other_multiarch libjpeg.so.62 not available", 1 skip "$other_multiarch libxml2.so.2 not available", 1
unless -e "/usr/lib/$other_multiarch/libjpeg.so.62"; unless -e "/usr/lib/$other_multiarch/libxml2.so.2";
# Normally, the wrong ABI is an error... # Normally, the wrong ABI is an error...
run_ok(['rm', '-fr', $libdir]); run_ok(['rm', '-fr', $libdir]);
...@@ -503,10 +503,10 @@ SKIP: { ...@@ -503,10 +503,10 @@ SKIP: {
qw(--dev-bind /dev /dev), qw(--dev-bind /dev /dev),
$CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/', $CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/',
"--dest=$libdir", "--provider=$host", "--dest=$libdir", "--provider=$host",
"path:/usr/lib/$other_multiarch/libjpeg.so.62"], "path:/usr/lib/$other_multiarch/libxml2.so.2"],
'>&2'); '>&2');
ok(! $result, 'library of wrong ABI yields an error'); ok(! $result, 'library of wrong ABI yields an error');
ok(! -e "$libdir/libjpeg.so.62"); ok(! -e "$libdir/libxml2.so.2");
# ... but when we're dealing with a glob match, other ABIs are silently # ... but when we're dealing with a glob match, other ABIs are silently
# ignored. # ignored.
...@@ -517,10 +517,10 @@ SKIP: { ...@@ -517,10 +517,10 @@ SKIP: {
qw(--dev-bind /dev /dev), qw(--dev-bind /dev /dev),
$CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/', $CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/',
"--dest=$libdir", "--provider=$host", "--dest=$libdir", "--provider=$host",
"path-match:/usr/lib/$other_multiarch/libjpeg.so.62"], "path-match:/usr/lib/$other_multiarch/libxml2.so.2"],
'>&2'); '>&2');
ok($result, 'library of wrong ABI ignored when using path-match'); ok($result, 'library of wrong ABI ignored when using path-match');
ok(! -e "$libdir/libjpeg.so.62"); ok(! -e "$libdir/libxml2.so.2");
# We can also ignore this case explicitly. # We can also ignore this case explicitly.
run_ok(['rm', '-fr', $libdir]); run_ok(['rm', '-fr', $libdir]);
...@@ -530,10 +530,10 @@ SKIP: { ...@@ -530,10 +530,10 @@ SKIP: {
qw(--dev-bind /dev /dev), qw(--dev-bind /dev /dev),
$CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/', $CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/',
"--dest=$libdir", "--provider=$host", "--dest=$libdir", "--provider=$host",
"if-same-abi:path:/usr/lib/$other_multiarch/libjpeg.so.62"], "if-same-abi:path:/usr/lib/$other_multiarch/libxml2.so.2"],
'>&2'); '>&2');
ok($result, 'library of wrong ABI ignored when using if-same-abi'); ok($result, 'library of wrong ABI ignored when using if-same-abi');
ok(! -e "$libdir/libjpeg.so.62"); ok(! -e "$libdir/libxml2.so.2");
}; };
SKIP: { SKIP: {
......
...@@ -59,7 +59,7 @@ run_ok([$CAPSULE_INIT_PROJECT_TOOL, ...@@ -59,7 +59,7 @@ run_ok([$CAPSULE_INIT_PROJECT_TOOL,
'--search-tree=/', '--search-tree=/',
'--runtime-tree=/run/host', '--runtime-tree=/run/host',
'libz.so.1/1.2.3', 'libz.so.1/1.2.3',
'libjpeg.so.62']); 'libxml2.so.2']);
run_ok([ run_ok([
'sh', '-euc', 'cd "$1"; shift; ./configure "$@"', 'sh', '-euc', 'cd "$1"; shift; ./configure "$@"',
'sh', "$test_tempdir/libz-proxy", 'sh', "$test_tempdir/libz-proxy",
...@@ -72,10 +72,10 @@ ok(-e "$test_tempdir/libz-proxy/libz.la"); ...@@ -72,10 +72,10 @@ ok(-e "$test_tempdir/libz-proxy/libz.la");
ok(-e "$test_tempdir/libz-proxy/.libs/libz.so"); ok(-e "$test_tempdir/libz-proxy/.libs/libz.so");
ok(-e "$test_tempdir/libz-proxy/.libs/libz.so.1"); ok(-e "$test_tempdir/libz-proxy/.libs/libz.so.1");
ok(-e "$test_tempdir/libz-proxy/.libs/libz.so.1.2.3"); ok(-e "$test_tempdir/libz-proxy/.libs/libz.so.1.2.3");
ok(-e "$test_tempdir/libz-proxy/libjpeg.la"); ok(-e "$test_tempdir/libz-proxy/libxml2.la");
ok(-e "$test_tempdir/libz-proxy/.libs/libjpeg.so"); ok(-e "$test_tempdir/libz-proxy/.libs/libxml2.so");
ok(-e "$test_tempdir/libz-proxy/.libs/libjpeg.so.62"); ok(-e "$test_tempdir/libz-proxy/.libs/libxml2.so.2");
ok(-e "$test_tempdir/libz-proxy/.libs/libjpeg.so.62.0.0"); ok(-e "$test_tempdir/libz-proxy/.libs/libxml2.so.2.0.0");
{ {
local $/ = undef; # read entire file in one go local $/ = undef; # read entire file in one go
open(my $fh, '<', "$test_tempdir/libz-proxy/shim/libz.so.1.c"); open(my $fh, '<', "$test_tempdir/libz-proxy/shim/libz.so.1.c");
...@@ -90,7 +90,7 @@ ok(-e "$test_tempdir/libz-proxy/.libs/libjpeg.so.62.0.0"); ...@@ -90,7 +90,7 @@ ok(-e "$test_tempdir/libz-proxy/.libs/libjpeg.so.62.0.0");
} }
{ {
local $/ = undef; # read entire file in one go local $/ = undef; # read entire file in one go
open(my $fh, '<', "$test_tempdir/libz-proxy/shim/libjpeg.so.62.c"); open(my $fh, '<', "$test_tempdir/libz-proxy/shim/libxml2.so.2.c");
my $source = <$fh>; my $source = <$fh>;
like($source, qr{\.default_prefix\s*=\s*"/host"}, like($source, qr{\.default_prefix\s*=\s*"/host"},
'Configure-time runtime tree takes precedence'); 'Configure-time runtime tree takes precedence');
......
...@@ -77,13 +77,13 @@ else { ...@@ -77,13 +77,13 @@ else {
# How about versioned symbols? # How about versioned symbols?
my $output; my $output;
run_ok([$CAPSULE_SYMBOLS_TOOL, 'libjpeg.so.62', '/'], '>', \$output); run_ok([$CAPSULE_SYMBOLS_TOOL, 'libxml2.so.2', '/'], '>', \$output);
diag_multiline $output; diag_multiline $output;
like($output, qr{^jpeg_destroy \@\@LIBJPEG_6\.2$}m, like($output, qr{^xmlFree \@\@LIBXML2_2\.4\.30$}m,
"jpeg_destroy is a versioned symbol"); "xmlFree is a versioned symbol");
unlike($output, qr{^jpeg_destroy (?!\@\@LIBJPEG_6\.2)}m, unlike($output, qr{^xmlFree (?!\@\@LIBXML2_2\.4\.30)}m,
"jpeg_destroy does not appear unversioned"); "xmlFree does not appear unversioned");
done_testing; done_testing;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment