From 8ef6b8c1da859acbdc078d0658bfe48a04640b52 Mon Sep 17 00:00:00 2001 From: Krzysztof Molon Date: Wed, 15 Jul 2026 14:42:59 +0200 Subject: [PATCH] test: extract /dev/shm bind-mount tests to bst-shm.t These tests require /dev/shm to be mounted on the host, which is not the case in all build environments (e.g. barney). Extracting them to a separate file makes it possible to skip them selectively without losing coverage on the remaining mount tests. --- test/bst-shm.t | 10 ++++++++++ test/bst.t | 7 ------- 2 files changed, 10 insertions(+), 7 deletions(-) create mode 100755 test/bst-shm.t diff --git a/test/bst-shm.t b/test/bst-shm.t new file mode 100755 index 0000000..db6f4fd --- /dev/null +++ b/test/bst-shm.t @@ -0,0 +1,10 @@ +#!/usr/bin/env cram.sh + +Testing bind mount with /dev/shm + + $ [ "$(bst --mount /dev/shm,/mnt,none,bind sh -c 'tail -n 1 /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//" -e "s|/mnt|/dev/shm|"')" = "$(grep /dev/shm /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//")" ] + + + $ act=$(bst --mount /dev/shm,/mnt,none,bind sh -c 'tail -n 1 /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//" -e "s|/mnt|/dev/shm|"') + > exp=$(grep /dev/shm /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//") + > [ "$exp" = "$act" ] || echo -e "-$exp\n+$act" diff --git a/test/bst.t b/test/bst.t index 24fa899..ad323e3 100755 --- a/test/bst.t +++ b/test/bst.t @@ -55,13 +55,6 @@ Testing mount semantics $ bst --mount tmp,/tmp,tmpfs,defaults sh -c 'tail -n 1 /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//" -e "s/,seclabel//" -e "s/,inode64//"' tmp /tmp tmpfs rw,relatime 0 0 - $ [ "$(bst --mount /dev/shm,/mnt,none,bind sh -c 'tail -n 1 /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//" -e "s|/mnt|/dev/shm|"')" = "$(grep /dev/shm /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//")" ] - - - $ act=$(bst --mount /dev/shm,/mnt,none,bind sh -c 'tail -n 1 /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//" -e "s|/mnt|/dev/shm|"') - > exp=$(grep /dev/shm /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//") - > [ "$exp" = "$act" ] || echo -e "-$exp\n+$act" - $ bst --mount tmp,/tmp,tmpfs,dirsync,noatime,nodev,nodiratime,noexec,nosuid,relatime,ro,silent,strictatime,sync sh -c 'tail -n 1 /proc/mounts | sed -Ee "s/,uid=[[:digit:]]+,gid=[[:digit:]]+//" -e "s/,seclabel//" -e "s/,inode64//"' tmp /tmp tmpfs ro,sync,dirsync,nosuid,nodev,noexec,nodiratime 0 0