test wrapfs stacked on itself in w-racer.sh
authorAndrew Burford <aburford@cs.stonybrook.edu>
Sat, 14 May 2022 16:06:08 +0000 (12:06 -0400)
committerAndrew Burford <aburford@cs.stonybrook.edu>
Sat, 14 May 2022 16:06:08 +0000 (12:06 -0400)
tests/w-racer.sh

index 5e6771fe1463a4f825f32b8977d8107d486eab03..ef638122c5ba07bee535561233d397e745966377 100755 (executable)
@@ -9,9 +9,6 @@ SCRATCH_DIR=/n/scratch
 LOWER_DIR=/n/lower
 TMP_DIR=/n/tmp
 
-# TODO: define TMP_DIR, SCRATCH_DIR, and LOWER_DIR, and don't hardcode them below
-# TODO: TMP_DIR shoyld be /n/tmp, ensure to "runcmd mkdir -p $TMP_DIR"
-
 function runcmd
 {
     echo "CMD: $@"
@@ -62,9 +59,21 @@ case "$lowertype" in
        runcmd exportfs -u localhost:$LOWER_DIR
        runcmd umount $LOWER_DIR
        ;;
+    wrapfs )
+       runcmd lsof $LOWER_DIR
+       runcmd umount $LOWER_DIR
+       runcmd lsof $SCRATCH_DIR
+       runcmd umount $SCRATCH_DIR
 esac
 }
 
+dirs="$TMP_DIR $LOWER_DIR $SCRATCH_DIR"
+for d in $dirs; do
+       if cat /proc/mounts | grep $d; then
+               runcmd umount $d
+       fi
+done
+
 # decide what type of test
 type="bind"    # default
 case "$1" in
@@ -72,10 +81,10 @@ case "$1" in
     -d | -direct ) type="direct" ; shift ;;
 esac
 case "$1" in
-    ext3 | ext2 | ext4 | reiserfs | xfs | tmpfs | nfs ) lowertype=$1 ;;
+    ext3 | ext2 | ext4 | reiserfs | xfs | tmpfs | nfs | wrapfs ) lowertype=$1 ;;
     * )
        echo "Usage: $0 '[-w(rapfs) | -d(irect)] LOWERTYPE [duration (60 sec default)]'"
-       echo "where LOWERTYPE is one of: ext[234] reiserfs xfs tmpfs nfs"
+       echo "where LOWERTYPE is one of: ext[234] reiserfs xfs tmpfs nfs wrapfs"
        echo "-d will run racer directly on lower fs mount"
        echo "if neither -w nor -d is specified, racer will run through a bind mount"
        exit 1
@@ -117,12 +126,15 @@ case "$lowertype" in
        runcmd mount -t $lowertype -o size=3000m tmpfs $SCRATCH_DIR
        ;;
     nfs )
-       runcmd mkdir -p $LOWER_DIR
        runcmd mkfs -t ext3 -q $SCRATCH_DEV <<< y
        runcmd mount -t ext3  $SCRATCH_DEV $LOWER_DIR
        runcmd exportfs -o no_root_squash,rw localhost:$LOWER_DIR
        runcmd mount -t $lowertype localhost:$LOWER_DIR $SCRATCH_DIR
        ;;
+    wrapfs )
+       runcmd mkfs -t ext4 -q $SCRATCH_DEV <<< y
+       runcmd mount -t ext4 $SCRATCH_DEV $LOWER_DIR
+       runcmd mount -t $lowertype $LOWER_DIR $SCRATCH_DIR
 esac
 case "$type" in
     wrapfs )