summaryrefslogtreecommitdiff
path: root/dashboard-push-one-branch.sh
diff options
context:
space:
mode:
Diffstat (limited to 'dashboard-push-one-branch.sh')
-rwxr-xr-xdashboard-push-one-branch.sh179
1 files changed, 179 insertions, 0 deletions
diff --git a/dashboard-push-one-branch.sh b/dashboard-push-one-branch.sh
new file mode 100755
index 00000000..19343fea
--- /dev/null
+++ b/dashboard-push-one-branch.sh
@@ -0,0 +1,179 @@
+#!/bin/bash
+
+# This scripts iterates over a base-artifact BRANCH and for each base-artifact :
+# - recreates the dashboard directory if necessary
+# - push the results to squad
+#
+# Example to push a base-artifacts branch :
+# dashboard-push-one-branch.sh --top_artifacts base-artifacts --baseline_branch linaro-local/ci/tcwg_bmk_gnu_apm/gnu-master-aarch64-spec2k6-Os_LTO
+#
+# This required the squad project to exist
+
+set -e
+scripts=$(dirname $0)
+
+dryrun=false
+interactive=false
+
+# shellcheck source=jenkins-helpers.sh
+. "$(dirname $0)/jenkins-helpers.sh"
+# shellcheck source=round-robin.sh
+. "$(dirname $0)/round-robin.sh"
+
+convert_args_to_variables "$@"
+
+obligatory_variables top_artifacts baseline_branch
+
+declare top_artifacts baseline_branch
+
+# rebuild component list from the artifacts state.
+get_components()
+{
+ (
+ local components=""
+
+ manifest=""
+ [ -f "$top_artifacts/manifest.sh" ] && manifest=manifest.sh
+ [ -f "$top_artifacts/jenkins/manifest.sh" ] && manifest=jenkins/manifest.sh
+ [ x"$manifest" == x"" ] && error "Manifest not found"
+ # shellcheck disable=SC1090
+ source $top_artifacts/$manifest
+
+ for c in binutils gcc glibc llvm linux; do
+ if [ -f $top_artifacts/git/${c}_rev ] || [[ -v rr[${c}_rev] ]] ; then
+ components="$components $c"
+ fi
+ done
+ echo $components
+ )
+}
+
+# ----------------------- RECREATE FIRST RESULTS -----------------------------
+generate_csv_if_necessary()
+{
+ (
+ echo "* generate_csv_if_necessary ..."
+
+ # Exit if NN-check_regression/results-vs-xxx-brief.csv already exists
+ local check_regression_dir
+ check_regression_dir=$(find $top_artifacts/ -maxdepth 2 -name "*-check_regression")
+ if [ -f $top_artifacts/results-vs-first/results-brief.csv ] &&
+ [ -f $top_artifacts/results-vs-prev/results-brief.csv ]; then
+ return;
+ fi
+
+ # If no NN-check_regression dir exist : Create XX-check_regression
+ # and regenerate files results-vs-xxx-brief.csv.
+ if [ x"$check_regression_dir" == x"" ]; then
+ check_regression_dir="$top_artifacts/XX-check_regression"
+ mkdir -p $check_regression_dir
+ fi
+
+ local compare_opts
+ case $baseline_branch in
+ *arm_eabi*_LTO*) compare_opts="--num_symbols 0 --entry_threshold 10 --has_perf_logs no" ;;
+ *_LTO*) compare_opts="--num_symbols 0 --entry_threshold 10" ;;
+ *arm_eabi*) compare_opts="--has_perf_logs no" ;;
+ esac
+
+ local first_rev
+ first_rev=$(git -C $top_artifacts rev-list HEAD | tail -n 1)
+ git -C $top_artifacts show $first_rev:results_id > "$top_artifacts/results_id.first"
+
+ # if baseline is empty. need to compare against itself
+ if [ ! -f $baseline_artifacts/results_id ]; then
+ cp $top_artifacts/results_id $baseline_artifacts/results_id
+ fi
+
+ local pid1 pid2
+ # Compare vs first run
+ $scripts/tcwg-benchmark-results.sh \
+ --results_ref "$(cat $top_artifacts/results_id.first)" ++results "$(cat $top_artifacts/results_id)" \
+ --top_artifacts "$top_artifacts/results-vs-first" --verbose true $compare_opts \
+ > $top_artifacts/results-vs-first/tcwg-benchmark-results.log 2>&1 &
+ pid1=$!
+
+ # Compare vs previous run
+ $scripts/tcwg-benchmark-results.sh \
+ --results_ref "$(cat $baseline_artifacts/results_id)" ++results "$(cat $top_artifacts/results_id)" \
+ --top_artifacts "$top_artifacts/results-vs-prev" --verbose true $compare_opts \
+ > $top_artifacts/results-vs-prev/tcwg-benchmark-results.log 2>&1 &
+ pid2=$!
+
+ local res=0
+ wait $pid1 || res=$?
+ wait $pid2 || res=$?
+ if [ $res != 0 ]; then
+ echo "Failure while comparing run results."
+ fi
+ )
+}
+
+# --------------------------- MAIN PROCEDURE --------------------------------
+gitserver=https://git-us.linaro.org/toolchain/ci/base-artifacts.git
+top_artifacts=top_artifacts
+baseline_artifacts=current_baseline
+
+baseline_branch=${baseline_branch#refs/heads/}
+
+if [ ! -d $top_artifacts ]; then
+ git clone --single-branch --branch empty $gitserver $top_artifacts
+fi
+
+# Create emtpy dir to imitate baseline
+rm -rf $baseline_artifacts
+mkdir $baseline_artifacts
+
+echo "# base_artifact : fetch $baseline_branch"
+git -C $top_artifacts reset -q --hard
+git -C $top_artifacts fetch -q origin $baseline_branch
+git -C $top_artifacts branch -f $baseline_branch FETCH_HEAD
+git -C $top_artifacts clean -d -f
+git -C $top_artifacts checkout -q $baseline_branch
+
+# Dump list of commit that will be treated
+echo "----------------------------- $baseline_branch -----------------"
+git -C $top_artifacts log $baseline_branch --graph --oneline
+
+for sha1 in $(git -C $top_artifacts log $baseline_branch --pretty=%H | tac); do
+ (
+ echo "--------------------------------------------------------------------------------------------------"
+ # Dump current treated commit
+ git -C $top_artifacts show --no-patch --oneline $sha1
+
+ git -C $top_artifacts reset -q --hard
+ git -C $top_artifacts checkout -q -f $sha1
+
+ ans="y"
+ if $interactive; then
+ read -p "Do you want to add this results (y/n) ?" ans
+ fi
+
+ if [ "$ans" == "y" ]; then
+ declare -A rr
+ rr[top_artifacts]=$top_artifacts
+ rr[baseline_branch]=$baseline_branch
+ rr[components]=$(get_components)
+
+ # - create results-*.csv
+ generate_csv_if_necessary
+
+ # - create dashboard-*.sh scripts
+ # - run dashboard-generate.sh
+ create_dashboard_dir
+
+ # - run dashboard-push.sh
+ if ! $dryrun; then
+ $top_artifacts/dashboard/dashboard-push.sh
+ else
+ echo "Results NOT pushed"
+ fi
+ fi
+
+ rm -rf ${baseline_artifacts:?}/*
+ mv ${top_artifacts:?}/* $baseline_artifacts/
+
+ # clean artifacts dir
+ git -C $top_artifacts clean -d -f
+ )
+done