From 6227bb2580a9ee579db6b214c483ac2f9aed2801 Mon Sep 17 00:00:00 2001 From: Johannes 'josch' Schauer Date: Mon, 2 Dec 2019 23:53:06 +0100 Subject: [PATCH] coverage.sh: add test for non-empty target directory --- coverage.sh | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/coverage.sh b/coverage.sh index f43e7ed..3498e39 100755 --- a/coverage.sh +++ b/coverage.sh @@ -52,7 +52,7 @@ if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then fi starttime= -total=111 +total=112 i=1 print_header() { @@ -395,6 +395,32 @@ else ./run_null.sh fi +print_header "mode=$defaultmode,variant=apt: fail installing to non-empty target directory" +cat << END > shared/test.sh +#!/bin/sh +set -eu +export LC_ALL=C.UTF-8 +mkdir /tmp/debian-chroot +mkdir /tmp/debian-chroot/lost+found +touch /tmp/debian-chroot/exists +ret=0 +$CMD --mode=$defaultmode --variant=apt $DEFAULT_DIST /tmp/debian-chroot $mirror || ret=\$? +rmdir /tmp/debian-chroot/lost+found +rm /tmp/debian-chroot/exists +rmdir /tmp/debian-chroot +if [ "\$ret" = 0 ]; then + echo expected failure but got exit \$ret + exit 1 +fi +END +if [ "$HAVE_QEMU" = "yes" ]; then + ./run_qemu.sh +elif [ "$defaultmode" = "root" ]; then + ./run_null.sh SUDO +else + ./run_null.sh +fi + print_header "mode=root,variant=apt: chroot directory not accessible by _apt user" cat << END > shared/test.sh #!/bin/sh