Commit 50532007 authored by Simon McVittie's avatar Simon McVittie

tests/manual/gl.pl: Abort if one of the commands used to prepare the container fails

Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent b87ec973
......@@ -29,6 +29,7 @@ use IPC::Run qw(run);
use Test::More;
our @EXPORT = qw(
assert_run_verbose
diag_multiline
explain_wait_status
get_symbols_with_nm
......@@ -164,6 +165,25 @@ diag "Build or installation directory: $builddir";
=over
=item assert_run_verbose(I<ARGV>, ...)
Log the given command, run it, and die if it didn't return success.
I<ARGV> is an array-reference containing arguments.
Subsequent parameters are passed to C<IPC::Run::run> and can be used
to redirect output.
=cut
sub assert_run_verbose {
my $argv = shift;
my $debug = join(' ', @$argv);
diag($debug);
if (! run($argv, @_)) {
my $explained = explain_wait_status($?);
die "Command exited with status $? ($explained): '$debug'";
}
}
=item diag_multiline(I<TEXT>)
Split I<TEXT> into lines and emit them as TAP diagnostics.
......
......@@ -380,7 +380,7 @@ sub multiarch_tuple_to_ldso {
return $multiarch_tuple_to_ldso{$tuple};
}
run_verbose([
assert_run_verbose([
$CAPSULE_CAPTURE_LIBS_TOOLS{$tuple}, '--print-ld.so'
], '>', \$stdout);
chomp $stdout;
......@@ -408,7 +408,7 @@ sub real_path_of_ldso {
my $stdout;
$tree = '/' unless defined $tree;
run_verbose([
assert_run_verbose([
'bwrap',
'--ro-bind', '/', '/',
'--tmpfs', $workspace,
......@@ -482,7 +482,7 @@ sub capture_libs {
foreach my $tuple (@multiarch_tuples) {
make_path("$dest/lib/$tuple", verbose => 1);
run_verbose([
assert_run_verbose([
'bwrap',
'--ro-bind', '/', '/',
'--bind', $dest, $dest,
......@@ -613,13 +613,13 @@ if (defined $flatpak_runtime) {
}
foreach my $tuple (@multiarch_tuples) {
run_verbose([
assert_run_verbose([
'env', "PKG_CONFIG_PATH=/usr/lib/$tuple/pkgconfig",
'pkg-config', '--variable=CAPSULE_VERSION_TOOL', 'libcapsule-tools',
], '>', \$stdout);
chomp $stdout;
$CAPSULE_VERSION_TOOLS{$tuple} = $stdout;
run_verbose([
assert_run_verbose([
'env', "PKG_CONFIG_PATH=/usr/lib/$tuple/pkgconfig",
'pkg-config', '--variable=CAPSULE_CAPTURE_LIBS_TOOL',
'libcapsule-tools',
......@@ -633,7 +633,7 @@ $app = "$data_home/flatpak/app/org.debian.packages.mesa_utils/$arch/master/activ
$container_tree = "$data_home/flatpak/runtime/net.debian.flatpak.Games.Platform/$arch/stretch/active/files"
unless defined $container_tree;
run_verbose(['glxinfo'], '>', \$stdout);
assert_run_verbose(['glxinfo'], '>', \$stdout);
diag_multiline($stdout);
if ($stdout =~ /Error: couldn't find RGB GLX visual/) {
......@@ -753,7 +753,7 @@ if ($libc_provider_tree eq 'auto') {
foreach my $tuple (@multiarch_tuples) {
foreach my $dir ('updates', 'gl') {
next unless -d "$tmpdir/$dir/lib/$tuple";
run_verbose([
assert_run_verbose([
'ls', '-l', "$tmpdir/$dir/lib/$tuple",
], '>', \$stdout);
diag_multiline $stdout;
......@@ -991,7 +991,7 @@ elsif (exists $ENV{XDG_RUNTIME_DIR} &&
foreach my $tuple (@multiarch_tuples) {
foreach my $dir ('updates', 'gl') {
next unless -d "$tmpdir/$dir/lib/$tuple";
run_verbose([
assert_run_verbose([
'ls', '-l', "$tmpdir/$dir/lib/$tuple",
], '>', \$stdout);
diag_multiline $stdout;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment