when re-execing itself, keep Devel::Cover options
This commit is contained in:
parent
f2ad2976ef
commit
4fed488c35
2 changed files with 18 additions and 31 deletions
29
coverage.sh
29
coverage.sh
|
@ -49,7 +49,7 @@ if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then
|
|||
fi
|
||||
|
||||
starttime=
|
||||
total=123
|
||||
total=115
|
||||
skipped=0
|
||||
runtests=0
|
||||
i=1
|
||||
|
@ -1851,33 +1851,6 @@ END
|
|||
./run_null.sh
|
||||
runtests=$((runtests+1))
|
||||
fi
|
||||
# Devel::Cover doesn't survive mmdebstrap re-exec-ing itself
|
||||
# with fakechroot, thus, we do an additional run where we
|
||||
# explicitly run mmdebstrap with fakechroot from the start
|
||||
if [ "$mode" = "fakechroot" ]; then
|
||||
print_header "mode=$mode,variant=$variant: create tarball (ver 2)"
|
||||
cat << END > shared/test.sh
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
export LC_ALL=C.UTF-8
|
||||
[ "\$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1 && adduser --gecos user --disabled-password user
|
||||
prefix=
|
||||
[ "\$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||
\$prefix fakechroot fakeroot $CMD --mode=$mode --variant=$variant $DEFAULT_DIST /tmp/debian-chroot.tar $mirror
|
||||
{ tar -tf /tmp/debian-chroot.tar;
|
||||
printf "./etc/ld.so.cache\n./var/cache/ldconfig/\n";
|
||||
[ "$variant" != "essential" ] && printf "./etc/.pwd.lock\n";
|
||||
} | sort | diff -u "./$variant.txt" -
|
||||
rm /tmp/debian-chroot.tar
|
||||
END
|
||||
if [ "$HAVE_QEMU" = "yes" ]; then
|
||||
./run_qemu.sh
|
||||
runtests=$((runtests+1))
|
||||
else
|
||||
./run_null.sh
|
||||
runtests=$((runtests+1))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# some variants are equal and some are strict superset of the last
|
||||
# special case of the buildd variant: nothing is a superset of it
|
||||
|
|
20
mmdebstrap
20
mmdebstrap
|
@ -84,6 +84,8 @@ my @devfiles = (
|
|||
# 3 -> debug output
|
||||
my $verbosity_level = 1;
|
||||
|
||||
my $is_covering = !!(eval 'Devel::Cover::get_coverage()');
|
||||
|
||||
sub debug {
|
||||
if ($verbosity_level < 3) {
|
||||
return;
|
||||
|
@ -977,7 +979,11 @@ sub run_hooks($$) {
|
|||
# we execute ourselves under sh to avoid having to
|
||||
# implement a clever parser of the quoting used in $script
|
||||
# for the filenames
|
||||
exec 'sh', '-c', "$PROGRAM_NAME --hook-helper \"\$1\" \"\$2\" \"\$3\" \"\$4\" \"\$5\" $script",
|
||||
my $prefix = "";
|
||||
if($is_covering) {
|
||||
$prefix = "$EXECUTABLE_NAME -MDevel::Cover=-silent,-nogcov ";
|
||||
}
|
||||
exec 'sh', '-c', "$prefix$PROGRAM_NAME --hook-helper \"\$1\" \"\$2\" \"\$3\" \"\$4\" \"\$5\" $script",
|
||||
'exec', $options->{root}, $options->{mode}, $name, (defined $options->{qemu} ? "qemu-$options->{qemu}" : 'env', $verbosity_level);
|
||||
}
|
||||
waitpid($pid, 0);
|
||||
|
@ -2299,7 +2305,11 @@ sub main() {
|
|||
} elsif (system('fakechroot --version>/dev/null') == 0) {
|
||||
# the next fallback is fakechroot
|
||||
# exec ourselves again but within fakechroot
|
||||
exec 'fakechroot', 'fakeroot', $PROGRAM_NAME, @ARGVORIG;
|
||||
my @prefix = ();
|
||||
if($is_covering) {
|
||||
@prefix = ($EXECUTABLE_NAME, '-MDevel::Cover=-silent,-nogcov');
|
||||
}
|
||||
exec 'fakechroot', 'fakeroot', @prefix, $PROGRAM_NAME, @ARGVORIG;
|
||||
} elsif (system('proot --version>/dev/null') == 0) {
|
||||
# and lastly, proot
|
||||
$options->{mode} = 'proot';
|
||||
|
@ -2322,7 +2332,11 @@ sub main() {
|
|||
error "need working fakechroot binary";
|
||||
} else {
|
||||
# exec ourselves again but within fakechroot
|
||||
exec 'fakechroot', 'fakeroot', $PROGRAM_NAME, @ARGVORIG;
|
||||
my @prefix = ();
|
||||
if($is_covering) {
|
||||
@prefix = ($EXECUTABLE_NAME, '-MDevel::Cover=-silent,-nogcov');
|
||||
}
|
||||
exec 'fakechroot', 'fakeroot', @prefix, $PROGRAM_NAME, @ARGVORIG;
|
||||
}
|
||||
} elsif ($options->{mode} eq 'unshare') {
|
||||
if (!test_unshare(1)) {
|
||||
|
|
Loading…
Reference in a new issue