update idmap-test.sh to properly test ls -l output on lower idmapped mount
authorAndrew Burford <aburford@cs.stonybrook.edu>
Mon, 16 May 2022 15:47:07 +0000 (11:47 -0400)
committerAndrew Burford <aburford@cs.stonybrook.edu>
Mon, 16 May 2022 15:47:07 +0000 (11:47 -0400)
idmap-tests/idmap-test.sh

index 1f40db8e8ae737617fd4bd820d37f6c591c6dc3a..5cfd69d84c374ae9653a94c02b654d2e03d9476c 100755 (executable)
@@ -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