diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2022-09-17 10:48:17 +0000 |
---|---|---|
committer | Laurent Alfonsi <laurent.alfonsi@linaro.org> | 2022-09-22 21:27:01 +0000 |
commit | d652eda9f0064a3a21e8f8e8ab1391cf18fb4f19 (patch) | |
tree | 5ec8aa43209c9571e479e21747608f7850b2a0d9 | |
parent | c96e6e9e54f3fd1c0f59f45429e914a06b005071 (diff) |
round-robin.sh (print_results_date): New function
... to produce a reasonable date to associate with results / artifacts.
Change-Id: I8cf41270abc5b642ca7a86aab0dcc0021852306b
-rwxr-xr-x | dashboard-push-one-branch.sh | 2 | ||||
-rw-r--r-- | round-robin.sh | 70 | ||||
-rwxr-xr-x | tcwg_aosp-build.sh | 2 | ||||
-rwxr-xr-x | tcwg_bmk-build.sh | 2 | ||||
-rwxr-xr-x | tcwg_gnu-build.sh | 2 | ||||
-rwxr-xr-x | tcwg_kernel-build.sh | 2 |
6 files changed, 74 insertions, 6 deletions
diff --git a/dashboard-push-one-branch.sh b/dashboard-push-one-branch.sh index 06202ae3..a880999e 100755 --- a/dashboard-push-one-branch.sh +++ b/dashboard-push-one-branch.sh @@ -85,7 +85,7 @@ for sha1 in $(git -C $top_artifacts log FETCH_HEAD --pretty=%H | tac); do rr[top_artifacts]=$top_artifacts rr[baseline_branch]=$baseline_branch rr[components]=$(get_components) - rr[run_date]=$(git -C $top_artifacts show --no-patch --pretty="%cI" HEAD) + rr[start_date]=$(git -C $top_artifacts show --no-patch --pretty="%ct" HEAD) # create dashboard-generate.sh & dashboard-push.sh, # run dashboard-generate.sh diff --git a/round-robin.sh b/round-robin.sh index f25af57b..c12ec8e3 100644 --- a/round-robin.sh +++ b/round-robin.sh @@ -923,6 +923,19 @@ get_baseline_manifest () ) } +# Fetch and print value from manifest of the current build +# $1: Variable to fetch. +get_current_manifest () +{ + ( + set -euf -o pipefail + unset rr + declare -A rr + source ${rr[top_artifacts]}/manifest.sh + eval echo "\$$1" + ) +} + print_jira_card () { ( @@ -1100,6 +1113,53 @@ EOF ) } +# Print a reasonable date to associate with the current results / artifacts. +print_results_date () +{ + local c base_d cur_d results_date=0 + + # Firstly, set results_date to the max of commit dates of all components. + for c in "${components[@]}"; do + base_d=$(get_baseline_manifest "{rr[debug_${c}_date]}" \ + | cut -d" " -f 1 || true) + cur_d=$(get_current_manifest "{rr[debug_${c}_date]}" \ + | cut -d" " -f 1 || true) + if [ x"$base_d" != x"" ]; then + if [ x"$cur_d" = x"" ] || [ $cur_d -lt $base_d ]; then + cur_d="$base_d" + fi + fi + if [ x"$cur_d" = x"" ]; then + continue + fi + + if [ $cur_d -gt $results_date ]; then + results_date="$cur_d" + fi + done + + assert_with_msg "Failed to produce results_date" [ $results_date -gt 0 ] + + # Secondly, if we have a baseline date, return average between our + # current results_date and baseline date. The reason behind average + # is to spread out dates between bursts of builds, which can occur + # when reducing a regression. + base_d=$(get_baseline_manifest "{rr[results_date]}" || true) + if [ x"$base_d" != x"" ]; then + assert [ $results_date -ge $base_d ] + if [ $results_date -gt $base_d ]; then + results_date=$((($results_date + $base_d) / 2)) + else + # If the dates are equal, then no point in taking average. + # Instead just add duration of this build to move the date some + # arbitrary, but reasonable, amount. + results_date=$(($results_date + $(date +%s) - ${rr[start_date]})) + fi + fi + + echo $results_date +} + # create the dashboard directory, generate the dashboard-generate.sh file, and execute it. # (invoked from CHECK_REGRESSION stage) create_dashboard_dir () @@ -1110,6 +1170,14 @@ create_dashboard_dir () rm -rf ${rr[top_artifacts]}/dashboard mkdir -p ${rr[top_artifacts]}/dashboard + local results_date + results_date=$(print_results_date) + # Store results_date in the manifest. + cat <<EOF | manifest_out +rr[results_date]=$results_date +EOF + results_date=$(date -utc --iso-8601=seconds --date="@$results_date") + # Create dashboard-generate.sh cmd file cat > ${rr[top_artifacts]}/dashboard/dashboard-generate.sh << EOF #!/bin/bash @@ -1125,7 +1193,7 @@ fi --top_artifacts "\$top_artifacts" \\ --baseline_branch "${rr[baseline_branch]}" \\ --components "${rr[components]}" \\ - --run_date "${rr[run_date]}" + --run_date "$results_date" EOF chmod a+x ${rr[top_artifacts]}/dashboard/dashboard-generate.sh diff --git a/tcwg_aosp-build.sh b/tcwg_aosp-build.sh index f9c0418b..c90eb78a 100755 --- a/tcwg_aosp-build.sh +++ b/tcwg_aosp-build.sh @@ -24,7 +24,7 @@ rr[update_baseline]="${rr[update_baseline]-ignore}" rr[top_artifacts]="${rr[top_artifacts]-$(pwd)/artifacts}" # store date of the run -rr[run_date]="$(date --utc --iso-8601=seconds)" +rr[run_date]="$(date +%s)" # {toolchain}-{toolchain_ver}-{target}-{aosp_module}-{aosp_ver} IFS=- read -a ci_config <<EOF diff --git a/tcwg_bmk-build.sh b/tcwg_bmk-build.sh index bd2973b3..4d7b6aee 100755 --- a/tcwg_bmk-build.sh +++ b/tcwg_bmk-build.sh @@ -23,7 +23,7 @@ rr[update_baseline]="${rr[update_baseline]-ignore}" rr[top_artifacts]="${rr[top_artifacts]-$(pwd)/artifacts}" # store date of the run -rr[run_date]="$(date --utc --iso-8601=seconds)" +rr[start_date]="$(date +%s)" # {toolchain_name}-{toolchain_ver}-{target}-{bmk}-{cflags} IFS=- read -a ci_config <<EOF diff --git a/tcwg_gnu-build.sh b/tcwg_gnu-build.sh index 0f0cc591..27cdf2bd 100755 --- a/tcwg_gnu-build.sh +++ b/tcwg_gnu-build.sh @@ -28,7 +28,7 @@ rr[top_artifacts]="${rr[top_artifacts]-$(pwd)/artifacts}" rr[top_artifacts]=$(abs_path "${rr[top_artifacts]}") # store date of the run -rr[run_date]="$(date --utc --iso-8601=seconds)" +rr[run_date]="$(date +%s)" # {toolchain_ver}-{target}[-{type_of_test}] IFS=- read -a ci_config <<EOF diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh index 13f988c2..3c8a29c9 100755 --- a/tcwg_kernel-build.sh +++ b/tcwg_kernel-build.sh @@ -24,7 +24,7 @@ rr[update_baseline]="${rr[update_baseline]-ignore}" rr[top_artifacts]="${rr[top_artifacts]-$(pwd)/artifacts}" # store date of the run -rr[run_date]="$(date --utc --iso-8601=seconds)" +rr[start_date]="$(date +%s)" # {toolchain_name}-{toolchain_ver}-{target}-{linux}-{linux_config} IFS=- read -a ci_config <<EOF |