[yocto-autobuilder-helper,2/4] collect-results: collect all host_stats files

Submitted by Sakib Sajal on July 9, 2021, 8:56 p.m. | Patch ID: 179950

Details

Message ID 20210709205609.233487-2-sakib.sajal@windriver.com
State New
Headers show

Commit Message

Sakib Sajal July 9, 2021, 8:56 p.m.
data collection on failure is enabled by default.
Collect all host stats files created.

Signed-off-by: Sakib Sajal <sakib.sajal@windriver.com>
---
 scripts/collect-results | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/scripts/collect-results b/scripts/collect-results
index 7178380..93834d6 100755
--- a/scripts/collect-results
+++ b/scripts/collect-results
@@ -18,21 +18,27 @@  if [ -e $WORKDIR/buildhistory ]; then
     fi
 fi
 
-HSFILE=$WORKDIR/tmp/buildstats/*/host_stats
+HSFILE=$WORKDIR/tmp/buildstats/*/host_stats*
 d="intermittent_failure_host_data"
 
 mkdir -p $DEST/$target/$d
 
-step=0
+step_i=1
+step_f=1
 for f in $HSFILE; do
 	if [ -e $f ]; then
 	    cp $f $DEST/$target/$d
+        if [[ "$f" == *"failure"* ]] ; then
+            mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step_f}.txt
+            step_f=$((step_f+1))
+            continue
+        fi
 	    grep -m 1 "^top -" $f
 	    if [ $? -eq 0 ]; then
-		    mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step}_top.txt
+		    mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step_i}_top.txt
 	    else
-		    mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step}.txt
+		    mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step_i}.txt
 	    fi
-	    step=$((step+1))
+	    step_i=$((step_i+1))
 	fi
 done