}
usage() {
- echo "Usage: $0 <ADML directory> <testcase variable file> <initial sequence> <final sequence> [number of groups]"
+ echo "Usage: $0 <ADML directory> <testcase variable file> <initial sequence> <final sequence> [number of groups] [population]"
echo
echo " ADML directory: path to the ADML directory where 'operation.sh' script is used to load the test cases."
echo " testcase variable file: path to the testcase file with parseable variables, for example '<directory>/testcase.txt.msk'."
echo " __SRX1_SUFFIX__: \""
echo " __SGX2_SUFFIX__: 2<8-digit sequence>"
echo " __SRX2_SUFFIX__: \""
+ echo " Edit the variables section to add more special values if you need them."
echo
echo " initial sequence: initial sequence number to parse over variables."
echo " final sequence: final sequence number to parse over variables."
echo " number of groups: number of background group jobs to clone the provided sequence range."
- echo " By default, it will be the number of items divided by 25, with a maximum of $MAX_NUMBER_GROUPS."
- echo
- echo
+ echo " By default (or if you provide \"\"), it will be the number of items divided by 25, with a maximum"
+ echo " of $MAX_NUMBER_GROUPS."
+ echo " population: Optionally, a population file (basename) can be provided. It must exist on the same directory"
+ echo " than other stuff (testcase, xml files). The behaviour will be the accumulation of every parsing"
+ echo " operation during clone procedure regarding the templated content of the population file. The"
+ echo " accumulated content will be dump over a new file created together with cloned <population> and"
+ echo " named with the extension '.all' (<population>.all). This population file could be useful to"
+ echo " specify database commands related to each sequence (each single testcase), in order to have"
+ echo " the whole population file. This won't include common database elements for the tested scenary,"
+ echo " which shall be provisioned in a separated procedure."
+ echo
_exit
}
local wkdir=$2
mkdir -p $wkdir
- # Values:
+ ############################################# SPECIAL VARIABLES SECTION #############################################
+ ################################ EDIT THIS SECTION IF YOU NEED NEW SPECIAL VARIABLES ################################
testid=$sequence
seq8=$(printf "%08d" $testid)
msisdn9=6${seq8}
echo "__SRX2_SUFFIX__=$srx2_suffix" >> $target
source $target
#rm $target
+ ######################################### END SPECIAL VARIABLES SECTION #########################################
+
# Parse template files:
parse_file $sequence $TESTCASE_TEMPLATE $wkdir/testcase.txt.$sequence
done
cat $wkdir/testcase.txt.$sequence >> $wkdir/testcase.txt
rm $wkdir/testcase.txt.$sequence
+
+ # Population:
+ if [ -n "$POPULATION_FILE" ]
+ then
+ parse_file $sequence $POPULATION_FILE $CLONE_WKDIR/${POPULATION}.$sequence
+ cat $CLONE_WKDIR/${POPULATION}.$sequence >> $POPULATION_ALL
+ fi
}
# $1: group number; $2: initial subrange value; $3: final subrange value
for i in `seq $2 $3`
do
clone $i $CLONE_WKDIR/$1
- #sleep 0.01
+ sleep 0.01
done
}
ADML_DIR=$1
TESTCASE_TEMPLATE=`readlink -f $2`
+TESTCASE_TEMPLATE_DIR=`dirname $TESTCASE_TEMPLATE`
CLONE_SEQ_BEGIN=$3
CLONE_SEQ_END=$4
N_GROUPS=$5
+POPULATION=$6
+POPULATION_FILE=$TESTCASE_TEMPLATE_DIR/$POPULATION
+POPULATION_ALL=$TESTCASE_TEMPLATE_DIR/${POPULATION}.all
[ "$4" = "" ] && usage
[ ! -f $OPERATION ] && _exit "Missing '$OPERATION' file !!"
[ ! -f $TESTCASE_TEMPLATE ] && _exit "Missing '$TESTCASE_TEMPLATE' testcase template file !!"
-TESTCASE_TEMPLATE_DIR=`dirname $TESTCASE_TEMPLATE`
+if [ -n "$POPULATION" ]
+then
+ bn_population=`basename $POPULATION`
+ [ "$bn_population" != "$POPULATION" ] && _exit "Only basename is allowed for population provided !!"
+ [ ! -f $POPULATION_FILE ] && _exit "Missing provided population file '$POPULATION_FILE' !!"
+ 0> $POPULATION_ALL
+fi
+
N_ITEMS=$((CLONE_SEQ_END - CLONE_SEQ_BEGIN + 1))
if [ -z "$N_GROUPS" ]
then
timestamp_begin=$(echo "scale=3 ; $(date '+%s') + $(date '+%N') / 1000000000" | bc)
children_before=$(children)
offset=0
-echo "Please be patient, this may take a while ..."
$OPERATION "test|clear"
+echo "Please be patient, this may take a while ..."
+#echo "Temporary directory: $CLONE_WKDIR"
for group in `seq 1 $((N_GROUPS+1))`
do
n_begin=$((CLONE_SEQ_BEGIN + offset))
clone_group $group $n_begin $n_end &
offset=$((group * GROUPS_SIZE))
done
-children_now=$(children)
# Wait background jobs to finish:
while true