Andrew Overholt 63a3c72
#!/bin/sh
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
function usage {
Andrew Overholt 63a3c72
cat << _EOF_
Andrew Overholt 63a3c72
usage: $0 [<options>]
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
Use PDE Build to build Eclipse features
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
Optional arguments:
Andrew Overholt 63a3c72
   -h      Show this help message
Andrew Overholt 63a3c72
   -e      Eclipse SDK location
Andrew Overholt 63a3c72
   -g      Don't run the tests headless
Andrew Overholt 63a3c72
   -d      Allow remote connection to test runs' JVM
Andrew Overholt 63a3c72
_EOF_
Andrew Overholt 63a3c72
}
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
debugTests=0
Andrew Overholt 63a3c72
headless=1
Andrew Overholt 63a3c72
while getopts “hgdbe:” OPTION
Andrew Overholt 63a3c72
do
Andrew Overholt 63a3c72
     case $OPTION in
Andrew Overholt 63a3c72
         d)
Andrew Overholt 63a3c72
             debugTests=1
Andrew Overholt 63a3c72
             ;;
Andrew Overholt 63a3c72
         e)
Andrew Overholt 63a3c72
             eclipseHome=$OPTARG
Andrew Overholt 63a3c72
             ;;
Andrew Overholt 63a3c72
         g)
Andrew Overholt 63a3c72
             headless=0
Andrew Overholt 63a3c72
             ;;
Andrew Overholt 63a3c72
         h)
Andrew Overholt 63a3c72
             usage
Andrew Overholt 63a3c72
             exit
Andrew Overholt 63a3c72
             ;;
Andrew Overholt 63a3c72
         ?)
Andrew Overholt 63a3c72
             usage
Andrew Overholt 63a3c72
             exit
Andrew Overholt 63a3c72
             ;;
Andrew Overholt 63a3c72
     esac
Andrew Overholt 63a3c72
done
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
testSuite=org.eclipse.cdt.testing
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
if [ -z $eclipseHome ]; then
Andrew Overholt 63a3c72
    eclipseHome=$(rpm --eval "%{_libdir}")/eclipse
Andrew Overholt 63a3c72
fi
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
cdtTestPluginVersion=$(ls $eclipseHome/dropins/cdt-tests/plugins | \
Andrew Overholt 63a3c72
  grep ${testSuite}_ | sed "s/${testSuite}_//")
Andrew Overholt 63a3c72
testDriver=$eclipseHome/dropins/cdt-tests/plugins/${testSuite}_${cdtTestPluginVersion}/test.xml
Andrew Overholt 63a3c72
properties=$(pwd)/cdt-tests.properties
Andrew Overholt 63a3c72
Andrew Overholt bfd3b96
libraryXml=$eclipseHome/dropins/sdk/plugins/org.eclipse.test/library.xml
Andrew Overholt 63a3c72
results=$(pwd)/results-`date "+%Y%m%d%H%M%S"`
Andrew Overholt 63a3c72
workspace=$(pwd)/workspace
Andrew Overholt 63a3c72
datadir=$(pwd)/testDataDir
Andrew Overholt 63a3c72
homedir=$(pwd)/home
Andrew Overholt 63a3c72
testhome=$(pwd)/testhome
Andrew Overholt 63a3c72
tmpresults=$(pwd)/tmpresults
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
os=linux
Andrew Overholt 63a3c72
ws=gtk
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
if uname -m > /dev/null 2>&1; then
Andrew Overholt 63a3c72
	arch=`uname -m`
Andrew Overholt 63a3c72
else
Andrew Overholt 63a3c72
	arch=`uname -p`
Andrew Overholt 63a3c72
fi
Andrew Overholt 63a3c72
# Massage arch for Eclipse-uname differences
Andrew Overholt 63a3c72
case $arch in
Andrew Overholt 63a3c72
	i[0-9]*86)
Andrew Overholt 63a3c72
		arch=x86 ;;
Andrew Overholt 63a3c72
	ia64)
Andrew Overholt 63a3c72
		arch=ia64 ;;
Andrew Overholt 63a3c72
	ppc)
Andrew Overholt 63a3c72
		arch=ppc ;;
Andrew Overholt ac7e72a
	ppc64)
Andrew Overholt ac7e72a
		arch=ppc ;;
Andrew Overholt 63a3c72
	x86_64)
Andrew Overholt 63a3c72
		arch=x86_64 ;;
Andrew Overholt 63a3c72
	*)
Andrew Overholt 63a3c72
		echo "Unrecognized architecture:  $arch" 1>&2
Andrew Overholt 63a3c72
		exit 1 ;;
Andrew Overholt 63a3c72
esac
Andrew Overholt 63a3c72
	echo >&2 "Architecture not specified.  Assuming host architecture: $arch"
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
setXvnc() {
Andrew Overholt 63a3c72
	echo localhost > Xvnc.cfg
Andrew Overholt 4f087e5
	# Pick a high display number.
Andrew Overholt 4f087e5
	port=`expr '(' $RANDOM '*' 9 / 32767 ')' + 58` 
Andrew Overholt 4f087e5
	$xvnc :$port -screen 1 1024x768x32 -auth Xvnc.cfg -localhost &
Andrew Overholt 63a3c72
	Xvncpid=$!
Andrew Overholt 4f087e5
	DISPLAY=`$HOST`:$port
Andrew Overholt 63a3c72
}
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
rm $properties
Andrew Overholt 63a3c72
rm -rf $workspace $datadir $homedir $tmpresults $testhome
Andrew Overholt 63a3c72
mkdir -p $workspace $results $datadir $homedir $tmpresults $testhome
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
echo "data-dir=$datadir" >> $properties
Andrew Overholt 63a3c72
echo "useEclipseExe=true" >> $properties
Andrew Overholt 63a3c72
echo "junit-report-output=$results" >> $properties
Andrew Overholt 63a3c72
echo "results=$results" >> $properties
Andrew Overholt 63a3c72
echo "tmpresults=$tmpresults" >> $properties
Andrew Overholt 63a3c72
echo "testhome=$testhome" >> $properties
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
echo "cdt-folder=$(pwd)/cdt_folder" >> $properties
Andrew Overholt 63a3c72
echo "cdt-core-loc=$(pwd)/cdt_core_folder" >> $properties
Andrew Overholt 63a3c72
echo "cdt-ui-loc=$(pwd)/cdt_ui_folder" >> $properties
Andrew Overholt 63a3c72
echo "cdt-debug-ui-loc=$(pwd)/cdt_debug_ui_folder" >> $properties
Andrew Overholt 63a3c72
echo "cdt-mbs-core-loc=$(pwd)/cdt_mbs_core_folder" >> $properties
Andrew Overholt 63a3c72
echo "cdt-mbs-ui-loc=$(pwd)/cdt_mbs_ui_folder" >> $properties
Andrew Overholt 63a3c72
if [ $debugTests -eq 1 ]; then
Andrew Overholt 63a3c72
    echo "extraVMargs=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=40000" >> $properties
Andrew Overholt 63a3c72
fi
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
if [ $headless -eq 1 ]; then
Andrew Overholt 63a3c72
# Try to find Xvnc
Andrew Overholt 63a3c72
xvnc=
Andrew Overholt 63a3c72
if [ -a /usr/bin/Xvnc ]
Andrew Overholt 63a3c72
then
Andrew Overholt 63a3c72
	xvnc=/usr/bin/Xvnc
Andrew Overholt 63a3c72
	setXvnc
Andrew Overholt 63a3c72
else
Andrew Overholt 63a3c72
	if [ -a /usr/X11/bin/Xvnc ]
Andrew Overholt 63a3c72
	then
Andrew Overholt 63a3c72
		xvnc=/usr/X11/bin/Xvnc
Andrew Overholt 63a3c72
		setXvnc
Andrew Overholt 63a3c72
	else
Andrew Overholt 63a3c72
		DISPLAY=`$HOST`:0.0
Andrew Overholt 63a3c72
	fi
Andrew Overholt 63a3c72
fi
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
export DISPLAY
Andrew Overholt 63a3c72
fi
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
$eclipseHome/eclipse \
Andrew Overholt 63a3c72
-Duser.home=$homedir \
Andrew Overholt 63a3c72
-data $workspace \
Andrew Overholt 63a3c72
-application org.eclipse.ant.core.antRunner \
Andrew Overholt 63a3c72
-file $testDriver \
Andrew Overholt 63a3c72
-Declipse-home=$eclipseHome \
Andrew Overholt 63a3c72
-Dlibrary-file=$libraryXml \
Andrew Overholt 63a3c72
-Darch=$arch \
Andrew Overholt 63a3c72
-Dos=$os \
Andrew Overholt 63a3c72
-Dws=$ws \
Andrew Overholt 63a3c72
-propertyfile $properties \
Andrew Overholt 63a3c72
-logger org.apache.tools.ant.DefaultLogger \
Andrew Overholt 63a3c72
-vmargs \
Andrew Overholt 63a3c72
-Duser.home=$homedir
Andrew Overholt 63a3c72
Andrew Overholt 63a3c72
# Clean up if we used Xvnc
Andrew Overholt 63a3c72
if [ -e Xvnc.cfg ]
Andrew Overholt 63a3c72
then
Andrew Overholt 63a3c72
	kill $Xvncpid
Andrew Overholt 63a3c72
	rm Xvnc.cfg
Andrew Overholt 63a3c72
fi