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 !"
204 # Modify xml files path:
205 xmls=( $(echo $dynamic_suffix | sed 's/'\|'/ /g') )
206 dynamic_suffix=$(for xml in ${xmls[@]}
208 echo $xml | grep -q "\.xml$"
209 [ $? -eq 0 ] && echo -n "$TESTCASE_DIR/"
211 done | sed 's/'\|'$//')
213 # If still idle CPU, you could increase chunks number of background jobs
215 echo "Dynamic programming ..."
219 instance=$(echo $line | awk '{ print $1 }')
220 ini_seq=$(echo $line | awk '{ print $2 }')
221 fin_seq=$(echo $line | awk '{ print $3 }')
222 ADML_DIR=`readlink -f ADMLS/ADML-$instance`
225 ./operation.sh -t 60 "dynamic|$ini_seq|$fin_seq|$dynamic_suffix" &
227 [ $count -eq $CHUNKS ] && { wait $(jobs -p) ; count=1 ; }
230 done < $PROGRAM_LAYOUT_FILE
237 if [ "$AUTOSTART" = "-s" ]
241 echo "Input desired rate (test cases per second) to start testing [0: nothing done]:"
243 if [ "$desired_rate" != "" ]
245 rate_per_instance=$((desired_rate/$ADML_INSTANCES))
246 [ $rate_per_instance -lt 1 ] && rate_per_instance=1
247 ./operation.sh "test|ttps|$rate_per_instance"
251 To start testing, you must use the './operation.sh' script. Use '-h'
252 to get detailed help. The most common commands used for testing are:
254 * Enable reports dump for failed tests:
255 ./operation.sh "test|report|failed"
258 ./operation.sh "test|ttps|<test cases per second and instance(*)>"
260 (*) note: ttps value is related to a single instance: you should"
261 divide the desired CPS by the number of instances. For"
262 exampl, if you need $DESIRED_RATE test cases per second:
264 ./operation.sh "test|ttps|$RATE_PER_INSTANCE"
267 ./operation.sh "test|ttps|0"
269 * Reset already classified (Success/Failed) test cases:
270 ./operation.sh "test|reset[|soft]"
272 * Reset also 'in-progress' state test cases:
273 ./operation.sh "test|reset|hard"
275 Remember that './operation.sh' broadcasts the operation scripts along
276 the ADML instances, then some operations should better be used within
277 a specific 'ADMLS/ADML-<instance>' directory to avoid console spam,
280 * Check a testcase in runtime:
281 ADMLS/ADML-001/operation.sh "test|look|<test id>"
283 * Execute the next programmed test case:
284 ADMLS/ADML-001/operation.sh "test|next"
286 * Interactive-step execution:
287 ADMLS/ADML-001/operation.sh "test|interact|<steps to execute>|<test id>"
290 ADMLS/ADML-001/operation.sh "test|summary"
297 if [ -n "$start_testing" ]
300 echo "Start testing to achieve desired rate of $DESIRED_RATE test cases per second ..."
302 ./operation.sh "test|ttps|$RATE_PER_INSTANCE"