• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# !/bin/sh
2
3# by default, use the java executable on the path
4vm=java
5
6#set the DISPLAY for running tests on Linux
7DISPLAY=`$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
10dir=.
11
12# operating system, windowing system and architecture variables
13os=
14ws=
15arch=
16
17# list of tests (targets) to execute in test.xml
18tests=
19
20# default value to determine if eclipse should be reinstalled between running of tests
21installmode="clean"
22
23# name of a property file to pass to Ant
24properties=
25
26# message printed to console
27usage="usage: $0 -os <osType> -ws <windowingSystemType> -arch <architecture> [-noclean] [<test target>][-properties <path>]"
28
29
30# proces command line arguments
31while [ $# -gt 0 ]
32do
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
44done
45
46# for *nix systems, os, ws and arch values must be specified
47if [ "x$os" = "x" ]
48then
49	echo >&2 "$usage"
50	exit 1
51fi
52
53if [ "x$ws" = "x" ]
54then
55	echo >&2 "$usage"
56	exit 1
57fi
58
59if [ "x$arch" = "x" ]
60then
61	echo >&2 "$usage"
62	exit 1
63fi
64
65#necessary when invoking this script through rsh
66cd $dir
67
68# verify os, ws and arch values passed in are valid before running tests
69if [ "$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" ]
70then
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
92else
93	echo "The os, ws and arch values are either invalid or are an invalid combination"
94
95exit 1
96fi