Skip to content

Commit e4a9277

Browse files
committed
Remove check_version in common_functions.sh
- remove check_version function - remove set_version function resolves : #4949 Signed-off-by: Anna Babu Palathingal <[email protected]>
1 parent 3becd04 commit e4a9277

File tree

2 files changed

+116
-140
lines changed

2 files changed

+116
-140
lines changed

external/build_image.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ check_external_custom=$9
4242
if [[ "${check_external_custom}" == "0" ]]; then
4343
set_test $1
4444
fi
45-
set_version $2
45+
4646
set_vm $3
4747
set_os $4
4848
set_package $5

external/common_functions.sh

+115-139
Original file line numberDiff line numberDiff line change
@@ -32,214 +32,190 @@ supported_builds="full"
3232
# Supported tests
3333
supported_tests="external_custom camel criu-portable-checkpoint criu-portable-restore criu-ubi-portable-checkpoint criu-ubi-portable-restore derby elasticsearch jacoco jenkins functional-test kafka lucene-solr openliberty-mp-tck payara-mp-tck quarkus quarkus_quickstarts scala system-test tomcat tomee wildfly wycheproof netty spring zookeeper"
3434

35-
function check_version() {
36-
version=$1
37-
38-
for current_version in ${supported_versions}
39-
do
40-
if [[ "${version}" == "${current_version}" ]]; then
41-
return 1
42-
fi
43-
done
44-
45-
return 0
46-
}
47-
48-
# Set a valid version
49-
function set_version() {
50-
version=$1
51-
52-
if (check_version ${version}); then
53-
echo "ERROR: Invalid Version: ${version}"
54-
echo "Usage: $0 [${supported_versions}]"
55-
exit 1
56-
fi
57-
}
58-
5935
function check_os() {
60-
os=$1
36+
os=$1
6137

62-
for current_os in ${supported_os}
63-
do
64-
if [[ "${os}" == "${current_os}" ]]; then
65-
return 1
66-
fi
67-
done
38+
for current_os in ${supported_os}
39+
do
40+
if [[ "${os}" == "${current_os}" ]]; then
41+
return 1
42+
fi
43+
done
6844

69-
return 0
45+
return 0
7046
}
7147

7248
# Set a valid os
7349
function set_os() {
74-
os=$1
75-
if (check_os ${os}); then
76-
echo "ERROR: Invalid OS: ${os}"
77-
echo "Usage: $0 [${supported_os}]"
78-
exit 1
79-
fi
50+
os=$1
51+
if (check_os ${os}); then
52+
echo "ERROR: Invalid OS: ${os}"
53+
echo "Usage: $0 [${supported_os}]"
54+
exit 1
55+
fi
8056
}
8157

8258
function check_test() {
83-
test=$1
59+
test=$1
8460

85-
for current_test in ${supported_tests}
86-
do
87-
if [[ "${test}" == "${current_test}" ]]; then
88-
return 1
89-
fi
90-
done
61+
for current_test in ${supported_tests}
62+
do
63+
if [[ "${test}" == "${current_test}" ]]; then
64+
return 1
65+
fi
66+
done
9167

92-
return 0
68+
return 0
9369
}
9470

9571
# Set a valid test
9672
function set_test() {
97-
test=$1
98-
if (check_test ${test}); then
99-
echo "ERROR: Invalid Test: ${test}"
100-
echo "Usage: $0 [${supported_tests}]"
101-
exit 1
102-
fi
73+
test=$1
74+
if (check_test ${test}); then
75+
echo "ERROR: Invalid Test: ${test}"
76+
echo "Usage: $0 [${supported_tests}]"
77+
exit 1
78+
fi
10379
}
10480

10581
function check_vm() {
106-
vm=$1
82+
vm=$1
10783

108-
for current_vm in ${supported_jvms}
109-
do
110-
if [[ "${vm}" == "${current_vm}" ]]; then
111-
return 1
112-
fi
113-
done
84+
for current_vm in ${supported_jvms}
85+
do
86+
if [[ "${vm}" == "${current_vm}" ]]; then
87+
return 1
88+
fi
89+
done
11490

115-
return 0
91+
return 0
11692
}
11793

11894
# Set a valid vm
11995
function set_vm() {
120-
vm=$1
121-
if (check_vm ${vm}); then
122-
echo "ERROR: Invalid VM: ${vm}"
123-
echo "Usage: $0 [${supported_jvms}]"
124-
exit 1
125-
fi
96+
vm=$1
97+
if (check_vm ${vm}); then
98+
echo "ERROR: Invalid VM: ${vm}"
99+
echo "Usage: $0 [${supported_jvms}]"
100+
exit 1
101+
fi
126102
}
127103

128104
function check_package() {
129-
package=$1
105+
package=$1
130106

131-
for current_package in ${supported_packages}
132-
do
133-
if [[ "${package}" == "${current_package}" ]]; then
134-
return 1
135-
fi
136-
done
107+
for current_package in ${supported_packages}
108+
do
109+
if [[ "${package}" == "${current_package}" ]]; then
110+
return 1
111+
fi
112+
done
137113

138-
return 0
114+
return 0
139115
}
140116

141117
# Set a valid package
142118
function set_package() {
143-
package=$1
144-
if (check_package ${package}); then
145-
echo "ERROR: Invalid Package: ${package}"
146-
echo "Usage: $0 [${supported_packages}]"
147-
exit 1
148-
fi
119+
package=$1
120+
if (check_package ${package}); then
121+
echo "ERROR: Invalid Package: ${package}"
122+
echo "Usage: $0 [${supported_packages}]"
123+
exit 1
124+
fi
149125
}
150126

151127
function check_build() {
152-
build=$1
128+
build=$1
153129

154-
for current_build in ${supported_builds}
155-
do
156-
if [[ "${build}" == "${current_build}" ]]; then
157-
return 1
158-
fi
159-
done
130+
for current_build in ${supported_builds}
131+
do
132+
if [[ "${build}" == "${current_build}" ]]; then
133+
return 1
134+
fi
135+
done
160136

161-
return 0
137+
return 0
162138
}
163139

164140
# Set a valid build
165141
function set_build() {
166-
build=$1
167-
if (check_build ${build}); then
168-
echo "ERROR: Invalid Build: ${build}"
169-
echo "Usage: $0 [${supported_builds}]"
170-
exit 1
171-
fi
142+
build=$1
143+
if (check_build ${build}); then
144+
echo "ERROR: Invalid Build: ${build}"
145+
echo "Usage: $0 [${supported_builds}]"
146+
exit 1
147+
fi
172148
}
173149

174150
# Set a platform
175151
function set_platform() {
176-
# TO-DO: Add supported_platforms when portable tests support more platforms
177-
platform=$1
152+
# TO-DO: Add supported_platforms when portable tests support more platforms
153+
platform=$1
178154
}
179155

180156
# Set base_docker_registry_url
181157
function set_base_docker_registry_url() {
182-
base_docker_registry_url="$1"
158+
base_docker_registry_url="$1"
183159
}
184160

185161
# Set base_docker_registry_dir
186162
function set_base_docker_registry_dir() {
187-
base_docker_registry_dir="$1"
163+
base_docker_registry_dir="$1"
188164
}
189165

190166
# Reading properties of test.properties file
191167
function getProperty() {
192-
PROP_KEY=$1
193-
PROP_VALUE=`cat $PROPERTY_FILE | grep "$PROP_KEY" | cut -d'=' -f 2-`
194-
echo `sed -e 's/^"//' -e 's/"$//' <<<"$PROP_VALUE"`
168+
PROP_KEY=$1
169+
PROP_VALUE=`cat $PROPERTY_FILE | grep "$PROP_KEY" | cut -d'=' -f 2-`
170+
echo `sed -e 's/^"//' -e 's/"$//' <<<"$PROP_VALUE"`
195171
}
196172

197173
# Used for external_custom tests
198174
function set_external_custom_test_info(){
199-
test=$1
200-
check_external_custom_test=$2
201-
github_url="${EXTERNAL_CUSTOM_REPO}"
202-
test_command="${EXTERNAL_TEST_CMD}"
203-
test_results="testResults"
204-
tag_version="${EXTERNAL_REPO_BRANCH}"
205-
environment_variable="MODE=java"
206-
ubuntu_packages="git"
207-
maven_version="3.8.5"
175+
test=$1
176+
check_external_custom_test=$2
177+
github_url="${EXTERNAL_CUSTOM_REPO}"
178+
test_command="${EXTERNAL_TEST_CMD}"
179+
test_results="testResults"
180+
tag_version="${EXTERNAL_REPO_BRANCH}"
181+
environment_variable="MODE=java"
182+
ubuntu_packages="git"
183+
maven_version="3.8.5"
208184
}
209185

210186
# Set the valid OSes for the current architectures.
211187
function set_test_info() {
212-
test=$1
213-
check_external_custom_test=$2
214-
cd ../
215-
path_to_file=$(pwd)
216-
echo ${path_to_file}
217-
PROPERTY_FILE=${path_to_file}/${test}/test.properties
218-
github_url=$(getProperty "github_url")
219-
test_options=$(getProperty "test_options")
220-
test_results=$(getProperty "test_results")
221-
ant_version=$(getProperty "ant_version")
222-
ant_contrib_version=$(getProperty "ant_contrib_version")
223-
ivy_version=$(getProperty "ivy_version")
224-
jdk_install=$(getProperty "jdk_install")
225-
tag_version=$(getProperty "tag_version")
226-
gradle_version=$(getProperty "gradle_version")
227-
sbt_version=$(getProperty "sbt_version")
228-
bazel_version=$(getProperty "bazel_version")
229-
openssl_version=$(getProperty "openssl_version")
230-
python_version=$(getProperty "python_version")
231-
criu_version=$(getProperty "criu_version")
232-
maven_version=$(getProperty "maven_version")
233-
environment_variable=$(getProperty "environment_variable")
234-
localPropertyFile=$(getProperty "localPropertyFile")
235-
ubuntu_packages=$(getProperty "ubuntu_packages")
236-
ubi_packages=$(getProperty "ubi_packages")
188+
test=$1
189+
check_external_custom_test=$2
190+
cd ../
191+
path_to_file=$(pwd)
192+
echo ${path_to_file}
193+
PROPERTY_FILE=${path_to_file}/${test}/test.properties
194+
github_url=$(getProperty "github_url")
195+
test_options=$(getProperty "test_options")
196+
test_results=$(getProperty "test_results")
197+
ant_version=$(getProperty "ant_version")
198+
ant_contrib_version=$(getProperty "ant_contrib_version")
199+
ivy_version=$(getProperty "ivy_version")
200+
jdk_install=$(getProperty "jdk_install")
201+
tag_version=$(getProperty "tag_version")
202+
gradle_version=$(getProperty "gradle_version")
203+
sbt_version=$(getProperty "sbt_version")
204+
bazel_version=$(getProperty "bazel_version")
205+
openssl_version=$(getProperty "openssl_version")
206+
python_version=$(getProperty "python_version")
207+
criu_version=$(getProperty "criu_version")
208+
maven_version=$(getProperty "maven_version")
209+
environment_variable=$(getProperty "environment_variable")
210+
localPropertyFile=$(getProperty "localPropertyFile")
211+
ubuntu_packages=$(getProperty "ubuntu_packages")
212+
ubi_packages=$(getProperty "ubi_packages")
237213
}
238214

239215
function cleanup_images() {
240-
# Delete any old containers that have exited.
241-
docker rm $(docker ps -a | grep "Exited" | awk '{ print $1 }') 2>/dev/null
216+
# Delete any old containers that have exited.
217+
docker rm $(docker ps -a | grep "Exited" | awk '{ print $1 }') 2>/dev/null
242218

243-
# Delete any old images for our target_repo on localhost.
244-
docker rmi -f $(docker images | grep -e "adoptopenjdk" | awk '{ print $3 }' | sort | uniq) 2>/dev/null
219+
# Delete any old images for our target_repo on localhost.
220+
docker rmi -f $(docker images | grep -e "adoptopenjdk" | awk '{ print $3 }' | sort | uniq) 2>/dev/null
245221
}

0 commit comments

Comments
 (0)