Dump variable name and value to sysctl.result file 31/81331/7
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Thu, 21 Jul 2016 08:49:18 +0000 (10:49 +0200)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Wed, 2 Nov 2016 16:17:37 +0000 (17:17 +0100)
tct/run/smoke_tests.sh produces some numerical output. This patch makes
it easy to store and retreive values as in line below:
    awk -v KEY="${KEY}" '$1 == KEY {print $2}' $DICT
where $KEY is variable name and $DICT is sysctl.result file.

Change-Id: I3eee61152a189ad443fa641f5160f516567506f1
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
tct/minnow_prepare_flash_conf.sh
tct/odroid_prepare_flash_conf.sh
tct/run/smoke_tests.sh
tsp/jobs/common_prep_flash_conf.sh
tsp/scripts/common_prep_flash_conf.sh

index c839c90..80e1d95 100755 (executable)
@@ -66,6 +66,7 @@ restart_device "${SDMUX}"
 
 echo "### conf ###"
 
+CONNECT_CNT=0
 SLEEP=30
 
 while [ -z "`ping -c 1 ${IP} -W 1 | grep icmp_seq`" ]
@@ -82,6 +83,7 @@ do
     fi
     sleep "${SLEEP}"
     SLEEP=$((SLEEP+20))
+    CONNECT_CNT=$((CONNECT_CNT+1))
 done
 
 printf "\n"
@@ -96,6 +98,7 @@ do
         die "Timeout: ssh port not open!"
     fi
     SLEEP=$((SLEEP+10))
+    CONNECT_CNT=$((CONNECT_CNT+1))
 done
 
 printf "\n"
@@ -107,6 +110,7 @@ SLEEP=10
 copy_ssh "${IP}" "${TESTLAB_SCRIPTS}/run/smoke_tests.sh"
 run_smoke_ssh "${IP}"
 
+echo "CONNECT_CNT $CONNECT_CNT" >> sysctl.result
 cat sysctl.result
 
 echo "### cleanup ###"
index 4995a6b..2e5992b 100755 (executable)
@@ -71,6 +71,7 @@ restart_device "${SDMUX}"
 
 echo "### conf ###"
 
+CONNECT_CNT=0
 sdb start-server
 SLEEP=10
 
@@ -88,6 +89,7 @@ do
     fi
     sleep "${SLEEP}"
     SLEEP=$((SLEEP+10))
+    CONNECT_CNT=$((CONNECT_CNT+1))
 done
 
 printf "\n"
@@ -103,6 +105,7 @@ fi
 copy_sdb "${SDMUX}" "${TESTLAB_SCRIPTS}/run/smoke_tests.sh"
 run_smoke_sdb "${SDMUX}"
 
+echo "CONNECT_CNT $CONNECT_CNT" >> sysctl.result
 cat sysctl.result
 
 echo "### cleanup ###"
index 9e76bd9..2c6068d 100755 (executable)
 # limitations under the License.
 
 # Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
-
-systemctl --state=failed | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m]//g" 2>&1
+SYS_RESULT_TMP="`mktemp`"
+systemctl --state=failed | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m]//g" 2>&1 | tee "$SYS_RESULT_TMP"
 uptime
 BEFORE=`journalctl | wc -l`
 sleep 10
 AFTER=`journalctl | wc -l`
-echo "Lines in journal (growth in last 10s): " $AFTER "("$(($AFTER - $BEFORE))")"
+JOURNAL_DIFF_CNT="$(($AFTER - $BEFORE))"
+echo "Lines in journal (growth in last 10s): $AFTER ($JOURNAL_DIFF_CNT)"
 tree -L 2 /opt/share/crash/
+
+echo SERVICES_FAIL_CNT $(grep -c "failed" "$SYS_RESULT_TMP")
+echo JOURNAL_DIFF_CNT "$JOURNAL_DIFF_CNT"
+echo JOURNAL_TOTAL_CNT "$AFTER"
+echo OPT_CRASH_CNT $(find /opt/share/crash -maxdepth 2 | wc -l)
index 75cb5b1..d41bf67 100755 (executable)
@@ -64,10 +64,7 @@ echo "finish remote script"
 # Copy the results
 scp tl-runner:"${WORKDIR_REMOTE}/sysctl.result" .
 
-if [ "$FAIL_CNT" -ge 1 ]; then
-    echo "RETRIGGERED: ${FAIL_CNT}" >> sysctl.result
-fi
-
+echo "RETRIGGER_CNT ${FAIL_CNT}" >> sysctl.result
 echo "Build nr: $1" >> sysctl.result
 echo "Date: `date`" >> sysctl.result
 
index 09d8d03..412406e 100755 (executable)
@@ -46,6 +46,7 @@ fi
 SDMUX="$(python "${TESTLAB_MAJOR}/tct/resource_locking.py" --retrylock "${TARGET}")"
 if [ -z "${SDMUX}" ]; then
     echo "Failed to allocate SD MUX device." >> sysctl.result
+    echo "FAILED 1" >> sysctl.result
     exit 1
 fi
 
@@ -60,8 +61,10 @@ esac
 
 if grep -q "Testing failed." sysctl.result
 then
+    echo "FAILED 1" >> sysctl.result
     python "${TESTLAB_MAJOR}/tct/resource_locking.py" --unlockfailed "${SDMUX}"
 else
+    echo "FAILED 0" >> sysctl.result
     python "${TESTLAB_MAJOR}/tct/resource_locking.py" --unlock "${SDMUX}"
 fi