From 2f190c9dc761d24c4279983c02ee2ca17f1363b5 Mon Sep 17 00:00:00 2001 From: Steve McIntyre Date: Thu, 19 May 2016 23:13:21 +0100 Subject: [PATCH] initial version --- strace-build-test | 115 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100755 strace-build-test diff --git a/strace-build-test b/strace-build-test new file mode 100755 index 0000000..295d382 --- /dev/null +++ b/strace-build-test @@ -0,0 +1,115 @@ +#!/bin/bash + +POINT=HEAD +ARCH=$(dpkg-architecture -q DEB_BUILD_ARCH) +HOSTNAME=$(hostname) + +while getopts ":p:a:" opt; do + case $opt in + p) + POINT=$OPTARG + ;; + a) + ARCH=$OPTARG + set +e + chk=`dpkg-architecture -a$ARCH > /dev/null 2>&1 ; echo $?` + set -e + if [ $chk != 0 ]; then + echo "Did not recognise ${ARCH} as a Debian architecture name. Exit." + exit 1 + fi + ARCH=${ARCH} + ;; + \?) + echo "Invalid option: -$OPTARG" >&2 + ;; + esac +done + +PATH=/usr/local/sbin:/usr/local/bin:$PATH +export PATH + +NUMCPUS=$(grep processor /proc/cpuinfo | wc -l) +if [ $NUMCPUS -gt 1 ]; then + PARALLEL="-j $NUMCPUS" +else + PARALLEL="" +fi + +set -e +set -x + +mysid=sid-93sam-strace + +BASE_CHROOT="sid_$ARCH-dchroot" + +schroot -e -c $mysid || true +schroot -b -c $BASE_CHROOT -n $mysid +dd-schroot-cmd -y -c $mysid apt-get update +dd-schroot-cmd -y -c $mysid apt-get build-dep strace +dd-schroot-cmd -y -c $mysid apt-get install git autotools-dev gawk dh-autoreconf + +DATETIME=$(date -u '+%Y-%m-%d-%H%M%S') +BDIR=~/build/strace/build-test-${DATETIME} + +mkdir -p ${BDIR} +cd ${BDIR} + +cat > ~/build/strace/inside-schroot-test.sh << EOF +#!/bin/sh +cd ${BDIR} +git clone -q http://git.code.sf.net/p/strace/code strace.git +echo "BUILD ENVIRONMENT INFORMATION" +echo "=============================" +echo "Debian architecture" +echo "-------------------" +dpkg-architecture -q DEB_BUILD_ARCH +echo "Hostname" +echo "--------" +hostname +echo "uname -rm" +echo "---------" +uname -rm +echo "Version of kernel headers (linux-libc-dev)" +echo "------------------------------------------" +dpkg -s linux-libc-dev +echo "Version of libc" +echo "---------------" +dpkg -s libc6-dev +echo "Version of gcc" +echo "--------------" +dpkg -s gcc +cd strace.git +git checkout $POINT +./bootstrap +./configure +make $PARALLEL && make check VERBOSE=1 && echo SUCCESS > ${BDIR}/RESULT +EOF + +chmod +x ~/build/strace/inside-schroot-test.sh + +cd ~ + +# Run the command, outout to typescript +script -c "schroot -r -c $mysid ~/build/strace/inside-schroot-test.sh" + +if [ -f ${BDIR}/RESULT ] ; then + schroot -e -c $mysid + rm -rf ${BDIR} + rm -f ~/build/strace/inside-schroot-test.sh +else + echo "BUILD FAILED - not doing cleanup" + echo "Results in ${BDIR}" +fi +mv typescript typescript-$ARCH-$HOSTNAME-${DATETIME}.txt + +gzip -9 typescript-$ARCH-$HOSTNAME-${DATETIME}.txt +FILE="typescript-$ARCH-$HOSTNAME-${DATETIME}.txt.gz" + +(echo "START $FILE" ; \ + base64 < $FILE ; \ + echo "END $FILE") | \ + mailx -s "strace-build-test $ARCH-$HOSTNAME-${DATETIME} log" \ + steve-strace@einval.com + +rm -f $FILE -- 2.20.1