Home | History | Annotate | Download | only in testScripts
      1 # !/bin/sh
      2 
      3 # by default, use the java executable on the path
      4 vm=java
      5 
      6 #set the DISPLAY for running tests on Linux
      7 DISPLAY=`$HOST`:0.0;export DISPLAY
      8 
      9 #this value must be set when using rsh to execute this script, otherwise the script will execute from the user's home directory
     10 dir=.
     11 
     12 # operating system, windowing system and architecture variables
     13 os=
     14 ws=
     15 arch=
     16 
     17 # list of tests (targets) to execute in test.xml
     18 tests=
     19 
     20 # default value to determine if eclipse should be reinstalled between running of tests
     21 installmode="clean"
     22 
     23 # name of a property file to pass to Ant
     24 properties=
     25 
     26 # message printed to console
     27 usage="usage: $0 -os <osType> -ws <windowingSystemType> -arch <architecture> [-noclean] [<test target>][-properties <path>]"
     28 
     29 
     30 # proces command line arguments
     31 while [ $# -gt 0 ]
     32 do
     33 	case "$1" in
     34 		-dir) dir="$2"; shift;;
     35 		-os) os="$2"; shift;;
     36 		-ws) ws="$2"; shift;;
     37 		-arch) arch="$2"; shift;;
     38 		-noclean) installmode="noclean";;
     39 		-properties) properties="-propertyfile $2";shift;;
     40 		-vm) vm="$2";shift;;
     41 		*) tests=$tests\ $1;;
     42 	esac
     43 	shift
     44 done
     45 
     46 # for *nix systems, os, ws and arch values must be specified
     47 if [ "x$os" = "x" ]
     48 then
     49 	echo >&2 "$usage"
     50 	exit 1
     51 fi
     52 
     53 if [ "x$ws" = "x" ]
     54 then
     55 	echo >&2 "$usage"
     56 	exit 1
     57 fi
     58 
     59 if [ "x$arch" = "x" ]
     60 then
     61 	echo >&2 "$usage"
     62 	exit 1
     63 fi
     64 
     65 #necessary when invoking this script through rsh
     66 cd $dir
     67 
     68 # verify os, ws and arch values passed in are valid before running tests
     69 if [ "$os-$ws-$arch" = "linux-motif-x86" ] || [ "$os-$ws-$arch" = "linux-gtk-x86" ] || [ "$os-$ws-$arch" = "solaris-motif-sparc" ] || [ "$os-$ws-$arch" = "solaris-gtk-sparc" ] || [ "$os-$ws-$arch" = "aix-motif-sparc" ] || [ "$os-$ws-$arch" = "hpux-motif-PA_RISC" ] || [ "$os-$ws-$arch" = "qnx-photon-x86" ]
     70 then
     71 	# Replace the boot eclipse (The eclipse used to run the main test.xml, this will start another eclipse later)
     72 	rm -r eclipse
     73 	rm -r workspace
     74 	tar -xzf eclipse-SDK-*.tar.gz
     75 	unzip -qq -o -C VE-junit-tests-*.zip */plugins/org.eclipse.test*
     76 	
     77 	if [ "$installmode" = "noclean" ]
     78 	then		
     79 		# if tests are to run without reinstalling eclipse, only install the test eclipse if it does not exist
     80 		# If the test-eclipse directory is in a partially installed state, it should be deleted manually
     81 
     82 		if [ ! -r test-eclipse/eclipse ]
     83 		then
     84 			 $vm -cp eclipse/startup.jar org.eclipse.core.launcher.Main -noupdate -ws $ws -os $os -arch $arch -application org.eclipse.ant.core.antRunner -file test.xml setup -Dws=$ws -Dos=$os -Darch=$arch -Dclean=true -logger org.apache.tools.ant.DefaultLogger
     85 		fi
     86 	fi
     87 
     88 # run tests
     89 $vm -cp eclipse/startup.jar -Dosgi.ws=$ws -Dosgi.os=$os -Dosgi.arch=$arch org.eclipse.core.launcher.Main -application org.eclipse.ant.core.antRunner -file test.xml $tests -Dws=$ws -Dos=$os -Darch=$arch -D$installmode=true $properties -logger org.apache.tools.ant.DefaultLogger
     90 
     91 # display message to user if os, ws and arch are invalid
     92 else
     93 	echo "The os, ws and arch values are either invalid or are an invalid combination"
     94 
     95 exit 1
     96 fi