blob: 19343fea1fac2b1222a6390ce425d826c907e672 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
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
|