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

Add an installed-only smoke-test for capsule-version

parent 2e2afd2e
No related branches found
No related tags found
1 merge request!311Build capsule-capture-libs from a bundled copy of libcapsule
...@@ -3,6 +3,13 @@ Depends: ...@@ -3,6 +3,13 @@ Depends:
build-essential, build-essential,
libcapsule-dev, libcapsule-dev,
Tests: version
Depends:
bubblewrap,
libcapsule-dev,
libcapsule-dev-bin,
zlib1g,
Tests: gnome-desktop-testing Tests: gnome-desktop-testing
Depends: Depends:
gnome-desktop-testing, gnome-desktop-testing,
......
#!/bin/bash
# Copyright © 2017 Collabora Ltd
#
# This file is part of libcapsule.
#
# libcapsule is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# libcapsule is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with libcapsule. If not, see <http://www.gnu.org/licenses/>.
set -eu -o pipefail
. "$(dirname "$0")"/../../tests/libtest.sh
if ! bwrap --ro-bind / / true; then
skip_all "1..0 # SKIP - cannot run bwrap"
fi
if ! [ -d /mnt ]; then
skip_all "1..0 # SKIP - this test needs /mnt"
fi
scratch="$(mktemp -d)"
echo "# Working directory: $scratch"
cd "$scratch"
trap 'cd /; rm -fr $scratch' EXIT
# Work around what appears to be a recent regression?
#host="${scratch}/host"
#mkdir "${host}"
host=/mnt
CAPSULE_VERSION="$(pkg-config --variable=libexecdir capsule)/capsule-version"
output="$(bwrap --ro-bind / / --ro-bind / "${host}" --dev-bind /dev /dev \
${CAPSULE_VERSION} libz.so.1 "${host}")"
set -- $output
is "$1" "${host}"
is "$2" libz.so.1
like "$3" "1.*.*"
like "$4" "${host}/@(usr/lib|lib)/*-linux-gnu*/libz.so.$3"
test -e "${4#${host}}"
pass "successfully found libz"
done_testing
# vim:set sw=4 sts=4 et:
...@@ -71,6 +71,20 @@ is () { ...@@ -71,6 +71,20 @@ is () {
fi fi
} }
like () {
local got="$1"
local expected="$2"
shift 2
if [[ $got == $expected ]]; then
pass "$* ($got matches $expected)"
else
echo "# Got: $got"
echo "# Expected extglob: $expected"
fail "$* ($got does not match $expected)"
fi
}
isnt () { isnt () {
local got="$1" local got="$1"
local unexpected="$2" local unexpected="$2"
......
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