summaryrefslogtreecommitdiffstats
path: root/debian/tests/fake/schroot-1.6.10-3
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2017-02-24 09:45:33 (GMT)
committerCyril Brulebois <kibi@debian.org>2017-03-09 22:24:37 (GMT)
commit63365f0e237c7365e9981dac0b56a383e3eae70c (patch)
tree2889cb2901493f8ad8cc97aec9e174616d4bac34 /debian/tests/fake/schroot-1.6.10-3
parentc997b80c064c6c1d36ec69da1850722f795f43e4 (diff)
downloaddebootstrap-63365f0e237c7365e9981dac0b56a383e3eae70c.zip
debootstrap-63365f0e237c7365e9981dac0b56a383e3eae70c.tar.gz
debootstrap-63365f0e237c7365e9981dac0b56a383e3eae70c.tar.bz2
Add an autopkgtest covering #817236 and various other sanity checks
Because debootstrap is relatively slow, I've named the test according to what is being bootstrapped (Debian testing) rather than the checks that are performed, with the intention that additional checks can be added to it. Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to '')
-rwxr-xr-xdebian/tests/fake/schroot-1.6.10-347
1 files changed, 47 insertions, 0 deletions
diff --git a/debian/tests/fake/schroot-1.6.10-3 b/debian/tests/fake/schroot-1.6.10-3
new file mode 100755
index 0000000..00d3531
--- /dev/null
+++ b/debian/tests/fake/schroot-1.6.10-3
@@ -0,0 +1,47 @@
+#!/bin/sh
+# fake/schroot-1.6.10-3 -- emulate how schroot/1.6.10-3 would chroot.
+# It bind-mounts /dev/pts and maybe /dev from the host system.
+# (There is of course a lot more that it does, but these are the parts that
+# affect pty users like script(1).)
+#
+# Copyright © 2017 Simon McVittie
+# SPDX-License-Identifier: MIT
+# (see debian/copyright)
+
+set -e
+
+# /etc/schroot/default/fstab
+bind_dev=yes
+
+while true; do
+ case "$1" in
+ (--sbuild)
+ shift
+ # /etc/schroot/sbuild/fstab
+ bind_dev=no
+ ;;
+ (*)
+ break
+ esac
+done
+
+chroot="$1"
+shift
+if test -z "$chroot" || test -z "$1"; then
+ echo "Usage: $0 CHROOT COMMAND...">&2
+ exit 2
+fi
+
+[ "$bind_dev" = no ] || mount --bind /dev "$chroot/dev"
+mount --bind /dev/pts "$chroot/dev/pts"
+
+ls -l "$chroot/dev/ptmx" | sed -e 's/^/# fake-schroot: /' >&2
+ls -l "$chroot/dev/pts/ptmx" | sed -e 's/^/# fake-schroot: /' >&2
+
+e=0
+chroot "$chroot" "$@" || e=$?
+
+umount "$chroot/dev/pts"
+[ "$bind_dev" = no ] || umount "$chroot/dev"
+
+exit "$e"