-
Notifications
You must be signed in to change notification settings - Fork 8
/
test_image.sh
executable file
·73 lines (61 loc) · 2.26 KB
/
test_image.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
#!/usr/bin/env bash
################################################################################
# PROJECT: Squeak Bundle Generation
# FILE: test_image.sh
# CONTENT: Use smalltalkCI to run all tests in the prepared image.
#
# REQUIRES:
# SMALLTALK_VERSION ... e.g., Squeak64-trunk
# SMALLTALK_CI_HOME ... i.e., the path to smalltalkCI sources
# tmp/Squeak.image
# tmp/Squeak.changes
# tmp/*.sources
# PROVIDES:
# tmp/*.xml i.e., the test results
#
# AUTHORS: Fabio Niephaus, Hasso Plattner Institute, Potsdam, Germany
# Marcel Taeumel, Hasso Plattner Institute, Potsdam, Germany
################################################################################
set -o errexit
source "env_vars"
source "helpers.sh"
[[ -z "${SMALLTALK_VERSION}" ]] && exit 2
[[ -z "${SMALLTALK_CI_HOME}" ]] && exit 3
readonly SCI_PATH="${HOME_PATH}/smalltalk-ci"
test_image() {
local ston_config="default.ston"
if [[ -f "${SCI_PATH}/${SMALLTALK_VERSION}.ston" ]]; then
ston_config="${SMALLTALK_VERSION}.ston"
fi
cp "${TMP_PATH}/Squeak.image" "${TMP_PATH}/Test.image"
cp "${TMP_PATH}/Squeak.changes" "${TMP_PATH}/Test.changes"
# Prepare usage of relative paths to improve compatibility with Windows
cp "${SCI_PATH}/${ston_config}" "${TMP_PATH}/${ston_config}"
cp -r "${SMALLTALK_CI_HOME}/repository" "${HOME_PATH}/smalltalk-ci"
begin_group "Testing Squeak via smalltalkCI using ${ston_config}..."
export SCIII_COLORFUL="true"
pushd "${TMP_PATH}" > /dev/null
"${SMALLTALK_VM}" -headless "Test.image" \
"../test_image.st" "${SMALLTALK_VERSION}" \
"../smalltalk-ci" "${ston_config}" \
|| true # Ignore crashes/failures
popd > /dev/null
check_test_status
end_group
}
check_test_status() {
local test_status_file="build_status.txt"
local build_status
if ! is_file "${TMP_PATH}/${test_status_file}"; then
print_error "...build failed before tests were performed correctly!"
exit 1
fi
build_status=$(cat "${TMP_PATH}/${test_status_file}")
if [[ ! -z "${build_status}" ]]; then
# Note that build_status is not expected to be "[successful]" but empty on success
print_warning "...all tests were performed correctly but they did not all pass."
exit 1
fi
}
prepare_platform_vm
test_image