diff options
author | Laurent Alfonsi <laurent.alfonsi@linaro.org> | 2024-03-25 19:36:24 +0100 |
---|---|---|
committer | Laurent Alfonsi <laurent.alfonsi@linaro.org> | 2024-03-25 20:20:42 +0100 |
commit | fced5f16bb67f6918e8c9e9bf39434720d8b7ee0 (patch) | |
tree | f4655763ef58b83b6327194a717c62149d8970cd | |
parent | 69b4267a577923c7e2a99a0c5c7b59251274bde8 (diff) |
tcwg_chromium-build.sh,ci-autotest.sh: Externalize ci autotest
Change-Id: I2c1539f1dca1c46d4404b9880c8d6a73880da322
-rw-r--r-- | ci-autotest.sh | 66 | ||||
-rwxr-xr-x | tcwg_chromium-build.sh | 56 |
2 files changed, 77 insertions, 45 deletions
diff --git a/ci-autotest.sh b/ci-autotest.sh new file mode 100644 index 00000000..32aa3202 --- /dev/null +++ b/ci-autotest.sh @@ -0,0 +1,66 @@ +#!/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=${dep} + if [ -f "${rr[top_artifacts]}/git/${dep}_dir" ]; then + dep_dir=$(get_current_git ${dep}_dir) + fi + if ! [ -d "$dep_dir" ]; then + echo "CI_AUTOTEST : Cannot check if $dep guilty commit is included. Cannot find the sources" + continue + fi + + # check if + if git -C "$dep_dir" 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 + ) +} + diff --git a/tcwg_chromium-build.sh b/tcwg_chromium-build.sh index 97d74796..16b9a066 100755 --- a/tcwg_chromium-build.sh +++ b/tcwg_chromium-build.sh @@ -7,6 +7,8 @@ scripts=$(dirname $0) . $scripts/jenkins-helpers.sh # shellcheck source=round-robin.sh . $scripts/round-robin.sh +# shellcheck source=ci-autotest.sh +. $scripts/ci-autotest.sh workspace="${workspace-$(pwd)}" @@ -139,66 +141,30 @@ get_sources() } -# First function for ci_autotest harness -ci_autotest_build() -{ - cd $workspace - - # 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 ! [ "${deps_dir[$dep]+abc}" ]; then - echo "CI_AUTOTEST : Cannot check if $dep guilty commit is included. Don't know the dir to check" - fi - if ! [ -d "src/${deps_dir[$dep]}" ]; then - echo "CI_AUTOTEST : Cannot check if $dep guilty commit is included. Sources doesn't contain the git" - fi - - if git -C "src/${deps_dir[$dep]}" merge-base --is-ancestor ${guilty_commits[$dep]} HEAD >& /dev/null; then - echo "CI_AUTOTEST : Found guilty commit included in [$dep] : ${guilty_commits[$dep]}" - 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 -} - # build_chromium() { echo "# RUN_STEP: build_chromium" export PATH="$PWD/depot_tools:$PATH" - - cd src - - if ${rr[ci_autotest]}; then - ci_autotest_build + if [ ${rr[ci_autotest]} == "build" ]; then + ci_autotest_check_guilty_commit "build" return fi # autoninja -C out/Default chrome + true } # test_chromium() { echo "# RUN_STEP: test_chromium" + if [ ${rr[ci_autotest]} == "test" ]; then + ci_autotest_check_guilty_commit "test" + return + fi + + # test it true } |