forked from adoptium/aqa-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rerun.sh
executable file
·118 lines (108 loc) · 2.17 KB
/
rerun.sh
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
#!/bin/bash
if [[ ! $# -gt 0 ]] || [[ "$1" != "--link" ]] || [[ "$3" != "--file" ]]
then
echo "Usage: "
echo "rerun.sh --link rerunLink --file SHA_file"
exit 1
fi
link=$2
sha=$4
declare -A values
state=false
# This loop reads the file line by line and stores the content in an array.
# Structure of array = url,sha=repo dir
while read line;
do
if [[ $line == *"repo dir:"* ]]
then
read -ra value <<< "$line"
dir="${value[2]}"
value=""
fi
if [[ $line == *"Fetch URL:"* ]]
then
read -ra value <<< "$line"
url="${value[2]}"
value=""
fi
if [[ $state = true ]]
then
sha=$line
state=false
values["$url, $sha"]=$dir
fi
if [[ $line == *"sha"* ]]
then
state=true
fi
done < "$sha"
# This function parses the given link to obtain values such as BUILD_LIST, TARGET.
linkParse(){
IFS='&'
read -ra splitted<<<$link
IFS='='
for i in "${splitted[@]}"
do
if [[ $i == *"TARGET"* ]]
then
read -ra value<<<$i
TARGET="${value[1]}"
elif [[ $i == *"BUILD_LIST"* ]]
then
read -ra value<<<$i
BUILD_LIST="${value[1]}"
elif [[ $i == *"JDK_VERSION"* ]]
then
read -ra value<<<$i
JDK_VERSION="${value[1]}"
elif [[ $i == *"JDK_IMPL"* ]]
then
read -ra value<<<$i
JDK_IMPL="${value[1]}"
fi
done
}
linkParse
for i in "${!values[@]}"
do
IFS=', '
read -ra j<<<$i
if [[ "${j[0]}" == *"aqa-tests.git"* ]]
then
echo "Fetching aqa-tests..."
git clone "${j[0]}"
cd aqa-tests
git checkout "${j[1]}"
fi
done
cd ..
for i in "${!values[@]}"
do
# Here it splits the keys of array then controls the contents.
IFS=', '
read -ra j<<<$i
if [[ "${j[0]}" == *"aqa-tests.git"* ]]
then
continue
elif [[ "${j[0]}" == *"openj9.git"* ]]
then
OPENJ9_SHA="${j[1]}"
elif [[ "${j[0]}" == *"TKG.git"* ]]
then
TKG_SHA="${j[1]}"
elif [[ "${values[$i]}" == *"openjdk-jdk"* && $BUILD_LIST == *"openjdk"* ]]
then
echo "Setting openjdk variables..."
export JDK_REPO=${j[0]}
export OPENJDK_SHA=${j[1]}
fi
done
cd aqa-tests
./get.sh --openj9_sha "$OPENJ9_SHA" --tkg_sha "$TKG_SHA"
cd TKG
export BUILD_LIST="${BUILD_LIST}"
export TARGET="${TARGET}"
export JDK_VERSION="${JDK_VERSION}"
export JDK_IMPL="${JDK_IMPL}"
make compile
make "_$TARGET"