From a357ed36cea01526d03416a1e47adf78585a30fd Mon Sep 17 00:00:00 2001 From: aburford Date: Sat, 7 May 2022 15:18:28 -0400 Subject: [PATCH] clean up some previous changes and add comments --- README | 16 ++++++++++++++ fix-remotes.sh | 54 ++++++++++++++++++++++++------------------------ tests/Makefile | 10 +++++++-- tests/ls-test.sh | 36 ++++++++++++++++++++++++++++++++ tests/ls_test.sh | 19 ----------------- tests/w-racer.sh | 14 +++++++++---- update-stable.sh | 5 +++-- 7 files changed, 100 insertions(+), 54 deletions(-) create mode 100755 tests/ls-test.sh delete mode 100755 tests/ls_test.sh diff --git a/README b/README index 75efedd..4793007 100644 --- a/README +++ b/README @@ -36,3 +36,19 @@ $ ./wrapfs-patch-release.sh --version 2.6.32.21 --release-patch yes $ ./wrapfs-patch-release.sh -r yes $ ./wrapfs-patch-release.sh --release-patch yes + +Testing + +The tests directory contains a Makefile and some wrapper scripts for running +racer tests. + +w-racer.sh +A wrapper for racer-fsl.sh which will mkfs and mount the specified lower file +system, stack wrapfs on top of it, and run racer on the wrapfs mount. It can +optionally run racer directly on the lower file system through a bind mount. + +ls-test.sh +This script will run w-racer.sh for the specified lower file system but also +run ls -l in the background 100 times a second to check for corrupted inode +entries (which show up as ??? in ls -l output). It creates a log file +ls-test.log diff --git a/fix-remotes.sh b/fix-remotes.sh index d33121f..fe7040c 100755 --- a/fix-remotes.sh +++ b/fix-remotes.sh @@ -39,35 +39,35 @@ case "$THIS_REPO" in ;; esac -# verify we have both master and wrapfs branches -TMP_BR_LIST=/tmp/.tbr.$$ -TMP_BR2_LIST=/tmp/.tbr2.$$ -( -cat < origin/master - origin/guilt/wrapfs - origin/master - origin/wrapfs -EOF -) > $TMP_BR_LIST -( -cat < origin/master - origin/master - origin/wrapfs -EOF -) > $TMP_BR2_LIST -EXP_BR_LIST=/tmp/.ebr.$$ -git branch -r > $EXP_BR_LIST -if ! cmp $TMP_BR_LIST $EXP_BR_LIST &>/dev/null && ! cmp $TMP_BR2_LIST $EXP_BR_LIST &>/dev/null; then - echo "Expected list of branches mismatched for `basename $PWD`" - diff -u $TMP_BR_LIST $EXP_BR_LIST - /bin/rm -f $TMP_BR_LIST $EXP_BR_LIST -# exit 1 -fi -/bin/rm -f $TMP_BR_LIST $TMP_BR2_LIST $EXP_BR_LIST +# we could verify we have both master and wrapfs branches +# as done below but I don't really see the purpose of this because +# we are going to overwrite/add the origin and korg remote URL's anyway +# so doing this gives us no actionable information. I feel like it just +# confuses the user with what looks like an error but is actually something the +# script is about to fix. +#TMP_BR_LIST=/tmp/.tbr.$$ +#( +#cat < origin/master +# origin/guilt/wrapfs +# origin/master +# origin/wrapfs +#EOF +#) > $TMP_BR_LIST +#EXP_BR_LIST=/tmp/.ebr.$$ +#git branch -r > $EXP_BR_LIST +#if ! cmp $TMP_BR_LIST $EXP_BR_LIST &>/dev/null; then +# echo "Expected list of branches mismatched for `basename $PWD`" +# diff -u $TMP_BR_LIST $EXP_BR_LIST +# /bin/rm -f $TMP_BR_LIST $EXP_BR_LIST +## exit 1 +#fi +#/bin/rm -f $TMP_BR_LIST $EXP_BR_LIST # find out the URL for the remote "origin"` +# `git remote get-url origin` is the newest syntax but the syntax below +# works on newer and older versions of git +# so I'm not sure which is preferable THIS_ORIGIN_URL=`git config --get remote.origin.url 2>/dev/null` #echo THIS_ORIGIN_URL=$THIS_ORIGIN_URL # expected origin URL diff --git a/tests/Makefile b/tests/Makefile index 82b29d4..412425f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -59,8 +59,14 @@ wtests: progs sh w-racer.sh $(OPT) nfs 60 sh w-racer.sh $(OPT) nfs 60 -ls_test: - sh ls_test.sh +ls_tests: + date >> ls-test.log + sh ls-test.sh ext2 60 + sh ls-test.sh ext3 60 + sh ls-test.sh ext4 60 + sh ls-test.sh xfs 60 + sh ls-test.sh tmpfs 60 + sh ls-test.sh reiserfs 60 wtest2: sh w-racer.sh $(OPT) ext2 60 diff --git a/tests/ls-test.sh b/tests/ls-test.sh new file mode 100755 index 0000000..3a50f31 --- /dev/null +++ b/tests/ls-test.sh @@ -0,0 +1,36 @@ +#!/bin/sh +# RACER tests one lower filesystems with ls -l running in background +# we check for ??? entries returned by ls -l and save results to ls-test.log + +function runcmd +{ + echo "CMD: $@" + sleep 0.25 + $@ + ret=$? + if test $ret -ne 0 ; then + exit $ret + fi +} + +type="" # default +case "$1" in + -w | -wrapfs ) type="-w" ; shift ;; +esac +case "$1" in + ext3 | ext2 | ext4 | reiserfs | xfs | tmpfs | nfs ) fstype=$1 ;; + * ) + echo "Usage: $0 '[-w(rapfs)] LOWERTYPE [duration (60 sec default)]'" + echo "where FSTYPE is one of: ext[234] reiserfs xfs tmpfs nfs" + exit 1 + ;; +esac + +# continually run `ls -l` in the background +while true; do ls -l /tmp/r 2>/dev/null|grep ??? >>ls-test.log;sleep 0.01;done & + +echo "$fstype" >> ls-test.log +runcmd ./w-racer.sh $type $fstype $2 + +# kill background `ls -l` loop +kill %1 diff --git a/tests/ls_test.sh b/tests/ls_test.sh deleted file mode 100755 index 6af6cb7..0000000 --- a/tests/ls_test.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -date >> ls_test.log -while true; do ls -l /tmp/r 2>/dev/null|grep ??? >>ls_test.log;sleep 0.01;done & - -echo "ext2" >> ls_test.log -./w-racer.sh ext2 60 -echo "ext3" >> ls_test.log -./w-racer.sh ext3 60 -echo "ext4" >> ls_test.log -./w-racer.sh ext4 60 -echo "xfs" >> ls_test.log -./w-racer.sh xfs 60 -echo "tmpfs" >> ls_test.log -./w-racer.sh tmpfs 60 -echo "reiser" >> ls_test.log -./w-racer.sh reiserfs 60 - -kill %1 diff --git a/tests/w-racer.sh b/tests/w-racer.sh index f948c26..2737281 100755 --- a/tests/w-racer.sh +++ b/tests/w-racer.sh @@ -13,7 +13,7 @@ function runcmd $@ ret=$? if test $ret -ne 0 ; then - echo "$lowertype and $type failed" + echo "$0: $lowertype and $type failed" exit $ret fi } @@ -77,13 +77,19 @@ then cleanup fi +# file system specific mkfs programs have a -q option for quiet but +# it doesn't prevent asking for confirmation when a filesystem already +# exists on the specified disk +# so we must feed in a y to proceed through this prompt +# I couldn't get yes(1) to play nicely with runcmd +# mkfs.ext4 also has a -F force option but this didn't work for me case "$lowertype" in ext2 | ext3 | ext4 | reiserfs ) - runcmd mkfs -t $lowertype -q $SCRATCH_DEV <<< $(echo y) + runcmd mkfs -t $lowertype -q $SCRATCH_DEV <<< y runcmd mount -t $lowertype $SCRATCH_DEV /n/scratch ;; xfs ) - runcmd mkfs -t $lowertype -q -f $SCRATCH_DEV <<< $(echo y) + runcmd mkfs -t $lowertype -q -f $SCRATCH_DEV <<< y runcmd mount -t $lowertype $SCRATCH_DEV /n/scratch ;; tmpfs ) @@ -94,7 +100,7 @@ case "$lowertype" in ;; nfs ) runcmd mkdir -p /n/lower - runcmd mkfs -t ext3 -q $SCRATCH_DEV <<< $(echo y) + runcmd mkfs -t ext3 -q $SCRATCH_DEV <<< y 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 diff --git a/update-stable.sh b/update-stable.sh index b2a357d..61eb305 100755 --- a/update-stable.sh +++ b/update-stable.sh @@ -28,14 +28,15 @@ fi # find out what repo I'm supposed to be (allow override from cmd-line) if test -z "$1"; then - THIS_REPO=`basename $PWD | sed -e 's/^wrapfs-//'` + THIS_REPO=`basename $PWD | sed -e 's/^wrapfs-//' -e 's/\.y$//'` else THIS_REPO="$1" fi #echo THIS_REPO:$THIS_REPO case "$THIS_REPO" in 2.6.* | 3.* | 4.* | 5.* ) - BRANCH="linux-${THIS_REPO}" + # add back the .y that we removed when parsing basename + BRANCH="linux-${THIS_REPO}.y" ;; latest ) BRANCH="master" -- 2.34.1