Blame SOURCES/eclipse-cdt-runtests.sh

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