From: Andrew Burford Date: Mon, 16 May 2022 15:47:07 +0000 (-0400) Subject: update idmap-test.sh to properly test ls -l output on lower idmapped mount X-Git-Url: https://git.fsl.cs.sunysb.edu/?a=commitdiff_plain;h=22c254af0946a93d7eafd7d1799a48aaed46db2e;p=wrapfs-mgmt.git update idmap-test.sh to properly test ls -l output on lower idmapped mount --- diff --git a/idmap-tests/idmap-test.sh b/idmap-tests/idmap-test.sh index 1f40db8..5cfd69d 100755 --- a/idmap-tests/idmap-test.sh +++ b/idmap-tests/idmap-test.sh @@ -9,7 +9,8 @@ # Files are created belonging to each user on the original mount of the ext4 # filesystem. They should show up as different users on the id mapped mount and # also on the wrapfs mount if wrapfs correctly supports idmapped mounts on the -# lower fs. +# lower fs. This script confirms that ls -l returns the same output on wrapfs +# and the lower fs. SCRATCH_DEV=/dev/sdb SCRATCH_DIR=/n/scratch @@ -36,8 +37,7 @@ fi dirs="$TMP_DIR $LOWER_DIR $SCRATCH_DIR" for d in $dirs; do - echo checking dir $d - if cat /proc/mounts | grep $d; then + if cat /proc/mounts | grep $d >/dev/null; then runcmd umount $d fi done @@ -50,19 +50,18 @@ runcmd touch $SCRATCH_DIR/ubuntu runcmd chown ubuntu $SCRATCH_DIR/ubuntu runcmd touch $SCRATCH_DIR/luser runcmd chown luser $SCRATCH_DIR/luser -ls1=$(ls -l $SCRATCH_DIR) ubuntu=$(id -u ubuntu) luser=$(id -u luser) runcmd ./mount-idmapped --map-mount b:0:$ubuntu:1 --map-mount b:$ubuntu:$luser:1 --map-mount b:$luser:0:1 $SCRATCH_DIR $LOWER_DIR runcmd mount -t wrapfs $LOWER_DIR $TMP_DIR -if test $ret != 32; then - echo wrapfs returned unexpected error: $ret + +ls1=$(ls -l $LOWER_DIR) +ls2=$(ls -l $TMP_DIR) +if test "$ls1" != "$ls2"; then + echo "$0: ERROR Wrapfs mount not respecting idmap of lower fs" + exit 1 else - echo wrapfs returned correct error attempting to mount on idmapped mount + echo "$0: Success" fi - -#ls2=$(ls -l $TMP_DIR) -#echo $ls1 -#echo $ls2