}
usage() {
- echo "Usage: $0 <test stuff directory> [-s]"
- echo
- echo " Performs test case programming from scratch (current test cases will be dropped from ADML involved instances)."
- echo
- echo " test stuff directory: contains msk files, specially a testcase file with xml files referenced inside. Those"
- echo " xml files (without the .msk extension) shall exists in the directory. For example:"
- echo
- echo " $0 st_examples/DynamicQualification"
- echo
- echo " Optionally, a file called 'specific' could exists containing testcase-specific information,"
- echo " which normally will be used to specify database sentences. This file will be accumulated"
- echo " as a cloning seed over the file 'specific.all' created on test stuff directory."
- echo
- echo
- echo " -s: start testing just after programming, using desired rate: $DESIRED_RATE test cases per second."
+ cat << EOF
+Usage: $0 <test stuff directory|dynamic> [-s]
+
+ Performs test case programming from scratch (current test cases will be dropped
+ from ADML involved instances). There are two types of programming depending on
+ the first argument provided:
+
+ test stuff directory:
+
+ The folder provided must contain msk files, specially a testcase file with
+ xml files referenced inside. Those xml files (without the .msk extension)
+ shall exists in the directory. For example:
+
+ $0 st_examples/DynamicQualification
+
+ Optionally, a file 'specific' could exists containing testcase-specific
+ information, which normally will be used to specify database sentences.
+ This file will be accumulated as a cloning seed over the file 'specific.all'
+ created on test stuff directory.
+
+ Template type programming could be used for medium-duration testings, because
+ the scripting used for programming, have lots of groups divisions which even
+ background-executed are much more slower on programming than a c++ builtin
+ procedure: dynamic type is the one for large sets of test cases:
+
+
+ dynamic:
+
+ The current dynamic procedure selected by mean 'dynlibs/select.sh' script,
+ will be programmed using its dirname resources: inside, you may found not
+ only the .so library but the needed xml files for the implemented scenary
+ and a file called 'dynamic.suffix' used to complete the dynamic operation
+ in this way:
+
+ dynamic|<initial sequence>|<final sequence>|<dynamic.suffix content>
+
+ For example, you could have this content for 'dynamic.suffix':
+
+ 7|CCR-I.xml|CCR-T.xml
+
+ in order to generate the operation:
+
+ dynamic|<initial sequence>|<final sequence>|7|CCR-I.xml|CCR-T.xml
+
+ which would be parsed for the specific ADML instance programmed:
+
+ dynamic|2000001|2001000|7|CCR-I.xml|CCR-T.xml
+
+ The file 'dynamic.suffix' could have several lines for several scenaries.
+ In this case, this script will prompt for the desired one.
+
+ This script will build every operation for the configured ADML instances
+ to complete all the sequence ranges along the whole test system.
+
+
+
+ -s: start testing just after programming, using desired rate: $DESIRED_RATE test cases per second.
+EOF
[ $ADML_INSTANCES -gt 1 ] && echo " In your case, with $ADML_INSTANCES, a rate of $RATE_PER_INSTANCE ttps will be send per instance."
echo
_exit
./operation.sh --ping >/dev/null
[ $? -ne 0 ] && _exit "Programming aborted (some ADML client process is not running) !"
-TESTCASE_DIR=$1
+
+# Arguments:
+PROG_TYPE=$1
AUTOSTART=$2
-[ ! -d $TESTCASE_DIR ] && _exit "Cannot found the test directory '$TESTCASE_DIR' !!"
-TESTCASE=( `ls $TESTCASE_DIR/testcase*msk 2>/dev/null` )
-TESTCASE_FILES=${#TESTCASE[@]}
-[ $TESTCASE_FILES -ne 1 ] && _exit "One and only one 'testcase*msk' file must be present !!"
-
-MAX_NUMBER_GROUPS=$(grep ^MAX_NUMBER_GROUPS= clone.sh | cut -d= -f2)
-CLONE_GROUPS=$((MAX_NUMBER_GROUPS/ADML_INSTANCES))
-#CLONE_GROUPS=1
-specific=
-[ -f $TESTCASE_DIR/specific ] && specific=specific
-
-[ -z "$ADML_CONCURRENT_PROVISION_JOBS" ] && ADML_CONCURRENT_PROVISION_JOBS=5
-
-count=0
-while read -r line
-do
- instance=$(echo $line | awk '{ print $1 }')
- ini_seq=$(echo $line | awk '{ print $2 }')
- fin_seq=$(echo $line | awk '{ print $3 }')
- ADML_DIR=`readlink -f ADMLS/ADML-$instance`
- echo -e "\rCloning interval [$ini_seq,$fin_seq] for $(basename $ADML_DIR) ..."
- ./clone.sh $ADML_DIR $TESTCASE $ini_seq $fin_seq $CLONE_GROUPS $specific &
- sleep 0.1
- count=$((count+1))
- if [ $count -eq $ADML_CONCURRENT_PROVISION_JOBS ]
+# test case stuff programming #########################################################
+if [ "$PROG_TYPE" != "dynamic" ]
+then
+ TESTCASE_DIR=$PROG_TYPE
+
+ [ ! -d $TESTCASE_DIR ] && _exit "Cannot found the test directory '$TESTCASE_DIR' !!"
+ TESTCASE=( `ls $TESTCASE_DIR/testcase*msk 2>/dev/null` )
+ TESTCASE_FILES=${#TESTCASE[@]}
+ [ $TESTCASE_FILES -ne 1 ] && _exit "One and only one 'testcase*msk' file must be present !!"
+
+ MAX_NUMBER_GROUPS=$(grep ^MAX_NUMBER_GROUPS= clone.sh | cut -d= -f2)
+ CLONE_GROUPS=$((MAX_NUMBER_GROUPS/ADML_INSTANCES))
+ #CLONE_GROUPS=1
+ specific=
+ [ -f $TESTCASE_DIR/specific ] && specific=specific
+
+ [ -z "$ADML_CONCURRENT_PROVISION_JOBS" ] && ADML_CONCURRENT_PROVISION_JOBS=5
+
+ count=0
+ while read -r line
+ do
+ instance=$(echo $line | awk '{ print $1 }')
+ ini_seq=$(echo $line | awk '{ print $2 }')
+ fin_seq=$(echo $line | awk '{ print $3 }')
+ ADML_DIR=`readlink -f ADMLS/ADML-$instance`
+ echo -e "\rCloning interval [$ini_seq,$fin_seq] for $(basename $ADML_DIR) ..."
+ ./clone.sh $ADML_DIR $TESTCASE $ini_seq $fin_seq $CLONE_GROUPS $specific &
+ sleep 0.1
+ count=$((count+1))
+ if [ $count -eq $ADML_CONCURRENT_PROVISION_JOBS ]
+ then
+ idle_cpu=$(top -b -d 0.1 -n 2 | grep 'Cpu(s):'| tail -1 |awk '{print $8}')
+ echo
+ echo "Idle cpu = $idle_cpu%"
+ echo "if cpu is not overcommited, consider increase ADML_CONCURRENT_PROVISION_JOBS environment variable (now $ADML_CONCURRENT_PROVISION_JOBS)"
+ echo
+ wait $(jobs -p)
+ count=0
+ fi
+
+ done < $PROGRAM_LAYOUT_FILE
+
+ # Wait background jobs to finish:
+ sleep 5
+ echo "Waiting for clone completion ..."
+ echo "(please be patient, this may take a while)"
+ echo
+ echo "Background Jobs: $(jobs -p | wc -l)"
+ wait $(jobs -p)
+
+ echo
+ echo "Programming has finished !"
+ echo
+
+ echo "Configuring repeat cycles ..."
+ ./operation.sh "test|repeats|$REPEATS"
+
+ if [ -n "$specific" ]
then
- idle_cpu=$(top -b -d 0.1 -n 2 | grep 'Cpu(s):'| tail -1 |awk '{print $8}')
- echo
- echo "Idle cpu = $idle_cpu%"
- echo "if cpu is not overcommited, consider increase ADML_CONCURRENT_PROVISION_JOBS environment variable (now $ADML_CONCURRENT_PROVISION_JOBS)"
+ echo "A new file '$TESTCASE_DIR/specific.all' has been created."
+ echo "Probably you need to apply it before starting traffic."
echo
- wait $(jobs -p)
- count=0
+ echo "Press ENTER to continue, CTRL-C to abort ..."
+ read dummy
fi
-done < $PROGRAM_LAYOUT_FILE
+# dynamic programming #################################################################
+else
+ TESTCASE_DIR=$(readlink -f dynlibs/libanna_dynamicLauncherProcedure.so | xargs dirname)
+ DYNAMIC_SUFFIX_FILE=$TESTCASE_DIR/dynamic.suffix
-# Wait background jobs to finish:
-sleep 5
-echo "Waiting for clone completion ..."
-echo "(please be patient, this may take a while)"
-echo
-echo "Background Jobs: $(jobs -p | wc -l)"
-wait $(jobs -p)
+ [ ! -f $DYNAMIC_SUFFIX_FILE ] && _exit "Missing '$DYNAMIC_SUFFIX_FILE' file. Use 'dynlibs/select.sh' to change the dynamic procedure and restart the ADML instances."
+ dynamic_suffix=( $(grep -v ^# $DYNAMIC_SUFFIX_FILE) )
-echo
-echo "Programming has finished !"
-echo
+ # Multiple scenarios:
+ suffixes=${#dynamic_suffix[@]}
+ if [ $suffixes -gt 1 ]
+ then
+ echo "Detected $suffixes scenarios. Please, select the desired option:"
+ echo
+ tmpfile=$(mktemp)
+ opt=1
+ for line in $(grep -v ^# $DYNAMIC_SUFFIX_FILE)
+ do
+ echo "${opt}) $line"
+ opt=$((opt+1))
+ done > $tmpfile
+ cat $tmpfile
+ echo
+ read option
+ while [ -z "$option" ]; do read option ; done
+ dynamic_suffix=$(grep "^${option}) " $tmpfile | cut -d" " -f2-)
+ [ -z "$dynamic_suffix" ] && _exit "Invalid option !"
+ fi
-echo "Configuring repeat cycles ..."
-./operation.sh "test|repeats|$REPEATS"
+ while read -r line
+ do
+ instance=$(echo $line | awk '{ print $1 }')
+ ini_seq=$(echo $line | awk '{ print $2 }')
+ fin_seq=$(echo $line | awk '{ print $3 }')
+ ADML_DIR=`readlink -f ADMLS/ADML-$instance`
+
+ cd $ADML_DIR
+
+ # Modify xml files path:
+ xmls=( $(echo $dynamic_suffix | sed 's/'\|'/ /g') )
+ dynamic_suffix=$(for xml in ${xmls[@]}
+ do
+ echo $xml | grep -q "\.xml$"
+ [ $? -eq 0 ] && echo -n "$TESTCASE_DIR/"
+ echo -n "${xml}|"
+ done | sed 's/'\|'$//')
+
+ ./operation.sh -t 15 "dynamic|$ini_seq|$fin_seq|$dynamic_suffix"
+ cd - >/dev/null
+
+ done < $PROGRAM_LAYOUT_FILE
-if [ -n "$specific" ]
-then
- echo "A new file '$TESTCASE_DIR/specific.all' has been created."
- echo "Probably you need to apply it before starting traffic."
- echo
- echo "Press ENTER to continue, CTRL-C to abort ..."
- read dummy
fi
echo