Dump output and hide from non-tty, the ADML stdout/stderr
[anna.git] / example / diameter / launcher / deployments / st-client / program.sh
index 31eb97d..cf44977 100755 (executable)
@@ -53,7 +53,7 @@ Usage: $0 <test stuff directory|dynamic> [-s]
           and a file called 'dynamic.suffix' used to complete the dynamic operation
           in this way:
 
           and a file called 'dynamic.suffix' used to complete the dynamic operation
           in this way:
 
-             dynamic|<timeout ms>|<initial sequence>|<final sequence>|<dynamic.suffix content>
+             dynamic|<initial sequence>|<final sequence>|<dynamic.suffix content>
 
           For example, you could have this content for 'dynamic.suffix':
 
 
           For example, you could have this content for 'dynamic.suffix':
 
@@ -61,11 +61,11 @@ Usage: $0 <test stuff directory|dynamic> [-s]
 
           in order to generate the operation:
 
 
           in order to generate the operation:
 
-             dynamic|0|<initial sequence>|<final sequence>|7|CCR-I.xml|CCR-T.xml
+             dynamic|<initial sequence>|<final sequence>|0|7|CCR-I.xml|CCR-T.xml
 
           which would be parsed for the specific ADML instance programmed:
 
 
           which would be parsed for the specific ADML instance programmed:
 
-             dynamic|0|2000001|2001000|7|CCR-I.xml|CCR-T.xml
+             dynamic|2000001|2001000|0|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.
 
           The file 'dynamic.suffix' could have several lines for several scenaries.
           In this case, this script will prompt for the desired one.
@@ -83,7 +83,7 @@ EOF
 }
 
 advice_to_squeeze_idle_cpu () {
 }
 
 advice_to_squeeze_idle_cpu () {
-  local idle=$(top -b -d 0.1 -n 2 | grep 'Cpu(s):'| tail -1 | awk '{print $8}' | sed 's/,/./')
+  local idle=$(top -b -d 1 -n 2 | grep 'Cpu(s):'| tail -1 | awk '{print $8}' | sed 's/,/./')
   sleep 10
   echo
   echo  "Idle cpu now: $idle. Check the system CPU with top. If is not overcommited, consider"
   sleep 10
   echo
   echo  "Idle cpu now: $idle. Check the system CPU with top. If is not overcommited, consider"
@@ -110,7 +110,7 @@ echo "Testcases programming ..."
 echo
 cd `dirname $0`
 ./checkStatus.sh
 echo
 cd `dirname $0`
 ./checkStatus.sh
-[ $? -eq 1 ] && _exit "Fix status to continue ..."
+[ $? -eq 1 ] && _exit "Fix status (instances) to continue ..."
 
 # We launch in background !
 #./operation.sh --ping >/dev/null
 
 # We launch in background !
 #./operation.sh --ping >/dev/null
@@ -135,7 +135,7 @@ then
   #CLONE_GROUPS=1
   specific=
   [ -f $TESTCASE_DIR/specific ] && specific=specific
   #CLONE_GROUPS=1
   specific=
   [ -f $TESTCASE_DIR/specific ] && specific=specific
-  
+
   count=0
   while read -r line
   do
   count=0
   while read -r line
   do
@@ -152,12 +152,12 @@ then
       wait $(jobs -p)
       count=0
     fi
       wait $(jobs -p)
       count=0
     fi
-  
+
   done < $PROGRAM_LAYOUT_FILE
 
   # Advice for idle cpu:
   advice_to_squeeze_idle_cpu
   done < $PROGRAM_LAYOUT_FILE
 
   # Advice for idle cpu:
   advice_to_squeeze_idle_cpu
-  
+
   # Wait background jobs to finish:
   sleep 5
   echo "Waiting for clone completion ..."
   # Wait background jobs to finish:
   sleep 5
   echo "Waiting for clone completion ..."
@@ -165,14 +165,11 @@ then
   echo
   echo "Background Jobs: $(jobs -p | wc -l)"
   wait $(jobs -p)
   echo
   echo "Background Jobs: $(jobs -p | wc -l)"
   wait $(jobs -p)
-  
+
   echo
   echo "Programming has finished !"
   echo
   echo
   echo "Programming has finished !"
   echo
-  
-  echo "Configuring repeat cycles ..."
-  ./operation.sh "test|repeats|$REPEATS"
-  
+
   if [ -n "$specific" ]
   then
     echo "A new file '$TESTCASE_DIR/specific.all' has been created."
   if [ -n "$specific" ]
   then
     echo "A new file '$TESTCASE_DIR/specific.all' has been created."
@@ -184,10 +181,10 @@ then
 
 # dynamic programming #################################################################
 else
 
 # dynamic programming #################################################################
 else
-  TESTCASE_DIR=$(readlink -f dynlibs/libanna_dynamicLauncherProcedure.so | xargs dirname)
+  TESTCASE_DIR=$(readlink -f dynlibs/libanna_launcher_procedure_default_shared.so | xargs dirname)
   DYNAMIC_SUFFIX_FILE=$TESTCASE_DIR/dynamic.suffix
 
   DYNAMIC_SUFFIX_FILE=$TESTCASE_DIR/dynamic.suffix
 
-  [ ! -f $DYNAMIC_SUFFIX_FILE ] && _exit "Missing '$DYNAMIC_SUFFIX_FILE' file.\nUse 'dynlibs/select.sh' to change the dynamic procedure and restart the ADML instances."
+  [ ! -f $DYNAMIC_SUFFIX_FILE ] && _exit "Missing '$DYNAMIC_SUFFIX_FILE' file.\nUse 'dynlibs/select.sh' to change the dynamic procedure and very important: RESTART the ADML instances."
   dynamic_suffix=( $(grep -v ^# $DYNAMIC_SUFFIX_FILE) )
 
   # Multiple scenarios:
   dynamic_suffix=( $(grep -v ^# $DYNAMIC_SUFFIX_FILE) )
 
   # Multiple scenarios:
@@ -223,6 +220,17 @@ else
       echo
       read dynamic_suffix
       while [ -z "$dynamic_suffix" ]; do read dynamic_suffix ; done
       echo
       read dynamic_suffix
       while [ -z "$dynamic_suffix" ]; do read dynamic_suffix ; done
+      timeout=$(echo $dynamic_suffix | cut -d\| -f1)
+      if [ "$timeout" = "0" ]
+      then
+        echo
+        echo "Zero-timeout will configure 'auto-reset' as 'hard' in order"
+        echo " to reset properly the test cases in further cycles ..."
+        ./operation.sh "test|auto-reset|hard" >/dev/null
+        echo
+        echo "Press ENTER to continue ..."
+        read dummy
+      fi
     fi
   fi
 
     fi
   fi
 
@@ -244,18 +252,18 @@ else
     ini_seq=$(echo $line | awk '{ print $2 }')
     fin_seq=$(echo $line | awk '{ print $3 }')
     ADML_DIR=`readlink -f ADMLS/ADML-$instance`
     ini_seq=$(echo $line | awk '{ print $2 }')
     fin_seq=$(echo $line | awk '{ print $3 }')
     ADML_DIR=`readlink -f ADMLS/ADML-$instance`
-  
-    cd $ADML_DIR                                                      
+
+    cd $ADML_DIR
     ./operation.sh -t 60 "dynamic|$ini_seq|$fin_seq|$dynamic_suffix" &
     sleep 0.1
     ./operation.sh -t 60 "dynamic|$ini_seq|$fin_seq|$dynamic_suffix" &
     sleep 0.1
-    count=$((count+1))                                                
+    count=$((count+1))
     if [ $count -eq $ADML_CONCURRENT_PROVISION_JOBS ]
     then
       wait $(jobs -p)
       count=1
     fi
     if [ $count -eq $ADML_CONCURRENT_PROVISION_JOBS ]
     then
       wait $(jobs -p)
       count=1
     fi
-    cd - >/dev/null                                                   
-  
+    cd - >/dev/null
+
   done < $PROGRAM_LAYOUT_FILE
 
   # Advice for idle cpu:
   done < $PROGRAM_LAYOUT_FILE
 
   # Advice for idle cpu:
@@ -265,6 +273,12 @@ fi
 
 echo
 echo
 
 echo
 echo
+echo "Configuring repeat cycles ..."
+./operation.sh "test|repeats|$REPEATS" >/dev/null
+echo
+echo "Done !"
+echo
+
 start_testing=
 if [ "$AUTOSTART" = "-s" ]
 then
 start_testing=
 if [ "$AUTOSTART" = "-s" ]
 then
@@ -300,7 +314,7 @@ Remember that './operation.sh' broadcasts the operation scripts inside
  - Interactive-step execution: ADMLS/ADML-001/operation.sh "test|interact|<steps to execute>|<test id>"
  - Summary: ADMLS/ADML-001/operation.sh "test|summary"
 
  - Interactive-step execution: ADMLS/ADML-001/operation.sh "test|interact|<steps to execute>|<test id>"
  - Summary: ADMLS/ADML-001/operation.sh "test|summary"
 
-For a complete and detailed information, execute: ./operation.sh --help | less
+Check 'HELP.md' for more information.
 
 You could also use './launchCPS.sh' script.
 
 
 You could also use './launchCPS.sh' script.