-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathrelease-check-extended.sh
More file actions
executable file
·184 lines (151 loc) · 5.27 KB
/
release-check-extended.sh
File metadata and controls
executable file
·184 lines (151 loc) · 5.27 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
#!/usr/bin/env sh
BIN_DIR=$(cd "$(dirname "$0")"; pwd)
# include common variables and functions
source "${BIN_DIR}/release-check-common.sh"
# 50=Java 1.6
# 51=Java 1.7
# 52=Java 1.8
# 53=Java 1.9
# 55=Java 11
# 61=Java 17
javaVersion="major version: 61"
# extract archive to a specific location
function extract_archive_to {
if [ -z "$1" ]; then
error "No archive provided"
exit 1
fi
# Create destination folder if it does not exist already
if ! [ -d "$2" ]; then
mkdir "$2"
fi
if echo "$1" | grep "zip"; then
unzip -q "$1" -d "$2"
elif echo "$1" | grep "tar.gz"; then
tar -xzf "$1" -C "$2"
else
error "Archive '$1' is neither zip nor .tar.gz"
exit 1
fi
}
function check_bin_archive {
if [ -z "$1" ]; then
error "No source archive provided"
exit 1
fi
information "Decompressing archive '$1' ..."
extract_archive_n_cd "$1"
touch $(basename "$1") # just to mark where this dir comes from
# check bytecode version of classes contained in jar
information "Making sure that bytecode version of class in jar is $javaVersion"
MAIN_JAR=$(ls "${DIST_JAR_DIR}/kieker-"*".jar" | grep -E "kieker-[^-]*(-SNAPSHOT)?.jar")
assert_file_exists_regular ${MAIN_JAR}
VERSION_CLASS_IN_JAR=$(unzip -l ${MAIN_JAR} | grep Version.class | awk '{ print $4 }')
unzip "${MAIN_JAR}" "${VERSION_CLASS_IN_JAR}"
assert_file_exists_regular "${VERSION_CLASS_IN_JAR}"
if ! javap -verbose ${VERSION_CLASS_IN_JAR} | grep -q "${javaVersion}"; then
found=`javap -verbose ${VERSION_CLASS_IN_JAR} | grep -q "major version:"`
error "Unexpected bytecode version: ${found} expected: ${javaVersion}"
exit 1
else
information "Found bytecode version ${javaVersion}, OK"
fi
CONVERTER_NAME=`ls tools/convert-logging-timestamp*zip`
extract_archive "${CONVERTER_NAME}"
CONVERTER_SCRIPT=`ls convert-logging-timestamp*/bin/convert-logging-timestamp`
# some basic tests with the tools
if ! (${CONVERTER_SCRIPT} --timestamps 1283156545581511026 1283156546127117246 | grep "Mon, 30 Aug 2010 08:22:25.581 +0000 (UTC)"); then
error "Unexpected result executing convert-logging-timestamp"
exit 1
fi
# now perform some trace analysis tests and compare results with reference data
for testset in "kieker-20100830-082225522-UTC-example-plots" \
"kieker-20141008-101258768-UTC-example-plots" \
"kieker-20141008-101258768-UTC-repairEventBasedTraces-example-plots" \
"kieker-20141009-160413833-UTC-operationExecutionsConstructors-example-plots" \
"kieker-20141009-163010944-UTC-constructor-events-example-plots"; do
ARCHDIR=$(pwd)
create_subdir_n_cd
REFERENCE_OUTPUT_DIR="${ARCHDIR}/examples/userguide/ch5--trace-monitoring-aspectj/testdata/${testset}"
PLOT_SCRIPT="${ARCHDIR}/examples/userguide/ch5--trace-monitoring-aspectj/testdata/${testset}.sh"
if ! test -x ${PLOT_SCRIPT}; then
error "${PLOT_SCRIPT} does not exist or is not executable"
exit 1
fi
information "Executing ${PLOT_SCRIPT} ${ARCHDIR} ."
if ! ${PLOT_SCRIPT} "${ARCHDIR}" "."; then # passing kieker dir and output dir
error "${PLOT_SCRIPT} returned with error"
exit 1
fi
information "Output directory ${REFERENCE_OUTPUT_DIR}"
for f in $(ls "${REFERENCE_OUTPUT_DIR}" | egrep "(dot$|pic$|html$|txt$)"); do
information "Comparing to reference file $f ... "
if test -z "$f"; then
error "File $f does not exist or is empty"
exit 1;
else
# Note that this is a hack because sometimes the line order differs
(cat "$f" | sort) > left.tmp
(cat "${REFERENCE_OUTPUT_DIR}/$f" | sort) > right.tmp
if test "$f" = "traceDeploymentEquivClasses.txt" || test "$f" = "traceAssemblyEquivClasses.txt"; then
# only the basic test already performed because the assignment to classes is not deterministic
information "OK"
continue;
fi
if ! diff left.tmp right.tmp; then
error "Detected deviation between files: '$f', '${REFERENCE_OUTPUT_DIR}/${f}'"
exit 1
else
information "OK"
fi
fi
done
# Return to archive base dir
cd ${ARCHDIR}
done
EXAMPLE_RUN_SCRIPT_SH="${BIN_DIR}/../../examples/runAllExamples.sh"
information "Running all examples"
if ! (cd examples && $EXAMPLE_RUN_SCRIPT_SH); then
error "Examples where not successful"
exit 1
else
information "Ok"
fi
}
##
## "main"
##
TMP_ZIP_DIR=zip
TMP_TGZ_DIR=tgz
#
## binary releases
#
information "--------------------------------"
information "Binary release"
information "--------------------------------"
assert_dir_exists ${BASE_TMP_DIR}
change_dir "${BASE_TMP_DIR}"
BASE_TMP_DIR_ABS=$(pwd)
change_dir "${BASE_TMP_DIR_ABS}"
create_subdir_n_cd
DIR=$(pwd)
#information "Binary ZIP"
#BINZIP=$(ls ../../${DIST_RELEASE_DIR}/*-binaries.zip)
#extract_archive_to ${BINZIP} ${TMP_ZIP_DIR}
information "Binary TGZ"
BINTGZ=$(ls ../../${DIST_RELEASE_DIR}/*-binaries.tar.gz)
extract_archive_to ${BINTGZ} ${TMP_TGZ_DIR}
#diff -r "${TMP_TGZ_DIR}" "${TMP_ZIP_DIR}"
#DIFF_BIN_RESULT=$?
# cleanup temporary folders we created for the comparison
rm -rf "${TMP_BINZIP_DIR}"
# "${TMP_GZ_DIR}"
#if [ ${DIFF_BIN_RESULT} -eq 0 ]; then
# information "The content of both binary archives is identical."
check_bin_archive "${BINTGZ}"
#else
# error "The content of both binary archives is NOT identical."
# exit 1
#fi
#rm -rf "${DIR}"
# end