From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org
Cc: Containers
<containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
Subject: [PATCH 02/11] Make runtests.sh a wrapper for fileio tests
Date: Fri, 29 Jan 2010 12:37:43 -0800 [thread overview]
Message-ID: <20100129203743.GA26721@us.ibm.com> (raw)
In-Reply-To: <20100129202842.GA25490-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
From: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
Date: Fri, 22 Jan 2010 11:55:45 -0800
Subject: [PATCH 02/11] Make runtests.sh a wrapper for fileio tests
Move runtests.sh to run-fileio1.sh and create a runtests.sh that
runs both run-fileio1.sh and run-filelock1.sh. It can later be
extended to run other, possibly all, fileio tests.
Signed-off-by: Sukadev Bhattiprolu <sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
---
fileio/run-fileio1.sh | 148 +++++++++++++++++++++++++++++++++++++++++++++++
fileio/runtests.sh | 153 +++----------------------------------------------
2 files changed, 156 insertions(+), 145 deletions(-)
create mode 100755 fileio/run-fileio1.sh
mode change 100644 => 100755 fileio/runtests.sh
diff --git a/fileio/run-fileio1.sh b/fileio/run-fileio1.sh
new file mode 100755
index 0000000..c7179ab
--- /dev/null
+++ b/fileio/run-fileio1.sh
@@ -0,0 +1,148 @@
+#!/bin/bash
+# Copyright 2009 IBM Corp.
+# Author: Sukadev Bhattiprolu <sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
+
+source ../common.sh
+
+# test_case could be a command-line-arg, but since only one test
+# uses this for now, hard code.
+test_case="fileio1"
+
+dir=`mktemp -p . -d -t cr_${test_case}_XXXXXXX` || (echo "mktemp failed"; exit 1)
+echo "Using output dir $dir"
+
+SLOW_DOWN="$dir/slow-down-fileio"
+CKPT_FILE="$dir/checkpoint-${test_case}"
+CKPT_READY="$dir/checkpoint.ready"
+COPY_DONE="$dir/copy.done"
+SRC_FILE="$dir/input-data.1";
+DEST_FILE="$dir/output-data.1";
+DEST_FILE_SNAP="$dir/output-data.1.snap";
+TEST_LOG="$dir/log.${test_case}"
+TEST_LOG_SNAP="$dir/log.${test_case}.snap"
+
+LOG_FILE="$dir/f1-loop.log"
+TEST_CMD="./$test_case"
+NS_EXEC="../ns_exec"
+
+# Make sure no stray TEST_CMD from another run is still going
+killall $TEST_CMD
+
+#echo > $LOG_FILE
+
+#Create the SRC_FILE
+$TEST_CMD -d $dir -C $SRC_FILE
+
+cnt=1
+sleep_time=3;
+
+NUMTESTS=5
+for testnum in `seq 1 $NUMTESTS`; do
+ echo "----- Iteration $cnt"
+
+ # Copy file slowly, so we can checkpoint
+ touch $SLOW_DOWN
+
+ # Remove CKPT_READY file, start the application and let app tell
+ # us when it is ready
+ rm -f $CKPT_READY;
+ $NS_EXEC -m $TEST_CMD -d $dir -c $SRC_FILE $DEST_FILE &
+ while [ ! -f $CKPT_READY ]; do
+ sleep 1;
+ done;
+
+ # Let it run for a while before checkpointing
+ echo "Created $TEST_CMD process, sleep $sleep_time"
+ sleep $sleep_time
+
+ pid=`pidof $TEST_CMD`
+ if [ "x$pid" == "x" ]; then
+ echo "$TEST_CMD is not running! pid is $pid. fail"
+ ps -ef |grep $TEST_CMD
+ exit 1
+ fi
+
+ freeze_pid $pid
+
+ # Checkpoint
+ echo $CHECKPOINT $pid > $CKPT_FILE
+ $CHECKPOINT $pid > $CKPT_FILE
+ ret=$?
+ if [ $ret -ne 0 ]; then
+ echo "===== Checkpoint of $pid failed"
+ ps aux |grep $TEST_CMD
+ exit 1;
+ fi
+
+ # Snapshot the outfile and log file
+ cp $DEST_FILE $DEST_FILE_SNAP
+ cp $TEST_LOG $TEST_LOG_SNAP
+
+ ls -l $SRC_FILE $DEST_FILE
+
+ thaw $pid
+
+ kill -9 $pid
+
+ # Restore the snapshot after the main process has been killed
+ cp ${DEST_FILE}.snap $DEST_FILE
+
+ cp $TEST_LOG_SNAP $TEST_LOG
+
+ # Remove COPY_DONE file. We will wait below for application to
+ # finish copying and let us know.
+ rm -f $COPY_DONE;
+
+ # Restart.
+ $NS_EXEC -m rstrsh $CKPT_FILE &
+ ret=$?
+
+ if [ $ret -ne 0 ]; then
+ echo "===== Restart of $pid failed"
+ ps aux |grep $TEST_CMD
+ exit 1;
+ fi
+
+ # Find pid of restarted test cmd...
+
+ sleep 1;
+ pid=`pidof $TEST_CMD`
+ if [ "x$pid" == "x" ]; then
+ echo "Can't find pid of $TEST_CMD"
+ exit 1
+ fi
+
+ nspid=`pidof $NS_EXEC`
+ if [ "x$nspid" == "x" ]; then
+ echo "Can't find pid of $NS_EXEC"
+ exit 1
+ fi
+
+ # ...then zip through rest of copy.
+ rm $SLOW_DOWN
+
+ wait $nspid;
+ ret=$?
+
+ echo "$nspid exited, status $ret"
+
+ #ls -l $SRC_FILE $DEST_FILE $CKPT_FILE
+
+ /usr/bin/cmp $SRC_FILE $DEST_FILE
+ if [ $? -ne 0 ]; then
+ echo "file copy ($SRC_FILE -> $DEST_FILE) failed after restart"
+ exit 1;
+ fi
+
+ cnt=$((cnt+1))
+
+ # Change delay so next checkpoint happens at a different point
+ sleep_time=$((sleep_time+1))
+ if [ $sleep_time -gt 10 ]; then
+ sleep_time=2;
+ fi
+done
+
+echo PASS
+
+exit 0
diff --git a/fileio/runtests.sh b/fileio/runtests.sh
old mode 100644
new mode 100755
index 69758f0..3e3e495
--- a/fileio/runtests.sh
+++ b/fileio/runtests.sh
@@ -1,148 +1,11 @@
#!/bin/bash
-# Copyright 2009 IBM Corp.
-# Author: Sukadev Bhattiprolu <sukadev-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
-source ../common.sh
+echo
+echo "****** $0: Running test: fileio1"
+echo
+./run-fileio1.sh
-# test_case could be a command-line-arg, but since only one test
-# uses this for now, hard code.
-test_case="fileio1"
-
-dir=`mktemp -p . -d -t cr_${test_case}_XXXXXXX` || (echo "mktemp failed"; exit 1)
-echo "Using output dir $dir"
-
-SLOW_DOWN="$dir/slow-down-fileio"
-CKPT_FILE="$dir/checkpoint-${test_case}"
-CKPT_READY="$dir/checkpoint.ready"
-COPY_DONE="$dir/copy.done"
-SRC_FILE="$dir/input-data.1";
-DEST_FILE="$dir/output-data.1";
-DEST_FILE_SNAP="$dir/output-data.1.snap";
-TEST_LOG="$dir/log.${test_case}"
-TEST_LOG_SNAP="$dir/log.${test_case}.snap"
-
-LOG_FILE="$dir/f1-loop.log"
-TEST_CMD="./$test_case"
-NS_EXEC="../ns_exec"
-
-# Make sure no stray TEST_CMD from another run is still going
-killall $TEST_CMD
-
-#echo > $LOG_FILE
-
-#Create the SRC_FILE
-$TEST_CMD -d $dir -C $SRC_FILE
-
-cnt=1
-sleep_time=3;
-
-NUMTESTS=5
-for testnum in `seq 1 $NUMTESTS`; do
- echo "----- Iteration $cnt"
-
- # Copy file slowly, so we can checkpoint
- touch $SLOW_DOWN
-
- # Remove CKPT_READY file, start the application and let app tell
- # us when it is ready
- rm -f $CKPT_READY;
- $NS_EXEC -m $TEST_CMD -d $dir -c $SRC_FILE $DEST_FILE &
- while [ ! -f $CKPT_READY ]; do
- sleep 1;
- done;
-
- # Let it run for a while before checkpointing
- echo "Created $TEST_CMD process, sleep $sleep_time"
- sleep $sleep_time
-
- pid=`pidof $TEST_CMD`
- if [ "x$pid" == "x" ]; then
- echo "$TEST_CMD is not running! pid is $pid. fail"
- ps -ef |grep $TEST_CMD
- exit 1
- fi
-
- freeze_pid $pid
-
- # Checkpoint
- echo $CHECKPOINT $pid > $CKPT_FILE
- $CHECKPOINT $pid > $CKPT_FILE
- ret=$?
- if [ $ret -ne 0 ]; then
- echo "===== Checkpoint of $pid failed"
- ps aux |grep $TEST_CMD
- exit 1;
- fi
-
- # Snapshot the outfile and log file
- cp $DEST_FILE $DEST_FILE_SNAP
- cp $TEST_LOG $TEST_LOG_SNAP
-
- ls -l $SRC_FILE $DEST_FILE
-
- thaw $pid
-
- kill -9 $pid
-
- # Restore the snapshot after the main process has been killed
- cp ${DEST_FILE}.snap $DEST_FILE
-
- cp $TEST_LOG_SNAP $TEST_LOG
-
- # Remove COPY_DONE file. We will wait below for application to
- # finish copying and let us know.
- rm -f $COPY_DONE;
-
- # Restart.
- $NS_EXEC -m rstrsh $CKPT_FILE &
- ret=$?
-
- if [ $ret -ne 0 ]; then
- echo "===== Restart of $pid failed"
- ps aux |grep $TEST_CMD
- exit 1;
- fi
-
- # Find pid of restarted test cmd...
-
- sleep 1;
- pid=`pidof $TEST_CMD`
- if [ "x$pid" == "x" ]; then
- echo "Can't find pid of $TEST_CMD"
- exit 1
- fi
-
- nspid=`pidof $NS_EXEC`
- if [ "x$nspid" == "x" ]; then
- echo "Can't find pid of $NS_EXEC"
- exit 1
- fi
-
- # ...then zip through rest of copy.
- rm $SLOW_DOWN
-
- wait $nspid;
- ret=$?
-
- echo "$nspid exited, status $ret"
-
- #ls -l $SRC_FILE $DEST_FILE $CKPT_FILE
-
- /usr/bin/cmp $SRC_FILE $DEST_FILE
- if [ $? -ne 0 ]; then
- echo "file copy ($SRC_FILE -> $DEST_FILE) failed after restart"
- exit 1;
- fi
-
- cnt=$((cnt+1))
-
- # Change delay so next checkpoint happens at a different point
- sleep_time=$((sleep_time+1))
- if [ $sleep_time -gt 10 ]; then
- sleep_time=2;
- fi
-done
-
-echo PASS
-
-exit 0
+echo
+echo "****** $0: Running test: filelock1"
+echo
+./run-filelock1.sh
--
1.6.0.4
next prev parent reply other threads:[~2010-01-29 20:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-29 20:28 [PATCH 01/11] runtests.sh: Make test bit more generic Sukadev Bhattiprolu
[not found] ` <20100129202842.GA25490-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-01-29 20:37 ` Sukadev Bhattiprolu [this message]
2010-01-29 20:38 ` [PATCH 03/11] Check for failure while waiting for checkpoint-ready Sukadev Bhattiprolu
2010-01-29 20:42 ` [PATCH 04/11] Rename run-filelock1 to run-fcntltests.sh Sukadev Bhattiprolu
2010-01-29 20:42 ` [PATCH 05/11] Move event-notifications to libcrtest/common.c Sukadev Bhattiprolu
[not found] ` <20100129204228.GD26721-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-01-30 2:44 ` Serge E. Hallyn
2010-01-29 20:42 ` [PATCH 06/11] filelease1: Test restore of file leases Sukadev Bhattiprolu
2010-01-29 20:43 ` [PATCH 07/11] fsetown1: Test async I/O notification after restart Sukadev Bhattiprolu
2010-01-29 20:43 ` [PATCH 08/11] filelock1: Extend for mandatory locks Sukadev Bhattiprolu
2010-01-29 20:43 ` [PATCH 09/11] pthread1: Don't close stderr() before opening log Sukadev Bhattiprolu
2010-01-29 20:44 ` [PATCH 10/11] filelock2: Test restart of process in F_GETLK Sukadev Bhattiprolu
2010-01-29 20:44 ` [PATCH 11/11] filelease2: Test C/R during lease-break-interval Sukadev Bhattiprolu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100129203743.GA26721@us.ibm.com \
--to=sukadev-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.