Diff

Differences From Artifact [5c58eff196]:

To Artifact [d2dcdb02e1]:


     1      1   #! /bin/bash
     2      2   
     3      3   # Update PATH to include path to Tclkit, otherwise cross-compiles will fail
     4      4   PATH="${PATH}:/home/rkeene/bin:/usr/local/bin"
     5      5   export PATH
     6      6   
     7      7   # Define build and web paths
     8         -KITCREATORDIR="/home/rkeene/devel/kitcreator"
            8  +KITCREATORFOSSIL="/web/customers/kitcreator.rkeene.org/repo/kitcreator.repo"
     9      9   WEBROOTDIR="/web/rkeene/devel/kitcreator/kitbuild"
    10         -export KITCREATORDIR WEBROOTDIR
           10  +MARKERFILE="/web/customers/kitcreator.rkeene.org/repo/__AUTO_TESTS_RUNNING__"
           11  +TMPWORKDIR="${TMPDIR:-/var/tmp}/kitcreator-test-$$${RANDOM}${RANDOM}${RANDOM}"
           12  +export KITCREATORFOSSIL WEBROOTDIR MARKERFILE TMPWORKDIR
    11     13   
    12         -cd "${KITCREATORDIR}" || exit 1
    13         -
    14         -FOSSIL_CHANGE="$(fossil timeline -n 1 -t ci | grep '^[0-9:]* \[' | sed 's@^[0-9:]* \[\([0-9a-f]*\)\].*$@\1@')"
           14  +# Determine change of fossil revision on trunk
           15  +FOSSIL_CHANGE="$(fossil timeline --repository "${KITCREATORFOSSIL}" children trunk -n 1 -t ci | grep '^[0-9:]* \[' | sed 's@^[0-9:]* \[\([0-9a-f]*\)\].*$@\1@')"
    15     16   TESTNAME="fossil_${FOSSIL_CHANGE}"
    16     17   export FOSSIL_CHANGE TESTNAME
    17     18   
    18         -# On Wednesday, do a distclean to force redownloading everything (mainly
    19         -# for CVS Head) and force a rebuild to ensure up-to-date build status
    20         -if [ "$(date '+%u')" = "3" ]; then
    21         -	./kitcreator distclean || exit 1
           19  +# Verify sanity
           20  +issane=1
           21  +if [ -z "${FOSSIL_CHANGE}" ]; then
           22  +	echo "Unable to determine name of latest revision, likely missing Kitcreator Fossil Repo: ${KITCREATORFOSSIL}" >&2
    22     23   
    23         -	touch "${KITCREATORDIR}/build/test/force_nightly"
           24  +	issane=0
           25  +fi
           26  +
           27  +if [ ! -d "${WEBROOTDIR}" ]; then
           28  +	echo "Missing Web Root Directory: ${WEBROOTDIR}" >&2
           29  +
           30  +	issane=0
           31  +fi
           32  +
           33  +if [ "${issane}" = '0' ]; then
           34  +	exit 1
    24     35   fi
    25     36   
    26         -if [ -d "${WEBROOTDIR}/${TESTNAME}" ]; then
    27         -	# Don't re-run the tests if nothing has changed
    28         -	if [ -f "${KITCREATORDIR}/build/test/force_nightly" ]; then
    29         -		rm -f "${KITCREATORDIR}/build/test/force_nightly"
    30         -	else
           37  +# On Wednesday, do a distclean to force redownloading everything (mainly
           38  +# for CVS Head) and force a rebuild to ensure up-to-date build status
           39  +if [ "$(date '+%u')" != "3" ]; then
           40  +	if [ -d "${WEBROOTDIR}/${TESTNAME}" ]; then
           41  +		# Don't re-run the tests if nothing has changed
    31     42   		exit 0
    32     43   	fi
    33     44   fi
    34     45   
    35         -cd build/test || exit 1
    36         -
    37         -if [ ! -x test -o ! -x publish-tests ]; then
    38         -	echo 'Missing scripts, aborting.' >&2
    39         -
           46  +# Only run one at a time
           47  +if [ -f "${MARKERFILE}" ]; then
    40     48   	exit 1
    41     49   fi
           50  +touch "${MARKERFILE}"
    42     51   
    43         -# Only run one at a time
    44         -if [ -f '__AUTO_TESTS_RUNNING__' ]; then
           52  +# Change to temporary directory to build
           53  +mkdir -p "${TMPWORKDIR}"
           54  +chmod 700 "${TMPWORKDIR}"
           55  +
           56  +cd "${TMPWORKDIR}" || exit 1
           57  +
           58  +# Define clean-up handler
           59  +function die () {
           60  +	echo "$1" >&2
           61  +
           62  +	cd /
           63  +
           64  +	rm -rf "${TMPWORKDIR}"
           65  +
    45     66   	exit 1
           67  +}
           68  +
           69  +# Download latest tarball
           70  +wget -O 'kitcreator-trunk-tip.tar.gz' -o /dev/null "http://kitcreator.rkeene.org/fossil/tarball/kitcreator-trunk-tip.tar.gz?uuid=${FOSSIL_CHANGE}"
           71  +
           72  +tar -xf kitcreator-trunk-tip.tar.gz || die 'Tarball Extraction Failed'
           73  +
           74  +cd kitcreator-trunk-tip || die 'Tarball Sanity Failed'
           75  +
           76  +# Prepare source
           77  +./build/pre.sh >/dev/null 2>/dev/null
           78  +
           79  +# Start the tests
           80  +cd build/test || die 'Missing test suite'
           81  +
           82  +if [ ! -x test -o ! -x publish-tests ]; then
           83  +	die 'Missing scripts, aborting.'
    46     84   fi
    47         -touch '__AUTO_TESTS_RUNNING__'
    48     85   
    49     86   # Clean builds
    50     87   rm -rf kits
    51     88   
    52     89   # Run tests
    53     90   nice -n 20 ./test >/dev/null 2>/dev/null
    54     91   
    55     92   # Clean old auto-generated published results
    56     93   rm -rf "${WEBROOTDIR}"/svn_r*/ "${WEBROOTDIR}"/fossil_*/
    57     94   
    58     95   # Publish New Results
    59     96   ./publish-tests "${TESTNAME}"
    60     97   
           98  +# Create nightly symlink
           99  +rm -f "${WEBROOTDIR}/nightly"
          100  +ln -s "${TESTNAME}" "${WEBROOTDIR}/nightly"
          101  +
    61    102   # Clean
    62         -rm -f '__AUTO_TESTS_RUNNING__'
          103  +rm -f "${MARKERFILE}"
          104  +cd /
          105  +rm -rf "${TMPWORKDIR}"
    63    106   
    64    107   exit 0