update
authorErez Zadok <ezk@cs.sunysb.edu>
Mon, 25 Apr 2022 16:18:27 +0000 (12:18 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Mon, 25 Apr 2022 16:18:27 +0000 (12:18 -0400)
tests/w-install.sh [new file with mode: 0755]
tests/w-racer.sh [new file with mode: 0755]
tests/w-scanlog.sh [new file with mode: 0755]

diff --git a/tests/w-install.sh b/tests/w-install.sh
new file mode 100755 (executable)
index 0000000..68a89cc
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+#set -x
+#REPO=`egrep -v ^# ${HOME}/U/.makeu`
+
+#if test -z "$REPO" ; then
+#    REPO=`uname -r | sed 's/-.*$//g' | cut -d. -f3`
+#fi
+#test -z "$REPO" && exit 1
+
+#cd ${HOME}/U/$REPO || exit 1
+#TOP=${HOME}/U/$REPO
+TOP=/lib/modules/`uname -r`/build
+
+MODULES="unionfs wrapfs nfs nfsd jffs2 xfs overlayfs"
+for MOD in $MODULES; do
+    test -f $TOP/fs/$MOD/$MOD.ko && \
+       cp -uv $TOP/fs/$MOD/$MOD.ko \
+               /lib/modules/`uname -r`/kernel/fs/$MOD
+done
+#make modules_install
+
+MTD=drivers/mtd/devices/block2mtd.ko
+test -f $TOP/$MTD && cp -uv $TOP/$MTD /lib/modules/`uname -r`/kernel/$MTD
+
+exit 0
diff --git a/tests/w-racer.sh b/tests/w-racer.sh
new file mode 100755 (executable)
index 0000000..59827d7
--- /dev/null
@@ -0,0 +1,152 @@
+#!/bin/sh
+# RACER tests
+
+##############################################################################
+# scratch device to mount on /n/scratch
+#SCRATCH_DEV=/dev/hdd2
+SCRATCH_DEV=/dev/sdb1
+
+function runcmd
+{
+    echo "CMD: $@"
+    sleep 0.25
+    $@
+    ret=$?
+    if test $ret -ne 0 ; then
+       exit $ret
+    fi
+}
+function runcmd2
+{
+    echo "CMD: $@"
+    sleep 0.25
+    $@
+#    ret=$?
+}
+
+function cleanup
+{
+# cleanup
+case "$type" in
+    wrapfs )
+       runcmd umount /tmp
+       runcmd rmmod wrapfs
+       ;;
+    bind )
+       runcmd umount /tmp
+       ;;
+esac
+#read n
+case "$lowertype" in
+    ext2 | ext3 | ext4 |  reiserfs | xfs )
+       runcmd umount /n/scratch
+       ;;
+    tmpfs )
+       runcmd umount /n/scratch
+       runcmd swapoff $SCRATCH_DEV
+       ;;
+    nfs )
+       runcmd umount /n/scratch
+       runcmd exportfs -u localhost:/n/lower
+       runcmd umount /n/lower
+       ;;
+esac
+}
+
+# decide what type of test
+type="bind"    # default
+case "$1" in
+    -w | -wrapfs ) type="wrapfs" ; shift ;;
+esac
+case "$1" in
+    ext3 | ext2 | ext4 | reiserfs | xfs | tmpfs | nfs ) lowertype=$1 ;;
+    * )
+       echo "Usage: $0 '[-w(rapfs)] LOWERTYPE [duration (60 sec default)]'"
+       echo "where LOWERTYPE is one of: ext[234] reiserfs xfs tmpfs nfs"
+       exit 1
+       ;;
+esac
+
+runcmd2 ./j-install.sh
+#runcmd2 ./j-syslog.sh
+
+# cleanup if needed
+if egrep -q $type /proc/mounts
+then
+    cleanup
+fi
+
+case "$lowertype" in
+    ext2 | ext3 | ext4 | reiserfs )
+       runcmd mkfs -t $lowertype -q $SCRATCH_DEV
+       runcmd mount -t $lowertype $SCRATCH_DEV /n/scratch
+       ;;
+    xfs )
+       runcmd mkfs -t $lowertype -q -f $SCRATCH_DEV
+       runcmd mount -t $lowertype $SCRATCH_DEV /n/scratch
+       ;;
+    tmpfs )
+       runcmd mkswap $SCRATCH_DEV
+       runcmd swapon $SCRATCH_DEV
+       runcmd swapon -s
+       runcmd mount -t $lowertype -o size=3000m tmpfs /n/scratch
+       ;;
+    nfs )
+       runcmd mkdir -p /n/lower
+       runcmd mkfs -t ext3 -q $SCRATCH_DEV
+       runcmd mount -t ext3  $SCRATCH_DEV /n/lower
+       runcmd exportfs -o no_root_squash,rw localhost:/n/lower
+       runcmd mount -t $lowertype localhost:/n/lower /n/scratch
+       ;;
+esac
+case "$type" in
+    wrapfs )
+       runcmd mount -t wrapfs /n/scratch /tmp
+       ;;
+    bind )
+       runcmd mount -o bind /n/scratch /tmp
+       ;;
+esac
+
+# (df /tmp /n/scratch ; df -i /tmp /n/scratch) > /var/tmp/.racer0.$$
+
+# run actual racer tests (30 seconds)
+runcmd find /tmp -ls
+runcmd df /tmp
+runcmd df -i /tmp
+runcmd ../racer/racer2.sh /tmp/r ${2:-60}
+runcmd sync
+if test $? != 0 ; then
+    ps -ef | grep bash
+    set -x; find /tmp/r -ls ; set +x
+    echo "*** RACER FAILED ***!!!! (hit enter to continue)..."
+    sleep 5
+fi
+#runcmd ../racer/fs_racer2.sh -t ${2:-30}
+#runcmd sleep 1
+runcmd sync
+runcmd find /tmp -ls
+runcmd sync
+#runcmd sleep 1
+runcmd df /tmp
+runcmd sync
+#runcmd sleep 1
+runcmd df -i /tmp
+runcmd sync
+#runcmd sleep 1
+
+runcmd sync    # to let lower inodes/blocks purge before "df"
+# (df /tmp /n/scratch ; df -i /tmp /n/scratch) > /var/tmp/.racer1.$$
+# if cmp -s /var/tmp/.racer0.$$ /var/tmp/.racer1.$$ ; then
+#     rm -f /var/tmp/.racer0.$$ /var/tmp/.racer1.$$
+#     echo INODE/BLOCK ACCOUNTING IS GOOD.
+# else
+#     echo BAD INODE/BLOCK ACCOUNTING:
+#     set -x
+#     diff /var/tmp/.racer0.$$ /var/tmp/.racer1.$$
+#     exit 123
+# fi
+
+cleanup
+
+./j-scanlog.sh
diff --git a/tests/w-scanlog.sh b/tests/w-scanlog.sh
new file mode 100755 (executable)
index 0000000..9802091
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+#set -x
+
+SKIP='CLEANMARKER|flash|ReiserFS:'
+#SKIP="${SKIP}"'|DBG'
+OUTPUT_COLOR="1;31"
+test -n "$OUTPUT_COLOR" && echo -e -n "\033[${OUTPUT_COLOR}m"
+
+tmp=/tmp/.ll.$$
+: > $tmp
+#cat /var/log/all | cut -d: -f4- | cut -c2- | while read i
+dmesg | while read i
+do
+#    echo "LINE:$i:"
+    case "$i" in
+       *Registering\ unionfs* | *Registering\ wrapfs* )
+           echo "$i" > $tmp
+           ;;
+       * )
+           echo "$i" >> $tmp
+           ;;
+    esac
+done
+cat $tmp | egrep -v $SKIP | grep -v '^$'
+rm -f $tmp
+test -n "$OUTPUT_COLOR" && echo -e -n "\033[m"
+#cat /var/log/all | cut -d: -f4- | cut -c2-