Skip to content

Commit

Permalink
test.sh: syntax cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
OGAWAHirofumi committed Jan 26, 2017
1 parent f64cdf4 commit 521bdd9
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions tests/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ check_core()
HANDLED=0

for core in core*; do
if echo $core | egrep '^core(\.[0-9]+)?$' > /dev/null; then
if [ -r $core ]; then
if echo "$core" | egrep '^core(\.[0-9]+)?$' > /dev/null; then
if [ -r "$core" ]; then
echo "==== $core ===="
gdb --batch --eval-command=bt $COMMAND $core
gdb --batch --eval-command=bt $COMMAND "$core"

HANDLED=$(($HANDLED + 1))
HANDLED=$((HANDLED + 1))
fi
fi
done
Expand All @@ -31,7 +31,7 @@ run_test()
shift
fi

echo "==== $@ ===="
echo "==== $* ===="
if [ $BACKGROUND = 0 ]; then
time "$@"
else
Expand All @@ -44,9 +44,9 @@ run_test()
N=0
while jobs %1 > /dev/null 2>&1; do
# Output keepalive message
if [ $N != 0 -a $((N % TEST_KEEPALIVE)) = 0 ]; then
echo "== $N secs == \"$@\" is still running"
df -h $TUX3_MNT
if [ $N != 0 ] && [ $((N % TEST_KEEPALIVE)) = 0 ]; then
echo "== $N secs == \"$*\" is still running"
df -h "$TUX3_MNT"
vmstat $TEST_INTERVAL 2 | sed -e '3d'
else
sleep $TEST_INTERVAL
Expand All @@ -62,14 +62,14 @@ run_test()

mount_tux3()
{
run_test mount -t tux3 $TUX3_DEV $TUX3_MNT
run_test mount -t tux3 "$TUX3_DEV" "$TUX3_MNT"
}

umount_tux3()
{
run_test df -h $TUX3_MNT
run_test umount $TUX3_MNT
run_test -b tux3 fsck $TUX3_DEV
run_test df -h "$TUX3_MNT"
run_test umount "$TUX3_MNT"
run_test -b tux3 fsck "$TUX3_DEV"
}

trap "check_core" EXIT
Expand All @@ -95,9 +95,9 @@ free
echo "==== lsblk -iftDm ===="
lsblk -iftDm
echo "==== hdparm -I $TUX3_DEV ===="
hdparm -I $TUX3_DEV || true
hdparm -I "$TUX3_DEV" || true
echo "==== sdparm -l -i $TUX3_DEV ===="
sdparm -l -i $TUX3_DEV || true
sdparm -l -i "$TUX3_DEV" || true
echo "==== uname -a ===="
uname -a
echo "==== id -a ===="
Expand All @@ -113,14 +113,14 @@ old_panic_on_oops=$(cat /proc/sys/kernel/panic_on_oops)
echo 1 > /proc/sys/kernel/panic_on_oops

# Copy command to dir in PATH
cp $TUX3_CMD bin
cp "$TUX3_CMD" bin

TUX3_MNT="$TOPDIR/mnt"

mkdir $TUX3_MNT
mkdir "$TUX3_MNT"

for blocksize in 512 4096; do
run_test tux3 mkfs -b $blocksize $TUX3_DEV
run_test tux3 mkfs -b $blocksize "$TUX3_DEV"

# fsx-linux without some operations
# -W no mmap write
Expand All @@ -137,7 +137,7 @@ for blocksize in 512 4096; do
-FH \
-N $NUM_OP \
-l $SIZE \
$TUX3_MNT/testfile
"$TUX3_MNT/testfile"
umount_tux3

# fsstress
Expand All @@ -150,13 +150,13 @@ for blocksize in 512 4096; do

echo "======== fsstress ($i) ========"
mount_tux3
run_test -b rm -rf $TUX3_MNT/fsstress
run_test -b rm -rf "$TUX3_MNT/fsstress"
run_test -b fsstress \
-n $NUM_OPS \
-p $NUM_PROCESS \
-d $TUX3_MNT/fsstress
-d "$TUX3_MNT/fsstress"
umount_tux3
done
done

echo $old_panic_on_oops > /proc/sys/kernel/panic_on_oops
echo "$old_panic_on_oops" > /proc/sys/kernel/panic_on_oops

0 comments on commit 521bdd9

Please sign in to comment.