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
Branches
Tags
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
......@@ -30,10 +30,6 @@ variables:
# A known-good version of deb-build-snapshot
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:
- |
set -eux
......@@ -54,7 +50,7 @@ before_script:
libelf-dev \
libipc-run-perl \
libglib2.0-dev \
${LIBJPEG62} \
libxml2 \
perl \
python3-debian \
rsync \
......@@ -131,7 +127,6 @@ build:bionic:
extends: .deb-build-snapshot
variables:
BUILD_IMAGE: 'ubuntu:bionic'
LIBJPEG62: 'libjpeg62'
build:arch:
when: manual
......@@ -157,8 +152,8 @@ build:arch:
glib2 \
gtk-doc \
libelf \
libjpeg6-turbo \
libtool \
libxml2 \
libxslt \
make \
perl \
......
......@@ -16,7 +16,7 @@ Build-Depends:
libipc-run-perl,
libglib2.0-0 <!nocheck>,
libglib2.0-dev [amd64],
libjpeg62-turbo <!nocheck> | libjpeg62 (>= 6b1) <!nocheck>,
libxml2 <!nocheck>,
perl:any | perl,
xsltproc,
zlib1g <!nocheck>,
......
......@@ -11,7 +11,7 @@ Depends:
libcapsule-tools,
libipc-run-perl,
libglib2.0-0,
libjpeg62 (>= 6b1) | libjpeg62-turbo,
libxml2,
libtool,
perl,
pkg-config,
......
......@@ -264,7 +264,7 @@ run_ok([qw(bwrap --ro-bind / / --ro-bind /), $host,
qw(--dev-bind /dev /dev),
$CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/',
"--dest=$libdir", "--provider=$host",
'soname-match:libjp*g.so.6*'], '>&2');
'soname-match:lib*ml2.so.2*'], '>&2');
{
opendir(my $dir_iter, $libdir);
foreach my $symlink (readdir $dir_iter) {
......@@ -273,8 +273,8 @@ run_ok([qw(bwrap --ro-bind / / --ro-bind /), $host,
}
closedir $dir_iter;
}
like(readlink "$libdir/libjpeg.so.62", qr{^$LIBDIR/libjpeg\.so\.62(?:[0-9.]+)$},
'$libdir/libjpeg.so.62 is a symlink to /run/host + realpath of libjpeg-6b');
like(readlink "$libdir/libxml2.so.2", qr{^$LIBDIR/libxml2\.so\.2(?:[0-9.]+)$},
'$libdir/libxml2.so.2 is a symlink to /run/host + realpath of libxml2');
run_ok(['rm', '-fr', $libdir]);
mkdir($libdir);
......@@ -492,8 +492,8 @@ SKIP: {
$other_multiarch = 'x86_64-linux-gnu';
}
skip "$other_multiarch libjpeg.so.62 not available", 1
unless -e "/usr/lib/$other_multiarch/libjpeg.so.62";
skip "$other_multiarch libxml2.so.2 not available", 1
unless -e "/usr/lib/$other_multiarch/libxml2.so.2";
# Normally, the wrong ABI is an error...
run_ok(['rm', '-fr', $libdir]);
......@@ -503,10 +503,10 @@ SKIP: {
qw(--dev-bind /dev /dev),
$CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/',
"--dest=$libdir", "--provider=$host",
"path:/usr/lib/$other_multiarch/libjpeg.so.62"],
"path:/usr/lib/$other_multiarch/libxml2.so.2"],
'>&2');
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
# ignored.
......@@ -517,10 +517,10 @@ SKIP: {
qw(--dev-bind /dev /dev),
$CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/',
"--dest=$libdir", "--provider=$host",
"path-match:/usr/lib/$other_multiarch/libjpeg.so.62"],
"path-match:/usr/lib/$other_multiarch/libxml2.so.2"],
'>&2');
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.
run_ok(['rm', '-fr', $libdir]);
......@@ -530,10 +530,10 @@ SKIP: {
qw(--dev-bind /dev /dev),
$CAPSULE_CAPTURE_LIBS_TOOL, '--link-target=/',
"--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');
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: {
......
......@@ -59,7 +59,7 @@ run_ok([$CAPSULE_INIT_PROJECT_TOOL,
'--search-tree=/',
'--runtime-tree=/run/host',
'libz.so.1/1.2.3',
'libjpeg.so.62']);
'libxml2.so.2']);
run_ok([
'sh', '-euc', 'cd "$1"; shift; ./configure "$@"',
'sh', "$test_tempdir/libz-proxy",
......@@ -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.1");
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/.libs/libjpeg.so");
ok(-e "$test_tempdir/libz-proxy/.libs/libjpeg.so.62");
ok(-e "$test_tempdir/libz-proxy/.libs/libjpeg.so.62.0.0");
ok(-e "$test_tempdir/libz-proxy/libxml2.la");
ok(-e "$test_tempdir/libz-proxy/.libs/libxml2.so");
ok(-e "$test_tempdir/libz-proxy/.libs/libxml2.so.2");
ok(-e "$test_tempdir/libz-proxy/.libs/libxml2.so.2.0.0");
{
local $/ = undef; # read entire file in one go
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");
}
{
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>;
like($source, qr{\.default_prefix\s*=\s*"/host"},
'Configure-time runtime tree takes precedence');
......
......@@ -77,13 +77,13 @@ else {
# How about versioned symbols?
my $output;
run_ok([$CAPSULE_SYMBOLS_TOOL, 'libjpeg.so.62', '/'], '>', \$output);
run_ok([$CAPSULE_SYMBOLS_TOOL, 'libxml2.so.2', '/'], '>', \$output);
diag_multiline $output;
like($output, qr{^jpeg_destroy \@\@LIBJPEG_6\.2$}m,
"jpeg_destroy is a versioned symbol");
unlike($output, qr{^jpeg_destroy (?!\@\@LIBJPEG_6\.2)}m,
"jpeg_destroy does not appear unversioned");
like($output, qr{^xmlFree \@\@LIBXML2_2\.4\.30$}m,
"xmlFree is a versioned symbol");
unlike($output, qr{^xmlFree (?!\@\@LIBXML2_2\.4\.30)}m,
"xmlFree does not appear unversioned");
done_testing;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment