]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add some test for norbind 13173/head
authorIago López Galeiras <iago@kinvolk.io>
Wed, 24 Jul 2019 14:55:17 +0000 (16:55 +0200)
committerIago López Galeiras <iago@kinvolk.io>
Wed, 24 Jul 2019 15:20:29 +0000 (17:20 +0200)
This regressed so let's add a test to make sure it doesn't happen again.

test/TEST-13-NSPAWN-SMOKE/test.sh

index 7243959b2ec0ad1e0b5c1d0f0d2f8086773f4951..cc67cfa17d13b8897d37fad7d45aed0064a5ac87 100755 (executable)
@@ -83,6 +83,17 @@ function check_bind_tmp_path {
     systemd-nspawn --register=no -D "$_root" --bind=/tmp/bind /bin/sh -c 'test -e /tmp/bind'
 }
 
+function check_norbind {
+    # https://github.com/systemd/systemd/issues/13170
+    local _root="/var/lib/machines/norbind-path"
+    mkdir -p /tmp/binddir/subdir
+    echo -n "outer" > /tmp/binddir/subdir/file
+    mount -t tmpfs tmpfs /tmp/binddir/subdir
+    echo -n "inner" > /tmp/binddir/subdir/file
+    /create-busybox-container "$_root"
+    systemd-nspawn --register=no -D "$_root" --bind=/tmp/binddir:/mnt:norbind /bin/sh -c 'CONTENT=$(cat /mnt/subdir/file); if [[ $CONTENT != "outer" ]]; then echo "*** unexpected content: $CONTENT"; return 1; fi'
+}
+
 function check_notification_socket {
     # https://github.com/systemd/systemd/issues/4944
     local _cmd='echo a | $(busybox which nc) -U -u -w 1 /run/systemd/nspawn/notify'
@@ -168,6 +179,8 @@ function run {
 
 check_bind_tmp_path
 
+check_norbind
+
 check_notification_socket
 
 for api_vfs_writable in yes no network; do