6 ADML_INSTANCES=`cat .st_conf_adml_instances 2>/dev/null`
7 RATE_PER_INSTANCE=`cat .st_conf_rate_per_instance 2>/dev/null`
8 DESIRED_RATE=`cat .st_conf_desired_rate 2>/dev/null`
9 REPEATS=`cat .st_conf_cycle_repeats 2>/dev/null`
10 PROGRAM_LAYOUT_FILE=.st_conf_n_testcases_program_layout
24 Usage: $0 <test stuff directory|dynamic> [-s]
26 Performs test case programming from scratch (current test cases will be dropped
27 from ADML involved instances). There are two types of programming depending on
28 the first argument provided:
32 The folder provided must contain msk files, specially a testcase file with
33 xml files referenced inside. Those xml files (without the .msk extension)
34 shall exists in the directory. For example:
36 $0 st_examples/DynamicQualification
38 Optionally, a file 'specific' could exists containing testcase-specific
39 information, which normally will be used to specify database sentences.
40 This file will be accumulated as a cloning seed over the file 'specific.all'
41 created on test stuff directory.
43 Template type programming could be used for medium-duration testings, because
44 the scripting used for programming, have lots of groups divisions which even
45 background-executed are much more slower on programming than a c++ builtin
46 procedure: dynamic type is the one for large sets of test cases:
51 The current dynamic procedure selected by mean 'dynlibs/select.sh' script,
52 will be programmed using its dirname resources: inside, you may found not
53 only the .so library but the needed xml files for the implemented scenary
54 and a file called 'dynamic.suffix' used to complete the dynamic operation
57 dynamic|<initial sequence>|<final sequence>|<dynamic.suffix content>
59 For example, you could have this content for 'dynamic.suffix':
63 in order to generate the operation:
65 dynamic|<initial sequence>|<final sequence>|7|CCR-I.xml|CCR-T.xml
67 which would be parsed for the specific ADML instance programmed:
69 dynamic|2000001|2001000|7|CCR-I.xml|CCR-T.xml
71 The file 'dynamic.suffix' could have several lines for several scenaries.
72 In this case, this script will prompt for the desired one.
74 This script will build every operation for the configured ADML instances
75 to complete all the sequence ranges along the whole test system.
79 -s: start testing just after programming, using desired rate: $DESIRED_RATE test cases per second.
81 [ $ADML_INSTANCES -gt 1 ] && echo " In your case, with $ADML_INSTANCES, a rate of $RATE_PER_INSTANCE ttps will be send per instance."
90 [ ! -f .st_conf_adml_instances ] && miss_conf=yes
91 [ ! -f .st_conf_n_testcases_program_layout ] && miss_conf=yes
92 [ ! -f .st_conf_cycle_repeats ] && miss_conf=yes
93 [ ! -f .st_conf_rate_per_instance ] && miss_conf=yes
94 [ ! -f .st_conf_desired_rate ] && miss_conf=yes
95 [ -n "$miss_conf" ] && _exit "You must run './configure.sh' script firtly !!"
99 echo "Starting testcases programming ..."
102 ./operation.sh --ping >/dev/null
103 [ $? -ne 0 ] && _exit "Programming aborted (some ADML client process is not running) !"
109 # test case stuff programming #########################################################
110 if [ "$PROG_TYPE" != "dynamic" ]
112 TESTCASE_DIR=$PROG_TYPE
114 [ ! -d $TESTCASE_DIR ] && _exit "Cannot found the test directory '$TESTCASE_DIR' !!"
115 TESTCASE=( `ls $TESTCASE_DIR/testcase*msk 2>/dev/null` )
116 TESTCASE_FILES=${#TESTCASE[@]}
117 [ $TESTCASE_FILES -ne 1 ] && _exit "One and only one 'testcase*msk' file must be present !!"
119 MAX_NUMBER_GROUPS=$(grep ^MAX_NUMBER_GROUPS= clone.sh | cut -d= -f2)
120 CLONE_GROUPS=$((MAX_NUMBER_GROUPS/ADML_INSTANCES))
123 [ -f $TESTCASE_DIR/specific ] && specific=specific
125 [ -z "$ADML_CONCURRENT_PROVISION_JOBS" ] && ADML_CONCURRENT_PROVISION_JOBS=5
130 instance=$(echo $line | awk '{ print $1 }')
131 ini_seq=$(echo $line | awk '{ print $2 }')
132 fin_seq=$(echo $line | awk '{ print $3 }')
133 ADML_DIR=`readlink -f ADMLS/ADML-$instance`
134 echo -e "\rCloning interval [$ini_seq,$fin_seq] for $(basename $ADML_DIR) ..."
135 ./clone.sh $ADML_DIR $TESTCASE $ini_seq $fin_seq $CLONE_GROUPS $specific &
138 if [ $count -eq $ADML_CONCURRENT_PROVISION_JOBS ]
140 idle_cpu=$(top -b -d 0.1 -n 2 | grep 'Cpu(s):'| tail -1 |awk '{print $8}')
142 echo "Idle cpu = $idle_cpu%"
143 echo "if cpu is not overcommited, consider increase ADML_CONCURRENT_PROVISION_JOBS environment variable (now $ADML_CONCURRENT_PROVISION_JOBS)"
149 done < $PROGRAM_LAYOUT_FILE
151 # Wait background jobs to finish:
153 echo "Waiting for clone completion ..."
154 echo "(please be patient, this may take a while)"
156 echo "Background Jobs: $(jobs -p | wc -l)"
160 echo "Programming has finished !"
163 echo "Configuring repeat cycles ..."
164 ./operation.sh "test|repeats|$REPEATS"
166 if [ -n "$specific" ]
168 echo "A new file '$TESTCASE_DIR/specific.all' has been created."
169 echo "Probably you need to apply it before starting traffic."
171 echo "Press ENTER to continue, CTRL-C to abort ..."
175 # dynamic programming #################################################################
177 TESTCASE_DIR=$(readlink -f dynlibs/libanna_dynamicLauncherProcedure.so | xargs dirname)
178 DYNAMIC_SUFFIX_FILE=$TESTCASE_DIR/dynamic.suffix
180 [ ! -f $DYNAMIC_SUFFIX_FILE ] && _exit "Missing '$DYNAMIC_SUFFIX_FILE' file. Use 'dynlibs/select.sh' to change the dynamic procedure and restart the ADML instances."
181 dynamic_suffix=( $(grep -v ^# $DYNAMIC_SUFFIX_FILE) )
183 # Multiple scenarios:
184 suffixes=${#dynamic_suffix[@]}
185 if [ $suffixes -gt 1 ]
187 echo "Detected $suffixes scenarios. Please, select the desired option:"
191 for line in $(grep -v ^# $DYNAMIC_SUFFIX_FILE)
199 while [ -z "$option" ]; do read option ; done
200 dynamic_suffix=$(grep "^${option}) " $tmpfile | cut -d" " -f2-)
201 [ -z "$dynamic_suffix" ] && _exit "Invalid option !"
206 instance=$(echo $line | awk '{ print $1 }')
207 ini_seq=$(echo $line | awk '{ print $2 }')
208 fin_seq=$(echo $line | awk '{ print $3 }')
209 ADML_DIR=`readlink -f ADMLS/ADML-$instance`
213 # Modify xml files path:
214 xmls=( $(echo $dynamic_suffix | sed 's/'\|'/ /g') )
215 dynamic_suffix=$(for xml in ${xmls[@]}
217 echo $xml | grep -q "\.xml$"
218 [ $? -eq 0 ] && echo -n "$TESTCASE_DIR/"
220 done | sed 's/'\|'$//')
222 ./operation.sh -t 15 "dynamic|$ini_seq|$fin_seq|$dynamic_suffix"
225 done < $PROGRAM_LAYOUT_FILE
232 if [ "$AUTOSTART" = "-s" ]
236 echo "Input desired rate (test cases per second) to start testing [0: nothing done]:"
238 if [ "$desired_rate" != "" ]
240 rate_per_instance=$((desired_rate/$ADML_INSTANCES))
241 [ $rate_per_instance -lt 1 ] && rate_per_instance=1
242 ./operation.sh "test|ttps|$rate_per_instance"
244 echo "Remember that you could start traffic using:"
245 echo " ./operation.sh \"test|ttps|<test cases per second rate>\""
247 echo "For example, to reach $DESIRED_RATE test cases per second:"
248 echo " ./operation.sh \"test|ttps|$RATE_PER_INSTANCE\""
252 if [ -n "$start_testing" ]
255 echo "Start testing to achieve desired rate of $DESIRED_RATE test cases per second ..."
257 ./operation.sh "test|ttps|$RATE_PER_INSTANCE"