head	1.17;
access;
symbols
	charm6_1:1.17
	charm_6_0_1:1.17
	charm6_0_1:1.17
	charm6_0:1.15
	ChaNGa_1-0:1.15
	charm5_9:1.14;
locks; strict;
comment	@# @;


1.17
date	2009.02.06.21.44.17;	author gzheng;	state Exp;
branches;
next	1.16;
commitid	23OuWq2loISPaqBt;

1.16
date	2008.05.16.15.38.54;	author gzheng;	state Exp;
branches;
next	1.15;
commitid	24viPgyKCB1BHc3t;

1.15
date	2006.02.06.08.38.52;	author gzheng;	state Exp;
branches;
next	1.14;

1.14
date	2005.04.30.03.15.00;	author gzheng;	state Exp;
branches;
next	1.13;

1.13
date	2005.02.17.04.34.24;	author gzheng;	state Exp;
branches;
next	1.12;

1.12
date	2005.01.23.04.10.13;	author gzheng;	state Exp;
branches;
next	1.11;

1.11
date	2005.01.09.16.33.32;	author gzheng;	state Exp;
branches;
next	1.10;

1.10
date	2005.01.08.21.38.10;	author gzheng;	state Exp;
branches;
next	1.9;

1.9
date	2005.01.04.20.14.10;	author gzheng;	state Exp;
branches;
next	1.8;

1.8
date	2004.10.26.16.03.51;	author olawlor;	state Exp;
branches;
next	1.7;

1.7
date	2004.09.04.21.02.53;	author olawlor;	state Exp;
branches;
next	1.6;

1.6
date	2004.04.02.17.14.16;	author olawlor;	state Exp;
branches;
next	1.5;

1.5
date	2004.01.09.17.54.59;	author olawlor;	state Exp;
branches;
next	1.4;

1.4
date	2003.10.28.23.56.54;	author olawlor;	state Exp;
branches;
next	1.3;

1.3
date	2003.03.27.18.36.28;	author olawlor;	state Exp;
branches;
next	1.2;

1.2
date	2003.03.07.18.56.16;	author olawlor;	state Exp;
branches;
next	1.1;

1.1
date	2003.02.21.19.03.16;	author olawlor;	state Exp;
branches;
next	;


desc
@@


1.17
log
@updated
@
text
@#!/bin/sh
#
# Given a version of charm++, look up and build that version
# on a remote machine listed in system_list.
# This script handles sending out files, ssh, etc.
# Orion Sky Lawlor, olawlor@@acm.org, 2002/2/3
#

. ./config

########################## SETUP #########################
if [ $# -lt 1 ]
then
	echo "Usage: ./build_on_system <charm++ version>"
	exit 1
fi

# Charm++ version without spaces like "net-sol-cc-local"
version="$1"
# Charm++ version with spaces like "net-sol cc local"
versSpace=`echo $1 | awk -F- '{
	for (i=1;i<=NF;i++) {
		printf("%s",$i);
		if (i==NF)
			{}
		else if (i<2 || $(i+1) == "ia64" || $(i+1) == "darwin" || $(i+1) == "amd64" || $(i+1) == "ppc" || $(i+1) == "x86_64" || $(i+1) == "x86")
			printf("-");
		else
			printf(" ");
	}
	printf("\n");
}'`

echo "Will build $version as $versSpace"

# Set up status:
status="status/$version"
messages="messages/$version"
scripts="scripts/$version"
echo "Building..." > $status
echo "Started build on" `date` > $messages
rm -fr $scripts
mkdir -p $scripts

# Print out this informative message:
Message() {
#	echo "$version: " $@@
	echo $@@ >> $messages
}

# Set the status to this
Status() {
	echo "$version status:" "$@@"
	echo "$@@" > $status
	Message $@@
}

# Exit giving this reason for failure.
Die() {
	Message "fatal> " "$@@" 
	if test -n "$errorString"
	then
		Status "$errorString"
	else
		Status "Bad:" "$@@"
	fi
	./update_web
	exit 1
}

# Run this command without doing redirection
DoNoRedir() {
	Message "local> " "$@@"
	"$@@"
	err="$?"
	if [ $err -ne 0 ]
	then
		Die "error code $err during local> " "$@@"
	fi
}

# Run this command or die
Do() {
	DoNoRedir "$@@" >> $messages 2>&1
}

DoNoRedir2() {
	Message "local> " "$@@"
	"$@@"
	err="$?"
	if [ $err -ne 0 ]
	then
 		DoNoRedir "$@@"
	fi
}

Do2() {
	DoNoRedir2 "$@@" >> $messages 2>&1
}

# Parse out our configuration file line
l=`grep ^$version":" system_list`
[ $? -eq 0 ] || Die "Unrecognized version $version"
buildMachine=`echo $l | awk -F: '{print $2}'`
sshVer=`echo $l | awk -F: '{print $3}'`
buildDir=`echo $l | awk -F: '{print $4}'`
buildPre=`echo $l | awk -F: '{print $5}'`
makeCmd=`echo $l | awk -F: '{print $6}'`
[ x"$makeCmd" = x ] && makeCmd=make
extraBuildOPT=`echo $l | awk -F: '{print $7}'`
extraCFlags=`echo $l | awk -F: '{print $8}'`
extraTestFlags=`echo $l | awk -F: '{print $9}'`
testPre=`echo $l | awk -F: '{print $10}'`

ssh="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no -o BatchMode=yes"
scp="scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no -o BatchMode=yes"

if [ "$sshVer" != "" ] 
then
  ssh="$ssh -$sshVer"
  scp="$scp -oProtocol=$sshVer"
fi

Message "Building $version using $ssh $buildMachine:$buildDir"

######################## CREATE BUILD SCRIPTS ###########################

cat > $scripts/prefix << END_PREFIX
#!/bin/bash
# Standard remote job script header: automatically generated by build_on_system

echo "Ssh'd to $buildMachine on" \`date\`
$buildPre

# Exit, giving this reason for failure.
Die() {
	echo "fatal> \$@@" 
	exit 1
}

# Run this command or die
Do() {
	echo "remote> \$@@"
	"\$@@"
	err="\$?"
	if [ \$err -ne 0 ] 
	then
		Die "error code \$err during remote> \$@@" 
                exit 1
	fi
}

Do2() {
	echo "remote> \$@@"
	"\$@@"
	err="\$?"
	if [ \$err -ne 0 ] 
	then
		Do "\$@@"
	fi
}

Do cd $buildDir

END_PREFIX

cat > $scripts/clean << END_CLEAN
echo "remote> Cleaning out old build"
mkdir -p $buildDir
cd $buildDir || exit 1
rm -fr ${cvsModule} ${cvsModule}.tar ${cvsModule}*.tar
exit 0

END_CLEAN

cat > $scripts/build < $scripts/prefix 
cat >> $scripts/build << END_BUILD
# Main build sequence:
echo "remote hostname>"
hostname
echo "remote id>" 
id
echo "remote uptime>" 
uptime
echo "remote disk space>" 
df -k .
echo "remote path> \$PATH"

Do tar xf ${cvsModule}.tar

echo "Starting main build at" \`date\`

Do cd ${cvsModule}
Do echo \$SHELL
MAKE="$makeCmd"
export MAKE
Do ./build AMPI $versSpace $extraBuildOPT $extraCFlags 

echo "Main build finished at" `date`

END_BUILD

if echo $version | grep bigsim > /dev/null 2>/dev/null;
then target=bgtest;
else target=test;
fi

######################## CREATE TEST SCRIPTS ###########################

cat > $scripts/test < $scripts/prefix 
cat >> $scripts/test << END_BUILD
# Main test sequence:
echo "Starting testing at" \`date\`

if [ -x ./instead_test.sh ]
then
	Do ./instead_test.sh ${cvsModule}/$version/tmp "$makeCmd" "$extraCFlags" $target "$extraTestFlags"
else
(
	Do cd ${cvsModule}/$version/tmp 
	Do $makeCmd OPTS="$extraCFlags" TESTOPTS="$extraTestFlags" $target
)
fi

if [ -x ./post_test.sh ] 
then
	Do ./post_test.sh 
fi

echo "Testing finished at" \`date\`

exit 0
END_BUILD


cat > $scripts/tar < $scripts/prefix 
cat >> $scripts/tar << END_TAR
# Cleanup and tar-up:
Do cd ${cvsModule}
# ( cd $version/pgms; make clean )
echo "Charm++ Automated Build" > README.version
echo " from CVS version of" `date` >> README.version
echo " for architecture $version" >> README.version
Do cd ..

Do rm -fr ${cvsModule}-$version
Do mv ${cvsModule} ${cvsModule}-$version
Do2 tar cf ${cvsModule}-$version.tar ${cvsModule}-$version 
Do chmod 644 ${cvsModule}-$version.tar
Do rm -fr ${cvsModule}-$version

exit 0
END_TAR




######################## RUN BUILD SCRIPTS ###########################

# Run this script on the remote machine:
SshScript() {
	stat=$1
	scr=$2
	Status $stat
	Message "local>" $ssh $buildMachine /bin/sh '<' $scr
	$ssh $buildMachine /bin/sh < $scr >> $messages 2>&1
	err=$?
	[ $err -eq 255 ] && err="0"
	if [ $err -ne 0 ]
	then
		Die "$stat failed ($err)"
	fi
	if `grep 'fatal> ' $messages > /dev/null 2>&1`
 	then
		Die "$stat failed ($err)"
	fi
	if `grep 'Connection reset by peer' $messages > /dev/null 2>&1`
 	then
		Die "$stat failed (ssh broken)"
	fi
}

errorString="Machine not available"
SshScript "Clean out build directory" $scripts/clean
errorString=

Status "Copying source to remote host"
#Do $ssh $buildMachine cat ">" $buildDir/${cvsModule}.tar < ${cvsModule}.tar
errorString="Machine not available"
Do $scp ${cvsModule}.tar $buildMachine:$buildDir/${cvsModule}.tar
errorString=

SshScript "Build on remote host" $scripts/build

./update_web

SshScript "Test on remote host" $scripts/test

SshScript "Final tar-up" $scripts/tar

Status "Grabbing binary file"
#DoNoRedir $ssh $buildMachine cat $buildDir/${cvsModule}-$version.tar > bin/${cvsModule}-$version.tar
Do2 $scp $buildMachine:$buildDir/${cvsModule}-$version.tar bin/

Status "Final gzip and copy"
Do gzip -f bin/${cvsModule}-$version.tar
Do $scp bin/${cvsModule}-$version.tar.gz $webMachine:$webMachBin/

Status "Good"

# Send our good status out:
./update_web

@


1.16
log
@updated
@
text
@d26 1
a26 1
		else if (i<2 || $(i+1) == "ia64" || $(i+1) == "darwin" || $(i+1) == "amd64" || $(i+1) == "ppc" || $(i+1) == "x86_64")
d217 1
a217 1
	Do ./instead_test.sh ${cvsModule}/$version/tmp "$makeCmd" "$extraCFlags" $target $extraTestFlags
d303 1
a303 1
Do $scp $buildMachine:$buildDir/${cvsModule}-$version.tar bin/
@


1.15
log
@kill befrore build
added Tiger build
@
text
@d9 1
a9 1
source config
d26 1
a26 1
		else if (i<2 || $(i+1) == "ia64" || $(i+1) == "darwin" || $(i+1) == "amd64")
d43 1
a43 1
mkdir $scripts
d87 13
d112 2
a113 1
testPre=`echo $l | awk -F: '{print $9}'`
d153 10
d203 1
a203 1
if echo $version | grep bluegene > /dev/null 2>/dev/null;
d217 1
a217 1
	Do ./instead_test.sh ${cvsModule}/$version/tmp "$makeCmd" "$extraCFlags" $target
d221 1
a221 1
	Do $makeCmd OPTS="$extraCFlags" $target
d248 1
a248 1
Do tar cf ${cvsModule}-$version.tar ${cvsModule}-$version 
@


1.14
log
@updated.
@
text
@d115 1
d170 3
@


1.13
log
@updated.
@
text
@d99 1
d180 2
d185 1
a185 1
echo "Starting testing at" `date`
d189 1
a189 1
	Do ./instead_test.sh ${cvsModule}/$version/tmp $makeCmd "$extraCFlags" $target
@


1.12
log
@improved.
@
text
@d184 1
a184 1
if [ -x ../instead_test.sh ]
d186 1
a186 1
	Do ../instead_test.sh
d194 1
a194 1
if [ -x ../post_test.sh ] 
d196 1
a196 1
	Do ../post_test.sh 
d242 1
a242 1
	if `grep 'fatal> ' $messages > /dev/null 2>/dev/null`
d246 4
@


1.11
log
@fixed print on date
@
text
@d61 6
a66 1
	Status "Bad:" "$@@"
d97 2
d101 1
a101 1
scp="scp"
d116 1
a116 1
echo "Ssh'd to $buildMachine on" `date`
d168 1
a168 1
Do ./build AMPI $versSpace -O
d190 1
a190 1
	Do $makeCmd OPTS=-O $target
d215 1
d248 1
d250 1
d254 1
d256 1
d260 2
@


1.10
log
@improved
@
text
@d158 1
a158 1
echo "Starting main build at" `date`
d192 1
a192 1
echo "Testing finished at" `date`
@


1.9
log
@grep for test error
support darwin
@
text
@d26 1
a26 1
		else if (i<2 || $(i+1) == "ia64" || $(i+1) == "darwin")
d84 1
a84 1
l=`grep $version":" system_list`
d90 2
d94 1
a94 1
scp="scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no -o BatchMode=yes"
d183 1
a183 1
	Do make OPTS=-O $target
@


1.8
log
@Added post_test.sh, to run extra tests afterwards.
This is used to test make_fem_alone.sh.

Also added instead_test.sh, to replace the
	./build test ...
with something else.  This is used for bluegene, which
can't do ./build test.
@
text
@d26 1
a26 1
		else if (i<2 || $(i+1) == "ia64")
d91 2
a92 2
ssh="ssh"
scp="scp"
d124 1
d165 5
d181 1
a181 1
	Do make OPTS=-O test
d232 4
d255 1
a255 1
Do gzip bin/${cvsModule}-$version.tar
@


1.7
log
@Two changes:
  1.) Replace "charm" with "${cvsModule}".  This is more to
     allow testing of "charm-stable", etc. than to start expanding
     beyond charm.
  2.) Added "update_cvs" file, which if all tests pass,
     copies the CVS repository directory charm-nightly-test to
     charm-nightly.  This is for maintaining an up-to-date,
     but automatically tested version of Charm++.
@
text
@d169 14
a182 2
Do cd ${cvsModule}/$version/tmp 
Do make OPTS=-O test
@


1.6
log
@Better error checking.
@
text
@d132 1
a132 1
echo "remote> Cleaning out old charm build"
d135 1
a135 1
rm -fr charm charm.tar charm*.tar
d153 1
a153 1
Do tar xf charm.tar
d157 1
a157 1
Do cd charm
d169 1
a169 1
Do cd charm/$version/tmp 
d181 1
a181 1
Do cd charm
d188 4
a191 4
Do mv charm charm-$version
Do tar cf charm-$version.tar charm-$version 
Do chmod 644 charm-$version.tar
Do rm -fr charm-$version
d218 3
a220 3
Status "Copying charm to remote host"
#Do $ssh $buildMachine cat ">" $buildDir/charm.tar < charm.tar
Do $scp charm.tar $buildMachine:$buildDir/charm.tar
d222 1
a222 1
SshScript "Build charm on remote host" $scripts/build
d224 1
a224 1
SshScript "Test charm on remote host" $scripts/test
d229 2
a230 2
#DoNoRedir $ssh $buildMachine cat $buildDir/charm-$version.tar > bin/charm-$version.tar
Do $scp $buildMachine:$buildDir/charm-$version.tar bin/
d233 2
a234 2
Do gzip bin/charm-$version.tar
Do $scp bin/charm-$version.tar.gz $webMachine:$webMachBin/
@


1.5
log
@Don't use space before "ia64", since for some reason it's
	net-linux-ia64
instead of
	net-linux ia64
@
text
@d53 1
a53 1
	echo "$version status:" $@@
d60 2
a61 2
	Message "fatal> " $@@ 
	Status "Bad:" $@@
d66 4
a69 4
# Run this command or die
Do() {
	Message "local> " $@@
	$@@ >> $messages 2>&1
d71 1
a71 1
	if [ $err -ne 0 ] 
d73 1
a73 1
		Die "error code $err during local> " $@@ 
d77 5
d112 1
a112 1
	echo "fatal> " \$@@ 
d118 2
a119 2
	echo "remote> " \$@@
	\$@@
d123 1
a123 1
		Die "error code \$err during remote> " \$@@ 
d131 8
a142 1
rm -fr charm charm-*
d151 1
a151 1
echo "remote path> $PATH"
d174 1
d193 1
a200 3
Status "Making build directory"
echo "mkdir -p $buildDir" | $ssh $buildMachine /bin/sh 

d216 2
d219 1
d229 1
@


1.4
log
@Make tarfile world-readable.  This allows it to
be distributed from the website without further
modification.
@
text
@d22 9
a30 3
	printf("%s",$1);
	if (NF>1) printf("-");
	for (i=2;i<=NF;i++) printf("%s ",$i);
@


1.3
log
@Respect ssh version.
@
text
@d171 1
@


1.2
log
@Ignore error code 255--ssh randomly seems to return this from Linux,
even when the script suceeded.
@
text
@d49 1
d83 6
d188 1
@


1.1
log
@Re-wrote this automated build system, after a hard drive crash
destroyed the 2002 version.  Since I don't want to lose everything
again, I'm checking this one in.
@
text
@d183 1
@

