yocto-autobuilder-helper/scripts/collect-results
Richard Purdie 19f4fa0ac5 scripts/collect-results: Handle artefact collection/separation
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2024-07-17 14:44:51 +01:00

56 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
#
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright Linux Foundation, Richard Purdie
#
WORKDIR=$1
DEST=$2
target=$3
if [ -e $WORKDIR/tmp/log/oeqa/ ] && [ -n "$(ls -A "$WORKDIR/tmp/log/oeqa/")" ]; then
mkdir -p $DEST
cp -Lrf $WORKDIR/tmp/log/oeqa/ $DEST/$target
fi
if [ -e $WORKDIR/tmp/log/oeqa-artefacts/ ] && [ -n "$(ls -A "$WORKDIR/tmp/log/oeqa-artefacts/")" ]; then
mkdir -p $DEST/../artefacts/
cp -Lrf $WORKDIR/tmp/log/oeqa-artefacts/ $DEST/../artefacts/$target
fi
if [ -e $WORKDIR/buildhistory ]; then
# ab-fetchrev tag set in buildhistory-init
if [ $(git -C $WORKDIR/buildhistory tag -l "ab-fetchrev") ]; then
mkdir -p $DEST/$target
$WORKDIR/../scripts/buildhistory-diff -p $WORKDIR/buildhistory ab-fetchrev > $DEST/$target/buildhistory.txt
fi
fi
HSFILE=$WORKDIR/tmp/buildstats/*/host_stats*
d="intermittent_failure_host_data"
step_i=1
step_f=1
for f in $HSFILE; do
if [ -e $f ]; then
if [ ! -e $DEST/$target/$d ]; then
mkdir -p $DEST/$target/$d
fi
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_i}_top.txt
else
mv $DEST/$target/$d/`basename $f` $DEST/$target/$d/`basename $f`_${step_i}.txt
fi
step_i=$((step_i+1))
fi
done