summaryrefslogtreecommitdiffstats
path: root/run.sh
diff options
context:
space:
mode:
Diffstat (limited to 'run.sh')
-rwxr-xr-xrun.sh65
1 files changed, 47 insertions, 18 deletions
diff --git a/run.sh b/run.sh
index d434edb..44427e2 100755
--- a/run.sh
+++ b/run.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# Copyright (c) 2006-2009 Gluster, Inc. <http://www.gluster.com>
# This file is part of GlusterFS.
@@ -17,20 +17,49 @@
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
-GLUSTERFS=$1
-OLDDIR=`pwd`
-
-if [ 1 -ne $# ]
-then
- echo "Usage: run.sh <path_to_glusterfs_binary>"
- return;
-fi
-
-for i in `ls | grep "^[0-9]*$"|sort -n`
-do
- cd $i/regr
- if [ -f ./testcase ];then
- ./testcase $GLUSTERFS
- fi
- cd $OLDDIR
-done
+_init ()
+{
+ [ $# -lt 1 ] && {
+ echo "#<Usage: $(basename $0) <complete_path_to_glusterd> [bug id]"
+ exit;
+ }
+
+ source ./init
+ source ./regression_helpers
+ export GLUSTERD=$1
+ bug_id=;
+ if [ $# -eq 2 ]; then
+ bug_id=$2;
+ fi
+ export EXPORT_DIR="/regression/export";
+}
+
+main ()
+{
+ check_glusterd_running;
+ if [ $? -ne 0 ]; then
+ echo "glusterd is already running. Please stop and run the script";
+ exit;
+ fi
+
+ start_glusterd $GLUSTERD;
+ if [ $? -ne 0 ]; then
+ return 2;
+ fi
+
+ create_directory $EXPORT_DIR;
+
+ if [ ! $bug_id ]; then
+ run_testcase;
+ else
+ run_testcase $bug_id;
+ fi
+
+ final_kill;
+
+ final_cleanup;
+
+ return 0;
+}
+
+_init "$@" && main "$@"