diff options
Diffstat (limited to 'ci-autotest.sh')
-rw-r--r-- | ci-autotest.sh | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/ci-autotest.sh b/ci-autotest.sh new file mode 100644 index 00000000..225e6253 --- /dev/null +++ b/ci-autotest.sh @@ -0,0 +1,62 @@ +#!/bin/bash + + +# ci_autotest harness to be reworked. +# +# + + +# Function to check +ci_autotest_check_guilty_commit() +{ + ( + set -euf -o pipefail + + local current_stage=$1 + + # shellcheck disable=SC2154 + if [ x"${rr[ci_autotest]}" != x"$current_stage" ]; then + return + fi + + # get guilty commits + rm -rf guilty_commits + scp -r -q \ + bkp-01.tcwglab:/home/tcwg-buildslave/ci_autotest/${rr[ci_project]}/${rr[ci_config]}/guilty_commits \ + guilty_commits + + local -A guilty_commits + for depfile in $(find guilty_commits -name '*_rev'||true); do + dep=${depfile#guilty_commits/} + dep=${dep%_rev} + guilty_commits[$dep]=$(cat $depfile) + done + + # check if any guilty commits is included + for dep in "${!guilty_commits[@]}"; do + if ! [ -f "${rr[top_artifacts]}/git/${dep}_rev" ]; then + echo "CI_AUTOTEST : Cannot check if $dep guilty commit is included. $dep not tracked" + continue + fi + + dep_dir=$(get_component_dir ${dep}) + if ! [ -d "$dep_dir" ]; then + echo "CI_AUTOTEST : Cannot check if $dep guilty commit is included. Cannot find the sources" + continue + fi + + if git_component_cmd "$dep" merge-base --is-ancestor ${guilty_commits[$dep]} HEAD >& /dev/null; then + echo "CI_AUTOTEST : Found guilty commit included in [$dep] : ${guilty_commits[$dep]}" + # found a regression + return 1 + fi + done + + echo "CI_AUTOTEST : Didn't find any of the guilty commits" + for dep in "${!guilty_commits[@]}"; do + echo " - [$dep] : ${guilty_commits[$dep]}" + done + return 0 + ) +} + |