| #!/bin/bash |
| # |
| # For each stable commit since $BASE, check it out, determine which |
| # C and ASM files it changed, and build the object file(s) on a |
| # bunch of different architectures. |
| # |
| # If the compile fails, then checkout $BASE and see if it also fails |
| # there, since some things will naturally fail (e.g. drivers/acpi |
| # for non-x86, etc.) Only report new failures. |
| # |
| # If the source file is in arch/blah and we aren't testing for |
| # ARCH=blah, then skip that file. |
| # Paul G. |
| |
| if [ ! -f Makefile ]; then |
| echo No Makefile found, are you in a bare clone? |
| exit 1 |
| fi |
| |
| VERSION=`grep '^VERSION =' Makefile |awk '{print $3}'` |
| PATCHLEVEL=`grep '^PATCHLEVEL =' Makefile |awk '{print $3}'` |
| SUBLEVEL=`grep '^SUBLEVEL =' Makefile |awk '{print $3}'` |
| EXTRAVERSION=`grep '^EXTRAVERSION =' Makefile |awk '{print $3}'|sed 's/\.//'` |
| |
| if [ -z "$EXTRAVERSION" ]; then |
| BASE=v$VERSION.$PATCHLEVEL.$SUBLEVEL |
| else |
| BASE=v$VERSION.$PATCHLEVEL.$SUBLEVEL.$EXTRAVERSION |
| fi |
| |
| STOP=HEAD |
| |
| BRANCH=`git branch |grep \* |awk '{print $2}'` |
| |
| if [ -n "$1" ]; then |
| git rev-parse $1 > /dev/null 2>&1 |
| if [ $? != 0 ]; then |
| echo $1 is not a valid commit to start building from |
| exit 1 |
| fi |
| BASE=$1 |
| |
| if [ -n "$2" ]; then |
| git rev-parse $2 > /dev/null 2>&1 |
| if [ $? != 0 ]; then |
| echo $2 is not a valid commit to stop building at |
| exit 1 |
| fi |
| STOP=$2 |
| fi |
| fi |
| |
| BDIR=../buildtest-$SUBLEVEL.$[$EXTRAVERSION+1] |
| |
| # TODO: switch to kernel.org toolchains for extra arch coverage |
| # see http://kernel.org/pub/tools/crosstool/files/bin/ |
| TC_PATH=/opt/windriver/toolchain |
| TC_SUFFIX=wrs-linux-gnu |
| TC_SUB=toolchain/x86-linux2/bin/ |
| |
| for dir in arm i586 mips powerpc ; do |
| if [ ! -d $TC_PATH/$dir/$TC_SUB ]; then |
| echo toolchain path $TC_PATH/$dir/$TC_SUB is not a dir |
| exit 1 |
| fi |
| PATH=$TC_PATH/$dir/$TC_SUB:$PATH |
| done |
| |
| rm -rf $BDIR |
| mkdir -p $BDIR |
| |
| echo Arch marked with \(x\) indicate compile failures already present in $BASE |
| echo Arch marked with \(s\) indicate skipping testing not applicable to that arch. |
| |
| echo -n 'Total number of commits to test: ' |
| git rev-list --no-merges $STOP ^$BASE |wc -l |
| |
| COUNT=0 |
| |
| for c in `git rev-list --no-merges $STOP ^$BASE` ; do |
| |
| COUNT=$[$COUNT+1] |
| echo -n "Testing ($COUNT): " |
| git show --pretty=email $c |grep ^Subject:|sed 's/.*PATCH\]//' |
| |
| OBJFILES=`git show $c|grep ^+++ |grep '\.[cs]$'|sed 's/^+++ b\///'|sed 's/[cs]$/o/'|tr '\n' ' '` |
| if [ -z "$OBJFILES" ]; then |
| echo -e \\twarning - nothing to compile test for $c |
| continue |
| fi |
| |
| echo -n "Compiling $OBJFILES on:" |
| for ARCH in x86 x86_64 arm mips powerpc; do |
| |
| echo -n " "$ARCH |
| |
| if [ "$ARCH" == "powerpc" ];then |
| CROSS_COMPILE=powerpc-$TC_SUFFIX- |
| ARCHDIR=powerpc |
| elif [ "$ARCH" == "i386" ];then |
| CROSS_COMPILE=i586-$TC_SUFFIX- |
| ARCHDIR=x86 |
| elif [ "$ARCH" == "x86" ];then |
| CROSS_COMPILE=i586-$TC_SUFFIX- |
| ARCHDIR=x86 |
| elif [ "$ARCH" == "x86_64" ];then |
| CROSS_COMPILE=i586-$TC_SUFFIX- |
| ARCHDIR=x86 |
| elif [ "$ARCH" == "mips" ];then |
| CROSS_COMPILE=mips-$TC_SUFFIX- |
| ARCHDIR=mips |
| elif [ "$ARCH" == "arm" ];then |
| CROSS_COMPILE=arm-$TC_SUFFIX\eabi- |
| ARCHDIR=arm |
| elif [ "$ARCH" == "sparc" ];then |
| CROSS_COMPILE=sparc-$TC_SUFFIX- |
| ARCHDIR=sparc |
| elif [ "$ARCH" == "sparc64" ];then |
| CROSS_COMPILE=sparc-$TC_SUFFIX- |
| ARCHDIR=sparc |
| else |
| echo Unknown architecture: $ARCH -- Giving up. |
| exit 1 |
| fi |
| |
| $CROSS_COMPILE\gcc -v > /dev/null 2>&1 |
| if [ $? != 0 ]; then |
| echo $CROSS_COMPILE\gcc does not appear functional, please check. |
| exit 1 |
| fi |
| |
| B=$BDIR/$c/$ARCH |
| mkdir -p $B |
| FAILED=0 |
| SKIPPED=0 |
| |
| export ARCH |
| export CROSS_COMPILE |
| |
| # If we tested on $BASE, this will bring us back where we need to be. |
| git checkout -f $c > /dev/null 2>&1 |
| if [ $? != 0 ]; then |
| echo something evil happened, checkout of $c failed. |
| exit 1 |
| fi |
| |
| for f in $OBJFILES ; do |
| |
| echo $f | grep -q arch/ |
| if [ $? = 0 ]; then |
| echo $f | grep -q $ARCHDIR |
| if [ $? != 0 ]; then |
| SKIPPED=1 |
| continue |
| fi |
| |
| fi |
| |
| make O=$B allyesconfig > $B/yes_config.log 2>&1 |
| if [ $? != 0 ]; then |
| echo -e \\n\\tyesconfig failed for $ARCH on $c |
| FAILED=1 |
| continue |
| fi |
| make O=$B $f > $B/yes_build.log 2>&1 |
| if [ $? != 0 ]; then |
| # Checkout baseline and test there to see if we broke it. |
| git checkout -f $BASE > /dev/null 2>&1 |
| if [ $? != 0 ]; then |
| echo something evil happened, checkout of $BASE failed. |
| exit 1 |
| fi |
| make O=$B allyesconfig > $B/yes_config-$BASE.log 2>&1 |
| if [ $? != 0 ]; then |
| echo -e \\n\\tyesconfig failed for $ARCH on $BASE |
| continue |
| fi |
| make O=$B $f > $B/yes_build-$BASE.log 2>&1 |
| if [ $? = 0 ]; then |
| # Crap, looks like a real regression! |
| echo -e \\n\\tyescfg compile $f failed for $ARCH on $c |
| FAILED=1 |
| else |
| echo -n \(x\) |
| fi |
| continue |
| fi |
| |
| make O=$B allmodconfig > $B/mod_config.log 2>&1 |
| if [ $? != 0 ]; then |
| echo -e \\n\\tmodconfig failed for $ARCH on $c |
| FAILED=1 |
| continue |
| fi |
| make O=$B $f > $B/mod_build.log 2>&1 |
| if [ $? != 0 ]; then |
| # Checkout baseline and test there to see if we broke it. |
| git checkout -f $BASE > /dev/null 2>&1 |
| if [ $? != 0 ]; then |
| echo something evil happened, checkout of $BASE failed. |
| exit 1 |
| fi |
| make O=$B allmodconfig > $B/mod_config-$BASE.log 2>&1 |
| if [ $? != 0 ]; then |
| echo -e \\n\\tmodconfig failed for $ARCH on $BASE |
| continue |
| fi |
| make O=$B $f > $B/mod_build-$BASE.log 2>&1 |
| if [ $? = 0 ]; then |
| # Crap, looks like a real regression! |
| echo -e \\n\\tmodconfig compile $f failed for $ARCH on $c |
| FAILED=1 |
| else |
| echo -n \(x\) |
| fi |
| continue |
| fi |
| done # obj loop |
| |
| if [ $SKIPPED != 0 ]; then |
| echo -n \(s\) |
| fi |
| if [ $FAILED = 0 ]; then |
| rm -rf $B |
| fi |
| |
| done # arch loop |
| rmdir $BDIR/$c 2>/dev/null |
| echo |
| done # commit loop |
| |
| git checkout $BRANCH |