File: autopkgtest-virt-null-for-test

package info (click to toggle)
dgit 12.16
  • links: PTS, VCS
  • area: main
  • in suites: trixie-proposed-updates
  • size: 3,368 kB
  • sloc: perl: 13,443; sh: 6,466; python: 334; makefile: 324; tcl: 69
file content (63 lines) | stat: -rwxr-xr-x 2,066 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash

# Work around #868576 and #1092771 for bookworm.
# The bugs are fixed for trixie, and we already don't run the relevant
# t2u tests on bullseye & buster due to needing newer python3-pygit2.

set -ex

export TMPDIR="$DGIT_TEST_TMP/autopkgtest-tmp"
test -d "$TMPDIR" || mkdir "$TMPDIR"

if ! dpkg --compare-versions \
     "$(dpkg-query -f '${Version}' -W autopkgtest)" '<<' 5.47~; then
    exec autopkgtest-virt-null --retain-tmp "$@"
    x
fi

bodge="$TMPDIR/autopkgtest-virt-null-bodged"
troot="$DGIT_TEST_TROOT"

if ! test -e "$bodge"; then
    orig="$(type -p autopkgtest-virt-null)" 
    # This patching is morally equivalent to maintaining a local fork of
    # autopkgtest-virt-null here in the dgit test suite,
    # with the unusual property that we insist on being able to update
    # automatically, and fail the test if the patch doesn't apply.
    #
    # Other options considered but rejected:
    #
    # clone-and-hack autopkgtest-virt-null here and expect that the
    # VirtSubProc API is stable enough: also unprincipled, and ISTM more
    # likely to appear to work, but malfunction.
    #
    # Put a stunt version of `rm` on the PATH.  This would work until
    # VirtSubProc uses rmtree, and would then silently stop working.
    #
    # Even if #1092771 is addressed, we still need to probe for its
    # availability, and fall back to this patching, until all Debian
    # releases supported by dgit.dgit#main have the new autopkgtest.
    cp -- "$orig" "$bodge"
    patch $bodge <"$troot/autopkgtest-virt-null.bodge.patch" >&2
fi

# work around #868576 (which is fixed only in autopkgtest 5.44, in trixie!)
perl -we '
    my $child = open CHILD, "|-", @ARGV;
    $child // die $!;
    open STDOUT, ">&2" or die $!;
    sub quit () {
	waitpid $child, 0;
	die "failed @ARGV $?" if $? && $? != 15;
        exit 0;
    }
    $SIG{CHLD} = \&quit;
    while (<STDIN>) {
        print CHILD or die $!;
	flush CHILD or die $!;
    }
    $SIG{CHLD} = "DEFAULT";
    kill 15, $child;
    quit();
' \
"$bodge" ${DGIT_TEST_NDEBUG- -d} "$@"