summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-10-19 18:47:08 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-10-19 18:47:08 +0000
commit8b17d54737ba37bc96f91bfcd69590acb3f728e9 (patch)
tree1ceb52c16e85fde8a3dce8af2a8ba2c443e46a1d /tools
parent26ac638650e2da23d2d97194bf13b5b9162ac181 (diff)
downloadscala-8b17d54737ba37bc96f91bfcd69590acb3f728e9.tar.gz
scala-8b17d54737ba37bc96f91bfcd69590acb3f728e9.tar.bz2
scala-8b17d54737ba37bc96f91bfcd69590acb3f728e9.zip
For all those using .git who like their build a...
For all those using .git who like their build and tests being run on a different machine - remotetest. Uses ssh, git and the remote home directory to push the current tree to a bare repo, then check it out remotely and run the full build and tests. Usage: remotetest [--init] <user> <server> <bare-repo-path> <workspace-repo-path> Modifying .ssh/authorized_keys on the <server> is recommended. To be run with --init first time. No review.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/remotetest131
1 files changed, 131 insertions, 0 deletions
diff --git a/tools/remotetest b/tools/remotetest
new file mode 100755
index 0000000000..699d9e5d8a
--- /dev/null
+++ b/tools/remotetest
@@ -0,0 +1,131 @@
+
+
+#
+# Remote build&test script.
+# Author: Aleksandar Prokopec
+#
+
+
+SCRIPTNAME="..:: RemoteTest ::.."
+DESC="This script pushes the current git repo to a remote bare repo. \
+It then checks out the source tree in a workspace repo and starts the\
+ build and all the tests. It can also initialize the remote bare repo\
+ and the workspace repo. It assumes that the current repo refspec has\
+ been set for the remote bare repository - .git/config of the current\
+ repo must have a remote called <server> and the corresponding master\
+ branch. Git should, naturally, be installed on both systems.\
+ "
+USAGE=" Usage: remotetest [--init] <user> <server> <bare-repo-path> <workspace-repo-path>"
+
+
+function usage()
+{
+ echo $SCRIPTNAME
+ echo $DESC
+ echo
+ echo $USAGE
+}
+
+
+function error()
+{
+ echo "Failed."
+ exit 1
+}
+
+function success()
+{
+ echo "Success!"
+ exit 0
+}
+
+function instruct()
+{
+ usage
+ error
+}
+
+
+
+if [ $# -lt 1 ]
+then
+ instruct
+fi
+
+
+if [[ $1 = "--init" ]]
+then
+ if [ $# -ne 5 ]
+ then
+ instruct
+ fi
+ USER=$2
+ LOCATION=$3
+ BAREREPO=$4
+ WORKREPO=$5
+else
+ if [ $# -ne 4 ]
+ then
+ instruct
+ fi
+ USER=$1
+ LOCATION=$2
+ BAREREPO=$3
+ WORKREPO=$4
+fi
+
+if [[ $1 = "--init" ]]
+then
+ # init bare repo
+ ssh $USER@$LOCATION "mkdir $BAREREPO"
+ ssh $USER@$LOCATION "cd $BAREREPO; git init --bare"
+ if [ $? -ne 0 ]
+ then
+ error "Could not initialize bare repo."
+ fi
+
+ # push to bare repo
+ git push --all
+ if [ $? -ne 0 ]
+ then
+ error "Could not push to bare repo."
+ fi
+
+ # init and checkout work repo
+ ssh $USER@$LOCATION "mkdir $WORKREPO"
+ ssh $USER@$LOCATION "cd $WORKREPO; git clone --local $BAREREPO ."
+ if [ $? -ne 0 ]
+ then
+ error "Could not init working repo."
+ fi
+
+ success
+fi
+
+
+
+
+# if it's not the init operation, proceed normally
+# push to remote bare repo
+git push $LOCATION $LOCATION/master
+if [ $? -ne 0 ]
+then
+ error "Could not push to bare repo."
+fi
+
+# remotely checkout the repo
+ssh $USER@$LOCATION "cd $WORKREPO; git pull origin master"
+if [ $? -ne 0 ]
+then
+ error "Could remotely pull from bare repo to work repo."
+fi
+
+# run the build and tests
+ssh $USER@$LOCATION "cd $WORKREPO; ant all.clean; ant test"
+
+
+success
+
+
+
+