-
Notifications
You must be signed in to change notification settings - Fork 11
/
rt_testenv_setup.bash
executable file
·202 lines (155 loc) · 4.82 KB
/
rt_testenv_setup.bash
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
#!/usr/bin/env bash
#
# Copyright (c) 2019 Jeong Han Lee
# Copyright (c) 2019 European Spallation Source ERIC
#
# The 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 any newer 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, see https://www.gnu.org/licenses/gpl-2.0.txt
#
# Author : Jeong Han Lee
# email : jeonghan.lee@gmail.com
# Date : Thursday, November 28 13:54:11 CET 2019
#
# version : 0.0.5
# Only aptitude can understand the extglob option
shopt -s extglob
declare -gr SC_SCRIPT="$(realpath "$0")"
declare -gr SC_SCRIPTNAME=${0##*/}
declare -gr SC_TOP="${SC_SCRIPT%/*}"
declare -gr SC_LOGDATE="$(date +%y%m%d%H%M)"
. ${SC_TOP}/.cfgs/.functions
declare -gr LTP_PATH="${SC_TOP}/ltp"
declare -gr RTTESTS_PATH="${SC_TOP}/rt-tests"
declare -gr RTTESTS_INSTALL="${RTTESTS_PATH}/local"
declare -gr ltp_tag="tags/20190930";
declare -gr rt_tests_tag="tags/v1.5";
declare -gr SUDO_CMD="sudo";
function path_check
{
local _path="$1";
printf "what is this %s\n" ${_path}
if [ -d "${_path}" ]; then
printf ">>> We've found %s ..... Removing .... \n" "${_path}"
printf "\n\n";
rm -rf ${_path}
fi
}
function setup_ltp
{
local tags="$1"; shift;
local path="$1"; shift;
printf "\n\n";
printf ">>> We are going to setup LTP .....\n"
printf "\n\n";
pushd ${SC_TOP}
path_check "${path}"
git clone https://github.com/linux-test-project/ltp.git ${path}
pushd ${path}
git checkout "$tags"
make autotools
./configure
popd
pushd ${path}/testcases/realtime
./configure
printf "make -s\n";
make -s
popd
popd
}
function setup_rt_tests
{
local tags="$1"; shift;
local path="$1"; shift;
printf "\n\n";
printf ">>> We are going to setup rt-tests .....\n"
printf "\n\n";
pushd ${SC_TOP}
path_check "${path}"
git clone git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git "${path}"
pushd "${path}"
git checkout ${tags}
printf "make all -s\n"
make all -s
# sudo make install
popd
popd
}
function setup_rteval_debian
{
local installing_pkgs="python-libxml2 libxml2 python-lxml python-ethtool python-dmidecode curl python-libxslt1 python-schedule "
local path="rteval";
${SUDO_CMD} apt install -y $installing_pkgs
# Remove it without checking, because of ${SUDO_CMD} make install
${SUDO_CMD} rm -rf "${path}"
git clone git://git.kernel.org/pub/scm/linux/kernel/git/clrkwllms/rteval.git
pushd "${path}/loadsource"
# linux-4.9.tar.xz is defined in rteval/Makefile as KLOAD
# linux-4.9 is defined in modules/loads/kcompile.py as linux-4.9
# So, if one would like to use different kernel source, one should match them together
# with the download source file.
wget https://mirrors.edge.kernel.org/pub/linux/kernel/v4.x/linux-4.9.tar.xz
popd
pushd "${path}"
${SUDO_CMD} make install
popd
}
function print_usages
{
printf "\n\n";
printf ">>> Please consult the following sites to do test... \n"
printf " LTP : https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/ltp\n";
printf "rt-tests : https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/rt-tests\n";
printf "rteval : https://wiki.linuxfoundation.org/realtime/documentation/howto/tools/rteval\n";
print
}
function centos_pkgs
{
local installing_pkgs="autoconf python3 rteval";
printf "Installing .... %s\n" "$installing_pkgs" ;
${SUDO_CMD} yum -y install ${installing_pkgs};
}
function debian_pkgs
{
local installing_pkgs="autoconf python3";
printf "Installing .... %s\n" "$installing_pkgs" ;
${SUDO_CMD} apt -y install ${installing_pkgs}
}
ANSWER="NO"
dist=$(find_dist)
case "$dist" in
*"stretch"*)
if [ "$ANSWER" == "NO" ]; then
yes_or_no_to_go "Debian Stretch 9 is detected as $dist"
fi
debian_pkgs;
setup_ltp "$ltp_tag" "${LTP_PATH}";
setup_rt_tests "$rt_tests_tag" "$RTTESTS_PATH" ;
setup_rteval_debian;
;;
*"CentOS Linux 7"*)
if [ "$ANSWER" == "NO" ]; then
yes_or_no_to_go "CentOS Linux 7 is detected as $dist"
fi
centos_pkgs;
setup_ltp "$ltp_tag" "${LTP_PATH}";
setup_rt_tests "$rt_tests_tag" "$RTTESTS_PATH" ;
;;
*)
printf "\n";
printf "Doesn't support the detected $dist\n";
printf "Please contact jeonghan.lee@gmail.com\n";
printf "\n";
exit;
;;
esac
print_usages;