File: update-expected

package info (click to toggle)
ucf 3.0052
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,204 kB
  • sloc: sh: 1,384; perl: 397; makefile: 31
file content (46 lines) | stat: -rwxr-xr-x 1,053 bytes parent folder | download
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
#!/bin/sh

set -e

if [ "$(uname -s)" = 'GNU' ] ; then
    echo "Sorry, testsuite requires unshare(1). GNU Hurd patches welcome."
    exit
fi

cd "$(dirname "$0")"

if [ $# -eq 0 ] ; then
    # Run all if none specified
    set -- $(find . -name test -executable -exec dirname '{}' ';')
fi

export DEBIAN_FRONTEND=noninteractive
export UCF_TEST_TARGET=/tmp
export UCF_TEST_BINDIR="${UCF_TEST_BINDIR=../../}"

trap 'echo "Testsuite: ${i:-0}/$# tests updated"' EXIT

for tdir do
    echo "Updating $tdir" >&2
    unshare -rmw "$tdir" sh <<'EOF'
set -e
mount -t tmpfs tmpfs /var/cache/debconf
if [ -d /var/lib/ucf ] ; then
 mount -t tmpfs tmpfs /var/lib/ucf
else
 udir=$(mktemp -d)
 wdir=$(mktemp -d)
 trap 'rm -rf $udir $wdir' EXIT
 mount -t overlay none -o lowerdir=/var/lib,upperdir=$udir,workdir=$wdir /var/lib
 mkdir -p /var/lib/ucf
fi
mount -t tmpfs tmpfs /tmp
mkdir -p expected
./test | tee expected/output
rm -rf expected/target
cp -r $UCF_TEST_TARGET expected/target
rm -rf expected/state
cp -r /var/lib/ucf expected/state
EOF
    i=$((i+1))
done