[eclipse] Tests!

Krzysztof Daniel kdaniel at fedoraproject.org
Thu Sep 6 15:03:35 UTC 2012


commit fe0f2f640cd3ab95d7dc05fab0fe753d2f1188c4
Author: Krzysztof Daniel <kdaniel at redhat.com>
Date:   Tue Sep 4 11:15:37 2012 +0200

    Tests!
    
    Also, eclipse.spec contains help patch (not-working).

 eclipse-test-support.patch |  213 ++++++++++++++++++++++++++++++++++++++++++++
 eclipse.spec               |   43 +++++++++
 2 files changed, 256 insertions(+), 0 deletions(-)
---
diff --git a/eclipse-test-support.patch b/eclipse-test-support.patch
new file mode 100644
index 0000000..721a9b4
--- /dev/null
+++ b/eclipse-test-support.patch
@@ -0,0 +1,213 @@
+--- TMP/eclipse-junit-tests/src/main/scripts/test.xml.bak	2012-07-25 17:15:52.000000000 +0200
++++ TMP/eclipse-junit-tests/src/main/scripts/test.xml	2012-09-04 10:01:23.562816367 +0200
+@@ -90,65 +90,20 @@
+ 		<antcall target="installTestPlugins" />
+ 	</target>
+ 
+-	<!--use an stable version of the director so that instability in the current build doesn't cause all the tests to fail -->
+-	<target name="setupPlatform">
+-		<echo message="os.arch ${os.arch}" />
+-		<property file="equinoxp2tests.properties" />
+-		<condition property="platformArchive" value="${org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive.linux}">
+-			<and>
+-				<os family="unix" />
+-				<not>
+-					<or>
+-						<os family="mac" />
+-						<os arch="x86_64" />
+-						<os arch="amd64" />
+-					</or>
+-				</not>
+-			</and>
+-		</condition>
+-		<condition property="platformArchive" value="${org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive.macosx-x86_64}">
+-			<and>
+-				<os family="mac" />
+-				<os family="unix" />
+-				<or>
+-				<os arch="x86_64" />
+-				<os arch="amd64" />
+-				</or>
+-			</and>
+-		</condition>
+-		<condition property="platformArchive" value="${org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive.win32}">
+-			<and>
+-				<os family="windows" />
+-				<os arch="x86" />
+-			</and>
+-		</condition>
+-		<condition property="platformArchive" value="${org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive.win32-x86_64}">
+-			<and>
+-				<os family="windows" />
+-				<or>
+-				<os arch="x86_64" />
+-				<os arch="amd64" />
+-				</or>
+-			</and>
+-		</condition>
+-		<condition property="platformArchive" value="${org.eclipse.equinox.p2.reconciler.tests.lastrelease.platform.archive.linux-x86_64}">
+-			<and>
+-				<os family="unix" />
+-				<or>
+-					<os arch="x86_64" />
+-					<os arch="amd64" />
+-				</or>
+-			</and>
+-		</condition>
+-		<condition property="platformTarget" value="platform-zip">
+-			<contains string="${platformArchive}" substring=".zip" />
+-		</condition>
+-		<condition property="platformTarget" value="platform-tar.gz">
+-			<contains string="${platformArchive}" substring=".tar.gz" />
+-		</condition>
+-		<echo message="platformTarget ${platformTarget} platformArchive ${platformArchive}" />
+-		<antcall target="${platformTarget}" />
+-	</target>
++    <!--use an stable version of the director so that instability in the current build doesn't cause all the tests to fail -->
++    <target name="setupPlatform">
++        <echo message="os.arch ${os.arch}" />
++        <property name="platformArchive" value="${runtimeArchive}" />
++        
++        <condition property="platformTarget" value="platform-zip">
++            <contains string="${platformArchive}" substring=".zip" />
++        </condition>
++        <condition property="platformTarget" value="platform-tar.gz">
++            <contains string="${platformArchive}" substring=".tar.gz" />
++        </condition>
++        <echo message="platformTarget ${platformTarget} platformArchive ${platformArchive}" />
++        <antcall target="${platformTarget}" />
++    </target>
+ 
+ 
+ 	<!--setup for platform zip archives-->
+--- TMP/eclipse-junit-tests/src/main/scripts/runtests.sh.bak	2012-07-25 17:15:52.000000000 +0200
++++ TMP/eclipse-junit-tests/src/main/scripts/runtests.sh	2012-09-04 10:02:38.616352712 +0200
+@@ -1,4 +1,70 @@
+ #!/bin/sh
++function findXvncAndSetDisplay() {
++#   if [ ${headless} == 1 ]; then
++        # Try to find Xvnc
++        xvnc=
++        if [ -a /usr/bin/Xvnc ]
++        then
++            xvnc=/usr/bin/Xvnc
++            setupXvnc
++        else
++            if [ -a /usr/X11/bin/Xvnc ]
++            then
++                xvnc=/usr/X11/bin/Xvnc
++                setupXvnc
++            else
++                echo "Couldn't find Xvnc (/usr/bin/Xvnc or /usr/X11/bin/Xvnc).  Using DISPLAY=0:0"
++                DISPLAY=`$HOST`:0.0
++            fi
++        fi
++        export DISPLAY
++#   fi
++}
++
++function setupXvnc() {
++    # Pick a high display number.
++    port=`expr '(' $RANDOM '*' 9 / 32767 ')' + 58`
++    echo localhost > Xvnc.cfg
++    echo "Setting up Xvnc on port ${port} with password VNCpassword1"
++    $xvnc :$port -screen 1 1024x768x32 -auth Xvnc.cfg -localhost -PasswordFile eclipse-tests-vncpwd &> Xvnc.log &
++    Xvncpid=$!
++    DISPLAY=`$HOST`:$port
++}
++
++function setArch() {
++    if [ "x$buildArch" = "x" ]
++    then
++        if uname -m > /dev/null 2>&1; then
++            arch=`uname -m`
++        else
++            arch=`uname -p`
++        fi
++        # Massage arch for Eclipse-uname differences
++        case $arch in
++            i[0-9]*86)
++                arch=x86 ;;
++            ia64)
++                arch=ia64 ;;
++            ppc)
++                arch=ppc ;;
++            x86_64)
++                arch=x86_64 ;;
++            *)
++                echo "Unrecognized architecture:  $arch" 1>&2
++                exit 1 ;;
++        esac
++        echo >&2 "Architecture not specified.  Assuming host architecture: $arch"
++    fi
++}
++
++function cleanupXvnc() {
++    # Clean up if we used Xvnc
++    if [ -e Xvnc.cfg ]
++    then
++        kill $Xvncpid
++        rm Xvnc.cfg
++    fi
++}
+ 
+ #set the DISPLAY for running tests on Linux
+ #DISPLAY=`$HOST`:0.0;export DISPLAY
+@@ -66,24 +132,38 @@
+ 
+ #necessary when invoking this script through rsh
+ cd $dir
+-
++mkdir -p /tmp/eclipse-tests-directory
++pushd /tmp/eclipse-tests-directory
++rm -rf *
+ # verify os, ws and arch values passed in are valid before running tests
+ if [ "$os-$ws-$arch" = "linux-gtk-x86" ] || [ "$os-$ws-$arch" = "macosx-cocoa-ppc" ] || [ "$os-$ws-$arch" = "macosx-cocoa-x86" ] || [ "$os-$ws-$arch" = "aix-gtk-ppc" ] || [ "$os-$ws-$arch" = "aix-gtk-ppc64" ]  || [ "$os-$ws-$arch" = "solaris-gtk-sparc" ] || [ "$os-$ws-$arch" = "solaris-gtk-x86" ] || [ "$os-$ws-$arch" = "linux-gtk-ppc64" ] ||  [ "$os-$ws-$arch" = "linux-gtk-ia64" ] ||  [ "$os-$ws-$arch" = "linux-gtk-x86_64" ] ||  [ "$os-$ws-$arch" = "hpux-gtk-ia64_32"]
+ then
+-	if [ ! -r eclipse ]
+-	then
+-		tar -xzf eclipse-SDK-*.tar.gz
+-		unzip -qq -o -C eclipse-junit-tests-*.zip */plugins/org.eclipse.test* -d eclipse/dropins/
++    if [ ! -r eclipse ]
++    then
++        pushd @libdir@
++        tar czf /tmp/eclipse-tests-directory/eclipse-SDK-v20120903-1347-linux-gtk-x86_64.tar.gz eclipse
++        popd
++        cp -rf @libdir@/eclipse eclipse
++        unzip -o -C /usr/share/java/eclipse-tests/eclipse-junit-tests-*.zip */plugins/org.eclipse.test* -d eclipse/dropins/
+ fi
+ 
++findXvncAndSetDisplay
++setArch
++
+ # run tests
+-launcher=`ls eclipse/plugins/org.eclipse.equinox.launcher_*.jar`
+-$vmcmd -Dosgi.os=$os -Dosgi.ws=$ws -Dosgi.arch=$arch -jar $launcher -data workspace -application org.eclipse.ant.core.antRunner -file `pwd`/test.xml $tests -Dws=$ws -Dos=$os -Darch=$arch -D$installmode=true $properties -logger org.apache.tools.ant.DefaultLogger
++eclipse -nosplash -data workspace -application org.eclipse.ant.core.antRunner \
++-file "/usr/share/java/eclipse-tests/test.xml" $tests \
++-Dws=$ws -Dos=$os -Darch=$arch -Dos.arch=$arch \
++-DbuildId=v20120903-1347 -Dbasedir="/tmp/eclipse-tests-directory" \
++-DruntimeArchive="eclipse-SDK-v20120903-1347-linux-gtk-x86_64.tar.gz" \
++-DrepoLocation="/usr/share/java/eclipse-tests" \
++-Dorg.eclipse.test="3.3.100" \
++-D$installmode=true $properties -logger org.apache.tools.ant.DefaultLogger
+ 
++cleanupXvnc
+ # display message to user if os, ws and arch are invalid
+ else
+ 	echo "The os, ws and arch values are either invalid or are an invalid combination"
+ 
+ exit 1
+ fi
+-
+--- TMP/eclipse-junit-tests/src/main/scripts/test.xml.bak	2012-09-04 11:06:32.018103811 +0200
++++ TMP/eclipse-junit-tests/src/main/scripts/test.xml	2012-09-04 10:13:07.000000000 +0200
+@@ -120,7 +120,7 @@
+ 		<delete dir="${platformLocation}" />
+ 		<mkdir dir="${platformLocation}" />
+ 		<exec dir="${platformLocation}" executable="tar">
+-			<arg line="-xzf ${platformArchive}" />
++			<arg line="-xzf ../${platformArchive}" />
+ 		</exec>
+ 	</target>
+ 
diff --git a/eclipse.spec b/eclipse.spec
index 5a5b686..2486763 100644
--- a/eclipse.spec
+++ b/eclipse.spec
@@ -173,6 +173,11 @@ Patch26:        %{name}-build-network-native-libs.patch
 #https://bugs.eclipse.org/bugs/show_bug.cgi?id=385010
 Patch27:        %{name}-build-filesystem-native-libs.patch
 
+
+Patch28:        %{name}-build-help-contents.patch
+
+Patch29:        %{name}-test-support.patch
+
 BuildRequires:  ant >= 1.8.3
 BuildRequires:  rsync
 BuildRequires:  jpackage-utils >= 0:1.5, make, gcc
@@ -336,6 +341,17 @@ Obsoletes:      %{name}-pde-runtime < 1:3.3.2-20
 Eclipse Plugin Development Environment.  This package is required for
 developing Eclipse plugins.
 
+%package        tests
+Version:        %{eclipse_version}
+Summary:        Eclipse Tests
+Group:          Text Editors/Integrated Development Environments (IDE)
+Requires:       %{name}-sdk = %{epoch}:%{eclipse_version}-%{release}
+Provides:       %{name}-pde-runtime = 1:%{eclipse_version}-%{release}
+Obsoletes:      %{name}-pde-runtime < 1:3.3.2-20
+
+%description    tests
+Eclipse Tests.
+
 %prep
 
 ARCH=%{_arch}
@@ -372,6 +388,8 @@ tar --strip-components=1 -xf %{SOURCE1}
 %patch25
 %patch26
 %patch27
+%patch28
+%patch29
 
 #https://bugs.eclipse.org/bugs/show_bug.cgi?id=386040
 %pom_disable_module bundles/org.eclipse.equinox.http.jetty5 rt.equinox.bundles .
@@ -865,6 +883,26 @@ sed -i "s@/usr/share/eclipse@%{libdir}/%{name}@" $RPM_BUILD_ROOT%{_libdir}/%{nam
 mkdir $RPM_BUILD_ROOT%{_sysconfdir}/rpm/
 install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/
 
+
+
+##############
+# Tests
+##############
+
+unzip TMP/eclipse-junit-tests/target/eclipse-junit-tests-bundle.zip -d $RPM_BUILD_ROOT/%{_javadir}/eclipse-tests
+unzip $RPM_BUILD_ROOT/%{_javadir}/eclipse-tests/eclipse-junit-tests-v20120904-0831.zip -d $RPM_BUILD_ROOT/%{_javadir}/eclipse-tests/
+
+rm $RPM_BUILD_ROOT/%{_javadir}/eclipse-tests/runtests.bat
+
+sed -i -e "s#@libdir@#%{_libdir}#" $RPM_BUILD_ROOT/%{_javadir}/eclipse-tests/runtests.sh
+
+touch $RPM_BUILD_ROOT%{_bindir}/%{name}-runEclipsePackageTests
+chmod a+x  $RPM_BUILD_ROOT/%{_bindir}/%{name}-runEclipsePackageTests
+echo '#!/bin/sh' >>  $RPM_BUILD_ROOT/%{_bindir}/%{name}-runEclipsePackageTests
+echo 'echo "results in /tmp/eclipse-tests-directory/results/"' >>  $RPM_BUILD_ROOT/%{_bindir}/%{name}-runEclipsePackageTests
+echo "pushd %{_javadir}/eclipse-tests;./runtests.sh -os linux -ws gtk -arch ${ARCH} ; popd;" >>  $RPM_BUILD_ROOT/%{_bindir}/%{name}-runEclipsePackageTests
+
+
 %post platform
 touch --no-create %{_datadir}/icons/hicolor
 if [ -x /usr/bin/gtk-update-icon-cache ]; then
@@ -1136,6 +1174,10 @@ rm -rf %{_bindir}/efj/
 %{_libdir}/%{name}/buildscripts
 %{_libdir}/%{name}/dropins/sdk
 
+%files tests
+%{_bindir}/%{name}-runEclipsePackageTests
+%{_javadir}/%{name}-tests
+
 %files equinox-osgi
 %dir %{_javadir}/%{name}
 %{_javadir}/%{name}/osgi.jar
@@ -1151,6 +1193,7 @@ rm -rf %{_bindir}/efj/
 * Fri Aug 31 2012 Krzysztof Daniel <kdaniel at redhat.com> 1:4.2.0-14
 - Native network support added.
 - Native filesystem support added.
+- Added test packages.
 
 * Fri Aug 24 2012 Krzysztof Daniel <kdaniel at redhat.com> 1:4.2.0-12
 - Fix eclipse-pdebuild script to have proper path to pde bundle.


More information about the scm-commits mailing list