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
|
#! /bin/bash
# Update PATH to include path to Tclkit, otherwise cross-compiles will fail
PATH="${PATH}:/home/rkeene/bin:/usr/local/bin"
export PATH
# Define build and web paths
KITCREATORDIR="/home/rkeene/devel/kitcreator"
WEBROOTDIR="/web/rkeene/devel/kitcreator/kitbuild"
export KITCREATORDIR WEBROOTDIR
cd "${KITCREATORDIR}" || exit 1
FOSSIL_CHANGE="$(fossil timeline -n 1 -t ci | grep '^[0-9:]* \[' | sed 's@^[0-9:]* \[\([0-9a-f]*\)\].*$@\1@')"
TESTNAME="fossil_${FOSSIL_CHANGE}"
export FOSSIL_CHANGE TESTNAME
# On Wednesday, do a distclean to force redownloading everything (mainly
# for CVS Head) and force a rebuild to ensure up-to-date build status
if [ "$(date '+%u')" = "3" ]; then
./kitcreator distclean || exit 1
touch "${KITCREATORDIR}/build/test/force_nightly"
fi
if [ -d "${WEBROOTDIR}/${TESTNAME}" ]; then
# Don't re-run the tests if nothing has changed
if [ -f "${KITCREATORDIR}/build/test/force_nightly" ]; then
rm -f "${KITCREATORDIR}/build/test/force_nightly"
else
exit 0
fi
fi
cd build/test || exit 1
if [ ! -x test -o ! -x publish-tests ]; then
echo 'Missing scripts, aborting.' >&2
exit 1
fi
# Only run one at a time
if [ -f '__AUTO_TESTS_RUNNING__' ]; then
exit 1
fi
touch '__AUTO_TESTS_RUNNING__'
# Clean builds
rm -rf kits
# Run tests
nice -n 20 ./test >/dev/null 2>/dev/null
# Clean old auto-generated published results
rm -rf "${WEBROOTDIR}"/svn_r*/ "${WEBROOTDIR}"/fossil_*/
# Publish New Results
./publish-tests "${TESTNAME}"
# Clean
rm -f '__AUTO_TESTS_RUNNING__'
exit 0
|
|
>
>
|
<
|
|
>
>
>
>
|
>
>
|
|
>
|
>
>
|
>
>
>
>
|
|
<
<
<
>
>
|
>
>
>
>
>
|
>
|
>
>
>
>
>
>
>
>
|
>
>
>
|
>
|
>
>
|
>
>
>
>
>
<
>
>
>
>
|
>
>
|
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
|
#! /bin/bash
# Update PATH to include path to Tclkit, otherwise cross-compiles will fail
PATH="${PATH}:/home/rkeene/bin:/usr/local/bin"
export PATH
# Define build and web paths
KITCREATORFOSSIL="/web/customers/kitcreator.rkeene.org/repo/kitcreator.repo"
WEBROOTDIR="/web/rkeene/devel/kitcreator/kitbuild"
MARKERFILE="/web/customers/kitcreator.rkeene.org/repo/__AUTO_TESTS_RUNNING__"
TMPWORKDIR="${TMPDIR:-/var/tmp}/kitcreator-test-$$${RANDOM}${RANDOM}${RANDOM}"
export KITCREATORFOSSIL WEBROOTDIR MARKERFILE TMPWORKDIR
# Determine change of fossil revision on trunk
FOSSIL_CHANGE="$(fossil timeline --repository "${KITCREATORFOSSIL}" children trunk -n 1 -t ci | grep '^[0-9:]* \[' | sed 's@^[0-9:]* \[\([0-9a-f]*\)\].*$@\1@')"
TESTNAME="fossil_${FOSSIL_CHANGE}"
export FOSSIL_CHANGE TESTNAME
# Verify sanity
issane=1
if [ -z "${FOSSIL_CHANGE}" ]; then
echo "Unable to determine name of latest revision, likely missing Kitcreator Fossil Repo: ${KITCREATORFOSSIL}" >&2
issane=0
fi
if [ ! -d "${WEBROOTDIR}" ]; then
echo "Missing Web Root Directory: ${WEBROOTDIR}" >&2
issane=0
fi
if [ "${issane}" = '0' ]; then
exit 1
fi
# On Wednesday, do a distclean to force redownloading everything (mainly
# for CVS Head) and force a rebuild to ensure up-to-date build status
if [ "$(date '+%u')" != "3" ]; then
if [ -d "${WEBROOTDIR}/${TESTNAME}" ]; then
# Don't re-run the tests if nothing has changed
exit 0
fi
fi
# Only run one at a time
if [ -f "${MARKERFILE}" ]; then
exit 1
fi
touch "${MARKERFILE}"
# Change to temporary directory to build
mkdir -p "${TMPWORKDIR}"
chmod 700 "${TMPWORKDIR}"
cd "${TMPWORKDIR}" || exit 1
# Define clean-up handler
function die () {
echo "$1" >&2
cd /
rm -rf "${TMPWORKDIR}"
exit 1
}
# Download latest tarball
wget -O 'kitcreator-trunk-tip.tar.gz' -o /dev/null "http://kitcreator.rkeene.org/fossil/tarball/kitcreator-trunk-tip.tar.gz?uuid=${FOSSIL_CHANGE}"
tar -xf kitcreator-trunk-tip.tar.gz || die 'Tarball Extraction Failed'
cd kitcreator-trunk-tip || die 'Tarball Sanity Failed'
# Prepare source
./build/pre.sh >/dev/null 2>/dev/null
# Start the tests
cd build/test || die 'Missing test suite'
if [ ! -x test -o ! -x publish-tests ]; then
die 'Missing scripts, aborting.'
fi
# Clean builds
rm -rf kits
# Run tests
nice -n 20 ./test >/dev/null 2>/dev/null
# Clean old auto-generated published results
rm -rf "${WEBROOTDIR}"/svn_r*/ "${WEBROOTDIR}"/fossil_*/
# Publish New Results
./publish-tests "${TESTNAME}"
# Create nightly symlink
rm -f "${WEBROOTDIR}/nightly"
ln -s "${TESTNAME}" "${WEBROOTDIR}/nightly"
# Clean
rm -f "${MARKERFILE}"
cd /
rm -rf "${TMPWORKDIR}"
exit 0
|