Commit 1d4edfd6 by Janis Johnson Committed by Janis Johnson

patch_tester.sh (initialization): Initialize svnpatch and stop.

2008-03-10  Janis Johnson  <janis187@us.ibm.com>

	* patch_tester.sh (initialization): Initialize svnpatch and stop.
	(usage): Add -svnpath and -stop.	
	(makedir): New.
	(argument handling): Process -stop and -svnpath.
	(setup code): Use makedir, error out if initial svn checkout fails.
	(update): Use svnpath.  Invoke contrib/gcc_update.
	(apply_patch): Require that patch was created at top level.  Use eval
	with option variables.  Don't use bootstrap target for make.  Verify
	that some tests were run.
	(bootntest_patched): Use snvpath.
	(main loop): For -stop, exit when there are no more patches to test.

From-SVN: r133092
parent fde155a7
2008-03-10 Janis Johnson <janis187@us.ibm.com>
* patch_tester.sh (initialization): Initialize svnpatch and stop.
(usage): Add -svnpath and -stop.
(makedir): New.
(argument handling): Process -stop and -svnpath.
(setup code): Use makedir, error out if initial svn checkout fails.
(update): Use svnpath. Invoke contrib/gcc_update.
(apply_patch): Require that patch was created at top level. Use eval
with option variables. Don't use bootstrap target for make. Verify
that some tests were run.
(bootntest_patched): Use snvpath.
(main loop): For -stop, exit when there are no more patches to test.
2008-03-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> 2008-03-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* check_warning_flags.sh: Instead of invoke.texi, take the path * check_warning_flags.sh: Instead of invoke.texi, take the path
......
...@@ -29,6 +29,7 @@ EOF ...@@ -29,6 +29,7 @@ EOF
args=$@ args=$@
svnpath=svn://gcc.gnu.org/svn/gcc
dashj= dashj=
default_standby=1 default_standby=1
standby=$default_standby standby=$default_standby
...@@ -36,10 +37,12 @@ default_watermark=0.60 ...@@ -36,10 +37,12 @@ default_watermark=0.60
watermark=$default_watermark watermark=$default_watermark
savecompilers=false savecompilers=false
nogpg=false nogpg=false
stop=false
usage() { usage() {
cat <<EOF cat <<EOF
patch_tester.sh [-j<N>] [-standby N] [-watermark N] [-savecompilers] [-nogpg] patch_tester.sh [-j<N>] [-standby N] [-watermark N] [-savecompilers] [-nogpg]
[-svnpath URL] [-stop]
<source_dir> [patches_dir [state_dir [build_dir]]] <source_dir> [patches_dir [state_dir [build_dir]]]
J is the flag passed to make. Default is empty string. J is the flag passed to make. Default is empty string.
...@@ -55,6 +58,11 @@ patch_tester.sh [-j<N>] [-standby N] [-watermark N] [-savecompilers] [-nogpg] ...@@ -55,6 +58,11 @@ patch_tester.sh [-j<N>] [-standby N] [-watermark N] [-savecompilers] [-nogpg]
NOGPG can be used to avoid checking the GPG signature of patches. NOGPG can be used to avoid checking the GPG signature of patches.
URL is the location of the GCC SVN repository. The default is
${svnpath}.
STOP exits when PATCHES_DIR is empty.
SOURCE_DIR is the directory containing GCC's toplevel configure. SOURCE_DIR is the directory containing GCC's toplevel configure.
PATCHES_DIR is the directory containing the patches to be tested. PATCHES_DIR is the directory containing the patches to be tested.
...@@ -70,6 +78,15 @@ EOF ...@@ -70,6 +78,15 @@ EOF
exit 1 exit 1
} }
makedir () {
DIRNAME=$1
mkdir -p $DIRNAME
if [ $? -ne 0 ]; then
echo "ERROR: could not make directory $DIRNAME"
exit 1
fi
}
while [ $# -ne 0 ]; do while [ $# -ne 0 ]; do
case $1 in case $1 in
-j*) -j*)
...@@ -89,6 +106,12 @@ while [ $# -ne 0 ]; do ...@@ -89,6 +106,12 @@ while [ $# -ne 0 ]; do
-nogpg) -nogpg)
nogpg=true; shift nogpg=true; shift
;; ;;
-stop)
stop=true; shift
;;
-svnpath)
svnpath=$2; shift; shift
;;
-*) -*)
echo "Invalid option: $1" echo "Invalid option: $1"
usage usage
...@@ -122,13 +145,17 @@ else ...@@ -122,13 +145,17 @@ else
BUILD=$4 BUILD=$4
fi fi
[ -d $PATCHES ] || mkdir -p $PATCHES [ -d $PATCHES ] || makedir $PATCHES
[ -d $STATE ] || mkdir -p $STATE [ -d $STATE ] || makedir $STATE
[ -d $STATE/patched ] || mkdir -p $STATE/patched [ -d $STATE/patched ] || makedir $STATE/patched
[ -d $SOURCE ] || mkdir -p $SOURCE [ -d $SOURCE ] || makedir $SOURCE
[ -f $SOURCE/config.guess ] || { [ -f $SOURCE/config.guess ] || {
cd $SOURCE cd $SOURCE
svn -q co svn://gcc.gnu.org/svn/gcc/trunk . svn -q co $svnpath/trunk .
if [ $? -ne 0 ]; then
echo "ERROR: initial svn checkout failed"
exit 1
fi
} }
# This can contain required local settings: # This can contain required local settings:
...@@ -205,15 +232,15 @@ update () { ...@@ -205,15 +232,15 @@ update () {
cd $SOURCE cd $SOURCE
case $svn_branch in case $svn_branch in
trunk) trunk)
if ! svn switch -r $svn_revision svn://gcc.gnu.org/svn/gcc/trunk &> $TESTING/svn ; then if ! svn switch -r $svn_revision $svnpath/trunk &> $TESTING/svn ; then
report "failed to update svn sources with" report "failed to update svn sources with"
report "svn switch -r $svn_revision svn://gcc.gnu.org/svn/gcc/trunk" report "svn switch -r $svn_revision $svnpath/trunk"
freport $TESTING/svn freport $TESTING/svn
return 1 return 1
fi fi
;; ;;
svn://gcc.gnu.org/svn/gcc/*) ${svnpath}*)
if ! svn switch -r $svn_revision $svn_branch &> $TESTING/svn ; then if ! svn switch -r $svn_revision $svn_branch &> $TESTING/svn ; then
report "failed to update svn sources with" report "failed to update svn sources with"
report "svn switch -r $svn_revision $svn_branch" report "svn switch -r $svn_revision $svn_branch"
...@@ -223,14 +250,15 @@ update () { ...@@ -223,14 +250,15 @@ update () {
;; ;;
*) *)
if ! svn switch -r $svn_revision svn://gcc.gnu.org/svn/gcc/branches/$svn_branch &> $TESTING/svn ; then if ! svn switch -r $svn_revision $svnpath/branches/$svn_branch &> $TESTING/svn ; then
report "failed to update svn sources with" report "failed to update svn sources with"
report "svn switch -r $svn_revision svn://gcc.gnu.org/svn/gcc/branches/$svn_branch" report "svn switch -r $svn_revision $svnpath/branches/$svn_branch"
freport $TESTING/svn freport $TESTING/svn
return 1 return 1
fi fi
;; ;;
esac esac
contrib/gcc_update --touch
current_version=`svn info $SOURCE | grep "^Revision:" | sed -e "s/^Revision://g" -e "s/ //g"` current_version=`svn info $SOURCE | grep "^Revision:" | sed -e "s/^Revision://g" -e "s/ //g"`
if [[ $VERSION < $current_version ]]; then if [[ $VERSION < $current_version ]]; then
...@@ -251,22 +279,12 @@ apply_patch () { ...@@ -251,22 +279,12 @@ apply_patch () {
fi fi
fi fi
# Detect if the patch was created in toplev GCC. cd $SOURCE
grep "^Index: " $PATCH | grep "gcc/" if ! patch -p0 < $PATCH &> $TESTING/patching ; then
if [ $? = 0 ]; then report "your patch failed to apply:"
cd $SOURCE report "(check that the patch was created at the top level)"
if ! patch -p0 < $PATCH &> $TESTING/patching ; then freport $TESTING/patching
report "your patch failed to apply:" return 1
freport $TESTING/patching
return 1
fi
else
cd $SOURCE/gcc
if ! patch -p0 < $PATCH &> $TESTING/patching ; then
report "your patch failed to apply:"
freport $TESTING/patching
return 1
fi
fi fi
# Just assume indexes for now -- not really great, but svn always # Just assume indexes for now -- not really great, but svn always
...@@ -296,16 +314,16 @@ bootntest () { ...@@ -296,16 +314,16 @@ bootntest () {
CONFIG_OPTIONS=`grep "^configure:" $PATCH | sed -e "s/^configure://g"` CONFIG_OPTIONS=`grep "^configure:" $PATCH | sed -e "s/^configure://g"`
CONFIG_OPTIONS="$default_config $CONFIG_OPTIONS" CONFIG_OPTIONS="$default_config $CONFIG_OPTIONS"
if ! $SOURCE/configure $CONFIG_OPTIONS &> $1/configure ; then if ! eval $SOURCE/configure $CONFIG_OPTIONS &> $1/configure ; then
report "configure failed with:" report "configure with `basename $1` version failed with:"
freport $1/configure freport $1/configure
return 1 return 1
fi fi
MAKE_ARGS=`grep "^make:" $PATCH | sed -e "s/^make://g"` MAKE_ARGS=`grep "^make:" $PATCH | sed -e "s/^make://g"`
MAKE_ARGS="$default_make $MAKE_ARGS" MAKE_ARGS="$default_make $MAKE_ARGS"
if ! make $dashj $MAKE_ARGS bootstrap &> $1/bootstrap ; then if ! eval make $dashj $MAKE_ARGS &> $1/bootstrap ; then
report "bootstrap failed with last lines:" report "bootstrap with `basename $1` version failed with last lines:"
tail -30 $1/bootstrap > $1/last_bootstrap tail -30 $1/bootstrap > $1/last_bootstrap
freport $1/last_bootstrap freport $1/last_bootstrap
report "grep --context=20 Error bootstrap:" report "grep --context=20 Error bootstrap:"
...@@ -316,7 +334,13 @@ bootntest () { ...@@ -316,7 +334,13 @@ bootntest () {
CHECK_OPTIONS=`grep "^check:" $PATCH | sed -e "s/^check://g"` CHECK_OPTIONS=`grep "^check:" $PATCH | sed -e "s/^check://g"`
CHECK_OPTIONS="$default_check $CHECK_OPTIONS" CHECK_OPTIONS="$default_check $CHECK_OPTIONS"
make $dashj $CHECK_OPTIONS -k check &> $1/check eval make $dashj $CHECK_OPTIONS -k check &> $1/check
SUITESRUN="`grep 'Summary ===' $1/check | cut -d' ' -f 2 | sort`"
if [ x$SUITESRUN = x ]; then
report "check with `basename $1` version failed, no testsuites were run"
return 1
fi
for LOG in $TESTLOGS ; do for LOG in $TESTLOGS ; do
if [ -f $BUILD/$LOG ]; then if [ -f $BUILD/$LOG ]; then
...@@ -338,7 +362,7 @@ bootntest_patched () { ...@@ -338,7 +362,7 @@ bootntest_patched () {
# Build the pristine tree with exactly the same options as the patch under test. # Build the pristine tree with exactly the same options as the patch under test.
bootntest_pristine () { bootntest_pristine () {
cleanup cleanup
current_branch=`svn info $SOURCE | grep "^URL:" | sed -e "s/URL: //g" -e "s/svn:\/\/gcc.gnu.org\/svn\/gcc\///g"` current_branch=`svn info $SOURCE | grep "^URL:" | sed -e "s/URL: //g" -e "s,${svnpath},,g"`
current_version=`svn info $SOURCE | grep "^Revision:" | sed -e "s/^Revision://g" -e "s/ //g"` current_version=`svn info $SOURCE | grep "^Revision:" | sed -e "s/^Revision://g" -e "s/ //g"`
PRISTINE=$STATE/$current_branch/$current_version PRISTINE=$STATE/$current_branch/$current_version
...@@ -448,11 +472,22 @@ if [ -d $TESTING ]; then ...@@ -448,11 +472,22 @@ if [ -d $TESTING ]; then
fi fi
fi fi
firstpatch=true
while true; do while true; do
PATCH=`ls -rt -1 $PATCHES | head -1` PATCH=`ls -rt -1 $PATCHES | head -1`
if [ x$PATCH = x ]; then if [ x$PATCH = x ]; then
if [ $stop = true ]; then
if [ $firstpatch = true ]; then
echo "No patches ready to test, quitting."
exit 1
else
echo "No more patches to test."
exit 0
fi
fi
sleep ${standby}m sleep ${standby}m
else else
firstpatch=false
sysload=`uptime | cut -d, -f 5` sysload=`uptime | cut -d, -f 5`
if [[ $sysload > $watermark ]]; then if [[ $sysload > $watermark ]]; then
# Wait a bit when system load is too high. # Wait a bit when system load is too high.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment