Browse files

ts: more fixups

  • Loading branch information...
1 parent 7d88361 commit d323c9efbb1a9c2dfb48d01f36bb03448e33cb39 @gregkh committed Sep 25, 2012
Showing with 91 additions and 106 deletions.
  1. +91 −106 test/ts
View
197 test/ts
@@ -1,24 +1,63 @@
-#!/bin/sh
+#!/bin/bash
+#
+# Testing script to take a stable kernel patch set, build it on a remote
+# machine using ktest, and email back the results.
+#
+# Copyright 2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+#
+# Released under the GPLv2 only.
+#
+#
+# Some variables you might want to mess with are:
+#
+# EMAIL: who to send the email to
+# REMOTE_STABLE_GIT: on the remote machine, where the linux-stable git tree is located
+# REMOTE_WORK: on the remote machine, what temporary location we can use to create a subdirectory and do our work in
+# REMOTE_SERVER: the remote machine name
+# REMOTE_USER: the username to run the script on the remote machine
+# LOCAL_WORK: temporay location on the local machine to create some files before we copy them to the remote machine
+# LOCAL_KTEST: local location of a version of ktest.pl that you want to run remotely (usually better than the version in the stable tree under testing due to age issues.)
+# QUEUE_DIR: local location of the stable-queue git tree we are wanting to test
-REMOTE_STABLE_GIT="/home/gregkh/linux/stable/linux-stable/"
-REMOTE_WORK="/home/gregkh/tmp/"
-REMOTE_SERVER="build"
-REMOTE_USER="gregkh"
-#ssh root@MachineB 'bash -s' < local_script.sh
+EMAIL="greg@kroah.com"
-LOCAL_WORK="/tmp/"
+#REMOTE_STABLE_GIT="/home/gregkh/linux/stable/linux-stable/"
+#REMOTE_WORK="/home/gregkh/tmp/"
+#REMOTE_SERVER="build"
+#REMOTE_USER="gregkh"
-KERNEL_VERSION="3.0"
-OUTPUT_DIR="/tmp"
-LINUX_STABLE="/home/gregkh/linux/stable/linux-stable/"
+REMOTE_STABLE_GIT="/home/ec2-user/linux/stable/linux-stable/"
+REMOTE_WORK="/home/ec2-user/tmp/"
+REMOTE_SERVER="ec2-50-112-17-159.us-west-2.compute.amazonaws.com"
+REMOTE_USER="ec2-user"
+
+LOCAL_WORK="/tmp/"
+LOCAL_KTEST="/home/gregkh/linux/gregkh/tools/testing/ktest/ktest.pl"
QUEUE_DIR="/home/gregkh/linux/stable/stable-queue/"
+#######################################################
+# I doubt you need to touch anything below this line,
+# unless you want to fix my bugs, or rewrite the scripts
+# to be saner (hint, feel free to do so...)
+#######################################################
+
+
+# grab the kernel version from the command line
+KERNEL_VERSION="$1"
+
+if [ "${KERNEL_VERSION}" == "" ] ; then
+ echo "$0 KERNEL_VERSION"
+ exit;
+fi
+
+# create the local temporary directory to do the work in.
SCRIPT_HOME=`mktemp -d ${LOCAL_WORK}/stable_test_XXXXX`
-echo "using ${SCRIPT_HOME} for our local files"
-REMOTE_HOME=`basename ${SCRIPT_HOME}`
-REMOTE_DIR=${REMOTE_WORK}/${REMOTE_HOME}
-echo "using ${REMOTE_DIR} for the remote directory"
+echo "Using ${SCRIPT_HOME} for our local files"
+
+# create the remote directory
+REMOTE_DIR=`ssh ${REMOTE_USER}@${REMOTE_SERVER} mktemp -d ${REMOTE_WORK}/stable_test_XXXXX`
+echo "Using ${REMOTE_DIR} for the remote directory"
# tar up stable patch queue for just this kernel version
@@ -28,20 +67,15 @@ tar -c . | gzip > ${SCRIPT_HOME}/stable_queue.tar.gz
# create the script to run remotely
cat << __EOF__ > ${SCRIPT_HOME}/run_test.sh
-#~/bin/sh
+#!/bin/bash
# Test script for the ${KERNEL_VERSION}-stable kernel
+# autogenerated, do not edit by hand
+#
STABLE_GIT="${REMOTE_STABLE_GIT}"
-HOME="${REMOTE_WORK}/${REMOTE_HOME}"
KERNEL_VERSION="${KERNEL_VERSION}"
PATCHES="stable_queue.tar.gz"
-# create the directory we are going to work out of
-mkdir \${HOME}
-cd \${HOME}
-
-# get the quilt patches in here somehow...
-# FIXME
-
+cd ${REMOTE_DIR}
# create the linux clone
git clone -s ${REMOTE_STABLE_GIT} linux
@@ -50,10 +84,13 @@ cd linux
# checkout the branch we need
git checkout -t -b linux-${KERNEL_VERSION}.y origin/linux-${KERNEL_VERSION}.y
+# remove the .git directory as we don't need that space hanging around anymore
+#rm -rf .git/
+
# create a patches/ directory for the stable patches to apply
mkdir patches
cd patches
-tar -zxvf ${HOME}/\${PATCHES}
+tar -zxvf ${REMOTE_DIR}/\${PATCHES}
cd ..
# Apply the patch queue
@@ -62,7 +99,23 @@ QUILT_PATCHES=patches QUILT_SERIES=patches/series quilt push -aq --quiltrc
# build stuff
perl ../ktest.pl ../ktest.conf
-#
+KTEST_RUN=$?
+echo "KTEST_RUN = \${KTEST_RUN}"
+
+cd ..
+
+if [ "\${KTEST_RUN}" = "0" ]; then
+ # test succeeded
+ SUBJECT="Build of ${KERNEL_VERSION} was good"
+else
+ SUBJECT="Build of ${KERNEL_VERSION} FAILED!"
+fi
+
+mutt -s "\${SUBJECT}" -a linux/log -- ${EMAIL} < output_log
+
+# now that we are done, clean up after ourselves
+rm -rf ${REMOTE_DIR}
+
__EOF__
chmod 755 ${SCRIPT_HOME}/run_test.sh
@@ -82,93 +135,25 @@ MACHINE = aws
BUILD_DIR = \${PWD}
__EOF__
-cp /home/gregkh/linux/gregkh/tools/testing/ktest/ktest.pl ${SCRIPT_HOME}
-
-# create the remote directory
-ssh ${REMOTE_USER}@${REMOTE_SERVER} mkdir ${REMOTE_DIR}
-scp ${SCRIPT_HOME}/* ${REMOTE_USER}@${REMOTE_SERVER}:${REMOTE_DIR}
-ssh ${REMOTE_USER}@${REMOTE_SERVER} "cd ${REMOTE_DIR} && ./run_test.sh"
-
-
-exit
-
-
-
-TESTDIR=`pwd`
-PATCHDIR="$TESTDIR/staging"
-BUILDDIR="$TESTDIR/linux-staging"
-LOG="$TESTDIR/log-stage"
-GIT_LOCAL="greg@aria:git/staging.git"
-GIT_REMOTE="git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git"
-HOSTNAME=`hostname`
+# copy a version of ktest that we want to run
+cp ${LOCAL_KTEST} ${SCRIPT_HOME}
-ONE_SHOT=$1
+# copy the files we created to the remote machine
+scp -q ${SCRIPT_HOME}/* ${REMOTE_USER}@${REMOTE_SERVER}:${REMOTE_DIR}
-echo "PATCHDIR=$PATCHDIR"
-echo "BUILDDIR=$BUILDDIR"
+# remove the local files as we don't need them anymore
+rm -rf ${SCRIPT_HOME}
-echo "cleaning up from any previous runs"
-rm -rf $BUILDDIR
-rm $LOG $LOG.run1 $LOG.run2
+# execute the script on the remote machine
-# If we are a machine on the local network, don't download the kernel.org
-# version of the patch repo
-if [ $HOSTNAME = "kvm" ]; then
- PATCH_REPO=$GIT_LOCAL
-elif [ $HOSTNAME = "mini" ]; then
- PATCH_REPO=$GIT_LOCAL
-else
- PATCH_REPO=$GIT_REMOTE
-fi
-
-if [ -d $PATCHDIR ]; then
- # just pull, don't clone a whole new tree
- cd $PATCHDIR
- git pull
- cd ..
-else
- # check out latest version of patches
- git clone $PATCH_REPO $PATCHDIR
-fi
-
-VERSION=`cat $PATCHDIR/version`
+#ssh ${REMOTE_USER}@${REMOTE_SERVER} "cd ${REMOTE_DIR} && nohup \"cd ${REMOTE_DIR} && ./run_test.sh & > ${REMOTE_DIR} output_log \" "
+#ssh ${REMOTE_USER}@${REMOTE_SERVER} "cd ${REMOTE_DIR} && nohup \"${REMOTE_DIR}/run_test.sh & > ${REMOTE_DIR}/output_log\""
+#ssh ${REMOTE_USER}@${REMOTE_SERVER} "nohup ${REMOTE_DIR}/run_test.sh > ${REMOTE_DIR}/output_log &"
+#ssh ${REMOTE_USER}@${REMOTE_SERVER} "${REMOTE_DIR}/run_test.sh > ${REMOTE_DIR}/output_log"
+ssh -n -f ${REMOTE_USER}@${REMOTE_SERVER} "sh -c \"cd ${REMOTE_DIR}; nohup ./run_test.sh > ${REMOTE_DIR}/output_log 2>&1 &\" "
-echo "working with kernel version $VERSION"
-# get latest version of kernel based on patch level
-mkdir $BUILDDIR
-cd $BUILDDIR
-ketchup $VERSION
-
-FAILED=0
-J=$(expr $(grep processor /proc/cpuinfo | wc -l) \* 4)
-
-if [ "X$ONE_SHOTX" == "XX" ] ; then
- # do a build first to set a baseline
- make allmodconfig
- nice -20 make -j$J 2> $LOG.run1 || FAILED=1
- if [ "$FAILED" != "0" ]; then
- echo "initial build FAILED!"
- echo "see $LOG.run1 for what happened"
- exit $FAILED
- fi
-
- # now clean up and do a second build with our patches
- make distclean
-fi
+exit
-# apply all patches
-QUILT_PATCHES=$PATCHDIR QUILT_SERIES=$PATCHDIR/series quilt push -aq --quiltrc
-
-# build for allmodconfig
-make allmodconfig
-#make -j4 &> $LOG
-nice -20 make -j$J 2> $LOG.run2 || FAILED=1
-if [ "$FAILED" != "0" ]; then
- echo "initial build FAILED!"
- echo "see $LOG.run2 for what happened"
- exit $FAILED
-fi
-diff -u $LOG.run1 $LOG.run2

0 comments on commit d323c9e

Please sign in to comment.