@@ -15,22 +15,14 @@ runner_list=()
runtimes=()
show_test_list=
run_section=""
+iam="check-parallel"
tmp=/tmp/check-parallel.$$
-TEST_DEV_SIZE=${TEST_DEV_SIZE:=10G}
-TEST_RTDEV_SIZE=${TEST_RTDEV_SIZE:=10G}
-TEST_LOGDEV_SIZE=${TEST_LOGDEV_SIZE:=128M}
-SCRATCH_DEV_SIZE=${SCRATCH_DEV_SIZE:=20G}
-SCRATCH_RTDEV_SIZE=${SCRATCH_RTDEV_SIZE:=20G}
-SCRATCH_LOGDEV_SIZE=${SCRATCH_LOGDEV_SIZE:=512M}
-LOGWRITES_DEV_SIZE=${LOGWRITES_DEV_SIZE:=2G}
-
-FSTYP=
-
. ./common/exit
. ./common/test_names
. ./common/test_list
+. ./common/config-sections
usage()
{
@@ -332,6 +324,8 @@ cleanup()
trap "cleanup; exit" HUP INT QUIT TERM
+_config_setup_parallel
+
split_runner_list
if [ -n "$show_test_list" ]; then
echo Time ordered test list:
@@ -329,6 +329,7 @@ get_next_config() {
known_hosts()
{
+ [ -z "$HOST" ] && export HOST=`hostname -s`
[ "$HOST_CONFIG_DIR" ] || HOST_CONFIG_DIR=`pwd`/configs
[ -f /etc/xfsqa.config ] && export HOST_OPTIONS=/etc/xfsqa.config
@@ -336,7 +337,7 @@ known_hosts()
[ -f $HOST_CONFIG_DIR/$HOST.config ] && export HOST_OPTIONS=$HOST_CONFIG_DIR/$HOST.config
}
-_config_section_setup()
+_config_file_setup()
{
if [ ! -f "$HOST_OPTIONS" ]; then
known_hosts
@@ -346,13 +347,32 @@ _config_section_setup()
export OPTIONS_HAVE_SECTIONS=false
if [ -f "$HOST_OPTIONS" ]; then
export HOST_OPTIONS_SECTIONS=`get_config_sections $HOST_OPTIONS`
- if [ -z "$HOST_OPTIONS_SECTIONS" ]; then
- . $HOST_OPTIONS
- export HOST_OPTIONS_SECTIONS="-no-sections-"
- else
+ if [ -n "$HOST_OPTIONS_SECTIONS" ]; then
export OPTIONS_HAVE_SECTIONS=true
fi
fi
+}
+
+_config_section_setup()
+{
+ if [ "$iam" == "check-parallel" ]; then
+ echo "$iam: incorrect config file format chosen!"
+ exit 1;
+ fi
+
+ _config_file_setup
+
+ # If we don't have sections, source the options from the config file.
+ # Otherwise, strip sections that should not be run by check that may be
+ # present in the config file
+ if [ "$OPTIONS_HAVE_SECTIONS" != "true" ]; then
+ . $HOST_OPTIONS
+ export HOST_OPTIONS_SECTIONS="-no-sections-"
+ else
+ export HOST_OPTIONS_SECTIONS=$(echo $HOST_OPTIONS_SECTIONS | \
+ sed -e 's/check-parallel//')
+ fi
+
if [ -z "$CONFIG_INCLUDED" ]; then
get_next_config `echo $HOST_OPTIONS_SECTIONS | cut -f1 -d" "`
@@ -388,3 +408,51 @@ _config_section_setup()
fi
fi
}
+
+# check-parallel config files must:
+# 1. have config sections defined
+# 2. use the first config section for check-parallel setup
+# 3. not define any physical device parameter in any section
+#
+# If all these are true, then we read the first section that defines
+# the check-parallel config parameters and continue onwards.
+_config_setup_parallel()
+{
+ if [ "$iam" != "check-parallel" ]; then
+ echo "$iam: incorrect config file format chosen!"
+ exit 1;
+ fi
+
+ _config_file_setup
+
+ if [ "$OPTIONS_HAVE_SECTIONS" != "true" ]; then
+ echo "$iam config file has no sections!"
+ exit 1;
+ fi
+
+ local first_section=`echo $HOST_OPTIONS_SECTIONS | cut -f1 -d" "`
+ if [ "$first_section" != "$iam" ]; then
+ echo "$iam config file has no [$iam] section"
+ exit 1
+ fi
+
+ grep DEV $HOST_OPTIONS |grep -qv SIZE
+ if [ $? -ne 1 ]; then
+ echo "$iam config file has devices defined"
+ exit 1
+ fi
+
+ # we only need to pull in the config parameters here and set defaults
+ # if they are not set after pulling in the config values.
+ parse_config_section $1
+
+ TEST_DEV_SIZE=${TEST_DEV_SIZE:=10G}
+ TEST_RTDEV_SIZE=${TEST_RTDEV_SIZE:=10G}
+ TEST_LOGDEV_SIZE=${TEST_LOGDEV_SIZE:=128M}
+ SCRATCH_DEV_SIZE=${SCRATCH_DEV_SIZE:=20G}
+ SCRATCH_RTDEV_SIZE=${SCRATCH_RTDEV_SIZE:=20G}
+ SCRATCH_LOGDEV_SIZE=${SCRATCH_LOGDEV_SIZE:=512M}
+ LOGWRITES_DEV_SIZE=${LOGWRITES_DEV_SIZE:=2G}
+
+ FSTYP=${FSTYP:=xfs}
+}