-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgeneral_setup
More file actions
executable file
·261 lines (249 loc) · 6.74 KB
/
general_setup
File metadata and controls
executable file
·261 lines (249 loc) · 6.74 KB
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#
# Copyright (C) 2022 David Valin dvalin@redhat.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
#
# This file is contains code that is common among the test wrappers.
#
#
# Source .bashrc to keep pbench happy.
#
test_cmd=$0
source ~/.bashrc
# Values setting for test wrappers to use.
#
# TOOLS_BIN: points to the tool directory
# to_home_root: home directory
# to_configuration: configuration information
# to_times_to_run: number of times to run the test
# to_pbench: Run the test via pbench
# to_pbench_copy: Copy the pbench data, not move it.
# to_puser: User running pbench
# to_pstats: pbench stats to use
# to_run_label: Label for the run
# to_user: User on the test system running the test
# to_sys_type: for results info, basically aws, azure or local
# to_sysname: name of the system
# to_test_verify_file: name of test verification file
# to_tuned_setting: tuned setting
# to_no_pkg_install: Test is not to use dnf/yum/apt or other such tools
#
# Present usage information.
#
gs_usage_info()
{
echo "General options"
echo " --home_parent <value>: Our parent home directory. If not set, defaults to current working directory."
echo " --host_config <value>: default is the current host name."
echo " --iterations <value>: Number of times to run the test, defaults to 1."
echo " --iteration_default <value>: Value to set iterations to, if default is not set."
echo " --no_pkg_install: Test is not to use dnf/yum/apt or other such tools"
echo " --pbench: use pbench-user-benchmark and place information into pbench, defaults to do not use."
echo " --pbench_user <value>: user who started everything. Defaults to the current user."
echo " --pbench_copy: Copy the pbench data, not move it."
echo " --pbench_stats: What stats to gather. Defaults to all stats."
echo " --run_label: the label to associate with the pbench run. No default setting."
echo " --run_user: user that is actually running the test on the test system. Defaults to user running wrapper."
echo " --sys_type: Type of system working with, aws, azure, hostname. Defaults to hostname."
echo " --sysname: name of the system running, used in determining config files. Defaults to hostname."
echo " --json_skip: Skip JSON conversion of test CSV results, default is 0"
echo " --verify_skip: Skip test verifications against output, default is 0"
echo " --tuned_setting: used in naming the tar file, default for RHEL is the current active tuned. For non"
echo " RHEL systems, default is none."
echo " --usage: this usage message."
echo " --use_pcp: Enables use of Performance Co-Pilot in wrappers, defaults to 0."
echo " --debug: Enables bash -x output, useful for debugging issues with wrappers"
exit 1
}
to_sys_type=`hostname`
to_sys_env="local"
to_configuration=`hostname`
to_home_root=`echo $HOME | rev | cut -d'/' -f 2- | rev`
to_script_dir=`dirname $(realpath $0)`
if [[ $to_home_root == "" ]]; then
to_home_root="/"
fi
to_pbench=0
to_pbench_copy="0"
to_puser=`whoami`
to_run_user=`whoami`
to_times_to_run=0
iteration_default=1
to_run_label=""
to_user=`whoami`
to_sysname=`hostname`
to_pstats="default"
to_no_pkg_install=0
skip_verification=0
to_verify_flags=""
to_json_flags=""
to_tuned_setting=""
to_use_pcp=0
i=1
j=$#
gen_args_back=$0
while [ $i -le $j ]
do
#
# Ansible causing problems again, getting passed }} for some reason from random workloads, filter it out.
#
value=`echo $2 | sed "s/}//g"`
case "$1" in
--sys_type)
i=$((i + 2))
to_sys_type=$value
to_sys_env=$value
shift 2
;;
--home_parent)
i=$((i + 2))
to_home_root=$value
shift 2
;;
--host_config)
i=$((i + 2))
to_configuration=$value
shift 2
;;
--iterations)
i=$((i + 2))
to_times_to_run=$value
shift 2
;;
--iteration_default)
i=$((i + 2))
iteration_default=$value
shift 2
;;
--no_pkg_install)
i=$((i + 1))
to_no_pkg_install=1
shift 1
;;
--pbench)
to_pbench=1
i=$((i + 1))
shift 1
;;
--pbench_copy)
to_pbench_copy=1
i=$((i + 1))
shift 1
;;
--pbench_stats)
i=$((i + 2))
to_pstats=$value
shift 2
;;
--pbench_user)
i=$((i + 2))
to_puser=$value
shift 2
;;
--run_label)
i=$((i + 2))
to_run_label=$value
shift 2
;;
--run_user)
i=$((i + 2))
to_user=$value
shift 2
;;
--sysname)
i=$((i + 2))
to_sysname=$value
shift 2
;;
--tuned_setting)
i=$((i + 2))
if [[ $value != *"none"* ]]; then
to_tuned_setting="${value}"
if [ -f /usr/sbin/tuned-adm ]; then
tuned-adm profile ${value}
if [[ $? -ne 0 ]]; then
echo Warning: Unable to set tuned profile $value.
fi
else
echo Warning: asking for tuned setting $value, but tuned-adm is not installed.
fi
fi
shift 2
;;
--usage)
gs_usage_info
;;
--verify_skip)
to_verify_flags="$1"
skip_verification=1
shift 1
;;
--json_skip)
to_json_flags="$1"
shift 1
;;
--use_pcp)
i=$((i + 1))
to_use_pcp=1
shift 1
;;
--debug)
i=$((i + 1))
set -x
shift 1
;;
--)
break;
;;
*)
#
# Option not recognized, must be specific to the wrapper.
#
gen_args_back=${gen_args_back}" "${1}
i=$((i + 1))
shift 1
;;
esac
done
export to_sys_env
if [[ ! -d $TOOLS_BIN ]]; then
TOOLS_BIN=${to_home_root}/${to_user}/test_tools
fi
if [[ $to_tuned_setting == "" ]]; then
to_tuned_setting=`${TOOLS_BIN}/get_tuned_setting`
fi
if [[ "$skip_verification" -eq 0 ]]; then
${TOOLS_BIN}/package_tool --wrapper_config ${TOOLS_BIN}/deps/verification.json --no_packages $to_no_pkg_install
fi
#
# Get the actual setting of the tuned for future comparison,
# Do not depend on $to_tuned_setting. It might not have set
# properly to start with.
#
which tuned-adm >> /dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo tuned-adm not available > ~/tuned_before
else
tuned-adm active | cut -d: -f 2 | sed "s/ //g" > ~/tuned_before
fi
if [[ $to_test_verify_file != "" ]]; then
$TOOLS_BIN/verification --test_cmd $test_cmd --test_name $test_name --verify_file $to_test_verify_file --run_user $to_user --home_parent $to_home_root
exit $?
fi
if [ $to_times_to_run -eq 0 ]; then
to_times_to_run=$iteration_default
fi
set $gen_args_back