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
11 [ -z "$ADML_CONCURRENT_PROVISION_JOBS" ] && ADML_CONCURRENT_PROVISION_JOBS=10
23 Usage: $0 <test stuff directory|dynamic> [-s]
25 Performs test case programming from scratch (current test cases will be dropped
26 from ADML involved instances). There are two types of programming depending on
27 the first argument provided:
31 The folder provided must contain msk files, specially a testcase file with
32 xml files referenced inside. Those xml files (without the .msk extension)
33 shall exists in the directory. For example:
35 $0 st_examples/DynamicQualification
37 Optionally, a file 'specific' could exists containing testcase-specific
38 information, which normally will be used to specify database sentences.
39 This file will be accumulated as a cloning seed over the file 'specific.all'
40 created on test stuff directory.
42 Template type programming could be used for medium-duration testings, because
43 the scripting used for programming, have lots of groups divisions which even
44 background-executed are much more slower on programming than a c++ builtin
45 procedure: dynamic type is the one for large sets of test cases:
50 The current dynamic procedure selected by mean 'dynlibs/select.sh' script,
51 will be programmed using its dirname resources: inside, you may found not
52 only the .so library but the needed xml files for the implemented scenary
53 and a file called 'dynamic.suffix' used to complete the dynamic operation
56 dynamic|<timeout ms>|<initial sequence>|<final sequence>|<dynamic.suffix content>
58 For example, you could have this content for 'dynamic.suffix':
60 0|7|CCR-I.xml|CCR-T.xml (0 for timeout means no timeout step)
62 in order to generate the operation:
64 dynamic|0|<initial sequence>|<final sequence>|7|CCR-I.xml|CCR-T.xml
66 which would be parsed for the specific ADML instance programmed:
68 dynamic|0|2000001|2001000|7|CCR-I.xml|CCR-T.xml
70 The file 'dynamic.suffix' could have several lines for several scenaries.
71 In this case, this script will prompt for the desired one.
73 This script will build every operation for the configured ADML instances
74 to complete all the sequence ranges along the whole test system.
78 -s: start testing just after programming, using desired rate: $DESIRED_RATE test cases per second.
80 [ $ADML_INSTANCES -gt 1 ] && echo " In your case, with $ADML_INSTANCES, a rate of $RATE_PER_INSTANCE ttps will be send per instance."
85 advice_to_squeeze_idle_cpu () {
86 local idle=$(top -b -d 0.1 -n 2 | grep 'Cpu(s):'| tail -1 | awk '{print $8}' | sed 's/,/./')
89 echo "Idle cpu now: $idle. Check the system CPU with top. If is not overcommited, consider"
90 echo " increase the environment variable 'ADML_CONCURRENT_PROVISION_JOBS' (now $ADML_CONCURRENT_PROVISION_JOBS)."
98 [ ! -f .st_conf_adml_instances ] && miss_conf=yes
99 [ ! -f .st_conf_n_testcases_program_layout ] && miss_conf=yes
100 [ ! -f .st_conf_cycle_repeats ] && miss_conf=yes
101 [ ! -f .st_conf_rate_per_instance ] && miss_conf=yes
102 [ ! -f .st_conf_desired_rate ] && miss_conf=yes
103 [ -n "$miss_conf" ] && _exit "You must run './configure.sh' script firtly !!"
107 echo "Testcases programming ..."
110 # We launch in background !
111 #./operation.sh --ping >/dev/null
112 #[ $? -ne 0 ] && _exit "Programming aborted (some ADML client process is not running) !"
118 # test case stuff programming #########################################################
119 if [ "$PROG_TYPE" != "dynamic" ]
121 TESTCASE_DIR=$PROG_TYPE
123 [ ! -d $TESTCASE_DIR ] && _exit "Cannot found the test directory '$TESTCASE_DIR' !!"
124 TESTCASE=( `ls $TESTCASE_DIR/testcase*msk 2>/dev/null` )
125 TESTCASE_FILES=${#TESTCASE[@]}
126 [ $TESTCASE_FILES -ne 1 ] && _exit "One and only one 'testcase*msk' file must be present !!"
128 MAX_NUMBER_GROUPS=$(grep ^MAX_NUMBER_GROUPS= clone.sh | cut -d= -f2)
129 CLONE_GROUPS=$((MAX_NUMBER_GROUPS/ADML_INSTANCES))
132 [ -f $TESTCASE_DIR/specific ] && specific=specific
137 instance=$(echo $line | awk '{ print $1 }')
138 ini_seq=$(echo $line | awk '{ print $2 }')
139 fin_seq=$(echo $line | awk '{ print $3 }')
140 ADML_DIR=`readlink -f ADMLS/ADML-$instance`
141 echo -e "\rCloning interval [$ini_seq,$fin_seq] for $(basename $ADML_DIR) ..."
142 ./clone.sh $ADML_DIR $TESTCASE $ini_seq $fin_seq $CLONE_GROUPS $specific &
145 if [ $count -eq $ADML_CONCURRENT_PROVISION_JOBS ]
151 done < $PROGRAM_LAYOUT_FILE
153 # Advice for idle cpu:
154 advice_to_squeeze_idle_cpu
156 # Wait background jobs to finish:
158 echo "Waiting for clone completion ..."
159 echo "(please be patient, this may take a while)"
161 echo "Background Jobs: $(jobs -p | wc -l)"
165 echo "Programming has finished !"
168 echo "Configuring repeat cycles ..."
169 ./operation.sh "test|repeats|$REPEATS"
171 if [ -n "$specific" ]
173 echo "A new file '$TESTCASE_DIR/specific.all' has been created."
174 echo "Probably you need to apply it before starting traffic."
176 echo "Press ENTER to continue, CTRL-C to abort ..."
180 # dynamic programming #################################################################
182 TESTCASE_DIR=$(readlink -f dynlibs/libanna_dynamicLauncherProcedure.so | xargs dirname)
183 DYNAMIC_SUFFIX_FILE=$TESTCASE_DIR/dynamic.suffix
185 [ ! -f $DYNAMIC_SUFFIX_FILE ] && _exit "Missing '$DYNAMIC_SUFFIX_FILE' file.\nUse 'dynlibs/select.sh' to change the dynamic procedure and restart the ADML instances."
186 dynamic_suffix=( $(grep -v ^# $DYNAMIC_SUFFIX_FILE) )
188 # Multiple scenarios:
189 suffixes=${#dynamic_suffix[@]}
190 if [ $suffixes -gt 1 ]
193 echo "----------------------------------------------------------------"
194 cat $DYNAMIC_SUFFIX_FILE
195 echo "----------------------------------------------------------------"
197 echo "Detected $suffixes scenarios:"
201 for line in $(grep -v ^# $DYNAMIC_SUFFIX_FILE)
208 echo "Select the desired option (0 to input a user defined one):"
210 while [ -z "$option" ]; do read option ; done
211 if [ "$option" != "0" ]
213 dynamic_suffix=$(grep "^${option}) " $tmpfile | cut -d" " -f2-)
214 [ -z "$dynamic_suffix" ] && _exit "Invalid option !"
216 echo "Input specific program arguments:"
217 echo " (be sure that are supported by the dynamic procedure)"
220 while [ -z "$dynamic_suffix" ]; do read dynamic_suffix ; done
224 # Modify xml files path:
225 xmls=( $(echo $dynamic_suffix | sed 's/'\|'/ /g') )
226 dynamic_suffix=$(for xml in ${xmls[@]}
228 echo $xml | grep -q "\.xml$"
229 [ $? -eq 0 ] && echo -n "$TESTCASE_DIR/"
231 done | sed 's/'\|'$//')
233 # If still idle CPU, you could increase chunks number of background jobs
234 echo "Dynamic programming ..."
238 instance=$(echo $line | awk '{ print $1 }')
239 ini_seq=$(echo $line | awk '{ print $2 }')
240 fin_seq=$(echo $line | awk '{ print $3 }')
241 ADML_DIR=`readlink -f ADMLS/ADML-$instance`
244 ./operation.sh -t 60 "dynamic|$ini_seq|$fin_seq|$dynamic_suffix" &
247 if [ $count -eq $ADML_CONCURRENT_PROVISION_JOBS ]
254 done < $PROGRAM_LAYOUT_FILE
256 # Advice for idle cpu:
257 advice_to_squeeze_idle_cpu
264 if [ "$AUTOSTART" = "-s" ]
270 To start testing, you must use the './operation.sh' script. The most
271 common commands used for testing are:
273 - Enable reports dump for failed tests: ./operation.sh "test|report|failed"
274 - Launch traffic: ./operation.sh "test|ttps|<test ticks per second (*)>"
276 (*) this is related to a single instance, because operation script launched
277 here invokes every 'ADMLS/ADML-<instance>/operation.sh' counterpart
278 script. Then, you should divide the desired CPS by the number of
279 instances. For example, if you need $DESIRED_RATE test cases per second,
280 as you have $ADML_INSTANCES instances, then you should execute:
282 ./operation.sh "test|ttps|$RATE_PER_INSTANCE"
284 - Stop traffic: ./operation.sh "test|ttps|0"
285 - Reset already classified (Success/Failed) test cases: ./operation.sh "test|reset[|soft]"
286 - Reset also 'in-progress' state test cases: ./operation.sh "test|reset|hard"
287 - Clear programmed test cases: ./operation.sh "test|clear"
289 Remember that './operation.sh' broadcasts the operation scripts inside
290 the ADML instances, then some operations should better be used within
291 a specific 'ADMLS/ADML-<instance>' directory to avoid console spam:
293 - Check a testcase in runtime: ADMLS/ADML-001/operation.sh "test|look|<test id>"
294 - Execute the next programmed test case: ADMLS/ADML-001/operation.sh "test|next"
295 - Interactive-step execution: ADMLS/ADML-001/operation.sh "test|interact|<steps to execute>|<test id>"
296 - Summary: ADMLS/ADML-001/operation.sh "test|summary"
298 For a complete and detailed information, execute: ./operation.sh --help | less
300 You could also use './launchCPS.sh' script.
306 if [ -n "$start_testing" ]
309 echo "Start testing to achieve desired rate of $DESIRED_RATE test cases per second ..."
311 ./operation.sh "test|ttps|$RATE_PER_INSTANCE"