-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgeneral_setup
executable file
·205 lines (195 loc) · 5.22 KB
/
general_setup
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
#
# 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.
#
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_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 " --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."
exit 1
}
to_sys_type=`hostname`
to_configuration=`hostname`
to_home_root=`echo $HOME | rev | cut -d'/' -f 2- | rev`
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
top_dir=`echo $0 | sed "s/workloads/:/g" | cut -d':' -f 1`
to_tuned_setting=""
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
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)
iteration_default=$value
shift 2
;;
--no_pkg_install)
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 active ${value}
else
echo Warning: asking for tuned setting $value, but tuned-adm is not installed.
fi
fi
shift 2
;;
--usage)
gs_usage_info
;;
--)
break;
;;
*)
#
# Option not recognized, must be specific to the wrapper.
#
gen_args_back=${gen_args_back}" "${1}
i=$((i + 1))
shift 1
;;
esac
done
if [ $to_times_to_run -eq 0 ]; then
to_times_to_run=$iteration_default
fi
TOOLS_BIN=`pwd`/test_tools
if [ ! -d $TOOLS_BIN ]; then
TOOLS_BIN=${to_home_root}/${to_user}/test_tools
fi
if [[ $to_tuned_setting == "" ]]; then
to_tuned_setting=`./test_tools/get_tuned_setting`
fi
set $gen_args_back