#!/bin/sh bzrTest() { #every test start from lorry script directory to be #base directory and should return to it after the #test echo "----------------" echo "starting BZR test..." echo "----------------" mkdir -p repobzr/trunk bzr init-repo repobzr #creating repo cd repobzr bzr init trunk #creating trunk cd trunk echo "Bzr Test file" > testbzr.txt bzr add testbzr.txt #adding file to repo echo "Second line" >> testbzr.txt bzr commit -m "Added second line of text" #commiting a change cd ../../ #going back to base directory echo "{ \"BZR\":{ \"type\":\"bzr\", \"url\":\"file://`pwd`/repobzr/trunk\" } } " > atl.lorry echo "running bzr lorry test" ./lorry --pull-only --log=atl.log atl.lorry -w `pwd`/workd cd workd/BZR/git test=`git branch` if [ "$test" = " trunk" ] then echo "bzr repo success in lorry" cd ../../../ rm -fr workd/BZR repobzr else echo "bzr repo failed in lorry" exit 1 fi } tarTest() { #every test start from lorry script directory to be #base directory and should return to it after the #test #rm atl.lorry echo "----------------" echo "tar ball test..." echo "----------------" mkdir repotar #cd repotar echo "tar file gzip/lzma/bzip2" > repotar/testg-l.txt tar -czf repotar.tar.gz repotar/ tar -cf repotar.tar.lzma repotar/ --lzma tar -cf repotar.tar.bzip2 repotar/ --bzip2 # cd .. echo "{ \"targzip\":{ \"type\":\"tarball\", \"compression\":\"gzip\", \"strip\": 1, \"url\":\"file://`pwd`/repotar.tar.gz\" }, \"tarlzma\":{ \"type\":\"tarball\", \"compression\":\"lzma\", \"strip\": 1, \"url\":\"file://`pwd`/repotar.tar.lzma\" }, \"tarbzip2\":{ \"type\":\"tarball\", \"compression\":\"bzip2\", \"strip\": 1, \"url\":\"file://`pwd`/repotar.tar.bzip2\" } } " > atl.lorry echo "going to tar gzip and lzma test" ./lorry --pull-only --log=atl.log atl.lorry -w `pwd`/workd test1=`find workd/tarlzma/git/ -name testg-l.txt` test2=`find workd/targzip/git/ -name testg-l.txt` test3=`find workd/tarbzip2/git/ -name testg-l.txt` if [ "$test1" = "" ] || [ "$test2" = "" ] || [ "$test3" = "" ] then echo "tar repo fail in lorry test" exit 1 else echo "tar repo success in lorry test" rm -fr workd/tar* repotar rm -fr repotar.tar.* fi } svnTest() { #every test start from lorry script directory to be #base directory and should return to it after the #test echo "----------------" echo "Starting svn test..." echo "----------------" rm -fr reposvn localhost branches #if there is any mkdir reposvn svnadmin create `pwd`/reposvn #changes to configuration svn files sed -r -e's/^# (password-db.*)/\1/g' -i `pwd`/reposvn/conf/svnserve.conf sed -r -e's/^# (anon-access.*)/\1/g' -i `pwd`/reposvn/conf/svnserve.conf sed -r -e's/^# (auth-access.*)/\1/g' -i `pwd`/reposvn/conf/svnserve.conf echo "adnan = test" >> `pwd`/reposvn/conf/passwd #creat test password #run server svn killall svnserve svnserve -d --root `pwd`/reposvn #checkout repo add trunk directory and add test file and commit svn co svn://localhost cd localhost svn mkdir branches tags trunk echo "hello" > trunk/test.txt svn add trunk/test.txt svn commit --username adnan --password test -m "trunk added" --no-auth-cache cd .. rm -fr localhost #remove workd for lorry checkout echo "{ \"SVN\":{ \"type\":\"svn\", \"url\":\"svn://localhost\", \"layout\":\"standard\" } } " > atl.lorry echo "going to run svn lorry test" ./lorry --pull-only --log=atl.log atl.lorry -w `pwd`/workd cd workd/SVN/git test=`git branch` if [ -z "$test" ] then echo "svn repo fail in lorry test" exit 1 else echo "svn repo success in lorry test" cd ../../../ rm -fr workd/SVN reposvn fi } gitTest() { #every test start from lorry script directory to be #base directory and should return to it after the #test echo "----------------" echo "git repo test..." echo "----------------" rm -fr repogit mkdir repogit cd repogit git init echo "test git repo file" > test.txt git add . git commit -m "first file commit" cd .. echo "{ \"git\":{ \"type\":\"git\", \"url\":\"file://`pwd`/repogit\" } } " > atl.lorry echo "going to run git lorry test" ./lorry --pull-only --log=atl.log atl.lorry -w `pwd`/workd cd workd/git/git test=`git branch` if [ "$test" = "* master" ] then echo "git repo success in lorry test" cd ../../../ rm -fr workd/git repogit else echo "git repo fail in lorry test" exit 1 fi } hgTest() { #every test start from lorry script directory to be #base directory and should return to it after the #test echo "----------------" echo "hg repo test..." echo "----------------" rm -fr repohg mkdir repohg cd repohg hg init touch readme hg add readme hg commit -u adnan -m "test commit" cd .. echo "comming out of repo" echo "{ \"hg\":{ \"type\":\"hg\", \"url\":\"file://`pwd`/repohg\" } } " > atl.lorry echo "going to run hg lorry test" `pwd` ./lorry --pull-only --log=lorry.log atl.lorry -w `pwd`/workd test=`find workd/hg/hg/ -name readme` if [ -z "$test" ] then echo "hg repo fail in lorry test" exit 1 else echo "hg repo success in lorry test" rm -fr workd/hg repohg fi } cvsTest() { #every test start from lorry script directory to be #base directory and should return to it after the #test echo "----------------" echo "cvs repo test..." echo "----------------" rm -fr repocvs mkdir repocvs export CVSROOT=`pwd`/repocvs export CVS_RSH= cd repocvs cvs init cd .. cvs checkout CVSROOT cd CVSROOT touch readmetoo cvs add readmetoo cvs commit -m "first file added to cvs" cd .. rm -fr CVSROOT echo "{ \"cvs\":{ \"type\":\"cvs\", \"url\":\"`pwd`/repocvs\", \"module\":\"CVSROOT\" } } " > atl.lorry echo "going to run cvs lorry test" `pwd` ./lorry --pull-only --log=lorry.log atl.lorry -w `pwd`/workd test=`find workd/cvs/git/ -name readmetoo` if [ -z "$test" ] then echo "cvs repo fail in lorry test" exit 1 else echo "cvs repo success in lorry test" rm -fr workd/cvs repocvs fi } main() { ##initial requriment for test #rm -fr workd rm -fr repobzr/ repogit/ reposvn/ repotar repohg/ repocvs/ repotar.tar.* workd/ atl.* mkdir workd } main bzrTest $@ tarTest svnTest gitTest hgTest cvsTest