Bug 488036 - Lots of failures and erros when running PDE UI tests on Hudson Gerrit
Summary: Lots of failures and erros when running PDE UI tests on Hudson Gerrit
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: 4.6 M7   Edit
Assignee: Vikas Chandra CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 468461
Blocks:
  Show dependency tree
 
Reported: 2016-02-18 10:13 EST by Dani Megert CLA
Modified: 2018-07-17 08:09 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2016-02-18 10:13:39 EST
Hudson Gerrit build reports 73 test failures
Comment 1 Dani Megert CLA 2016-02-19 03:37:11 EST
(In reply to Dani Megert from comment #0)
> Hudson Gerrit build reports 73 test failures

Those were fom API Tools.

For the pde.ui.tests we get 137 failures, see
https://hudson.eclipse.org/platform/job/eclipse.pde.ui-Gerrit/981/testReport/


Vikas, the first step is to enable the pde.ui.tests. You can do this in
org.eclipse.pde.ui.tests/pom.xml by just changing the test class (see comment in the file itself.

Then you can push this to Gerrit and should run all tests and show you the failures that need to be addressed. I assume most are setup/dependency problems as already mentioned in bug 468461.
Comment 2 Vikas Chandra CLA 2016-02-23 04:28:21 EST
Made this gerrit patch to fix issues in pde.ui tests

https://git.eclipse.org/r/67118
Comment 3 Elena Laskavaia CLA 2016-02-23 19:48:56 EST
Guys you need help with this?
Comment 4 Vikas Chandra CLA 2016-02-24 00:54:21 EST
The 1st test that fails in the log is

testStateEEProperties(org.eclipse.pde.ui.tests.target.TargetEnvironmentTestCase)  Time elapsed: 0.024 sec  <<< ERROR!
java.lang.NullPointerException: null
	at org.eclipse.pde.internal.core.TargetPlatformHelper.getState(TargetPlatformHelper.java:465)
	at org.eclipse.pde.ui.tests.target.TargetEnvironmentTestCase.testStateEEProperties(TargetEnvironmentTestCase.java:80)


Looks like fState in PluginModelManager is not initialised. So changing the settings of 
	private static boolean DEBUG = true;
	public static boolean DEBUG_CLASSPATH = true;
	public static boolean DEBUG_MODEL = true;
	public static boolean DEBUG_TARGET_PROFILE = true;
	public static boolean DEBUG_VALIDATION = true;

for more information on hudson build result page.
Comment 5 Eclipse Genie CLA 2016-02-24 01:16:01 EST
New Gerrit change created: https://git.eclipse.org/r/67199
Comment 6 Dani Megert CLA 2016-02-24 05:28:50 EST
(In reply to Elena Laskavaia from comment #3)
> Guys you need help with this?

Sure. Any help is welcome (please coordinate with Vikas). Known issues for the failures/errors are usually:
- missing dependencies
- tests set system properties (in test.xml and launch config) which are not
  set when run by Hudson
- test sequence
Comment 7 Eclipse Genie CLA 2016-02-26 00:06:12 EST
New Gerrit change created: https://git.eclipse.org/r/67390
Comment 8 Vikas Chandra CLA 2016-02-26 01:31:21 EST
With the new gerrit patch i can get log statements ( thanks David ). Also for some reason when I ammend old gerrit patch, it creates a new one ( need to fix this issue at my end).

However, there are some obvious log statements that I missed last time. Fixing these 2 will reduce the test errors for sure. ( from 137 to hopefully 0 :) )

1)

!MESSAGE The Plug-in Development Environment requires the PlatformAdmin service to operate. Please install the compatibility fragment 'org.eclipse.osgi.compatibility.state'.

2)
!MESSAGE Plug-in at '/jobs/genie.platform/eclipse.pde.ui-Gerrit/workspace_2/ui/org.eclipse.pde.ui.tests/target/work/data/.metadata/.plugins/org.eclipse.pde.ui.tests/classic/eclipse/plugins/org.eclipse.help.ui_3.0.2' does not have an OSGi bundle manifest. To use a 2.0 style plug-in you must install the plug-in converter service. Go to Help > Install New Software and install 'Eclipse 2.0 Style Plugin Support' from 'The Eclipse Project Updates' software site.
Comment 9 Vikas Chandra CLA 2016-02-26 01:32:24 EST
David, can you please look at previous comment and tell us how to install those 2 components before running the test cases.
Comment 10 Dani Megert CLA 2016-02-26 03:20:49 EST
(In reply to Vikas Chandra from comment #9)
> David, can you please look at previous comment and tell us how to install
> those 2 components before running the test cases.

Try to add it as dependency in the pom.xml. For an example see
http://git.eclipse.org/c/platform/eclipse.platform.text.git/plain/org.eclipse.ui.editors.tests/pom.xml
Comment 11 David Williams CLA 2016-02-26 08:52:46 EST
(In reply to Dani Megert from comment #10)
> (In reply to Vikas Chandra from comment #9)
> > David, can you please look at previous comment and tell us how to install
> > those 2 components before running the test cases.
> 
> Try to add it as dependency in the pom.xml. For an example see
> http://git.eclipse.org/c/platform/eclipse.platform.text.git/plain/org.
> eclipse.ui.editors.tests/pom.xml

And, if it helps, the "Eclipse 2.0 Style Plugin Support" mentioned in the second message has an IU id of org.eclipse.osgi.compatibility.plugins.feature.feature.group
Comment 12 Vikas Chandra CLA 2016-02-27 00:19:19 EST
https://hudson.eclipse.org/platform/job/eclipse.pde.ui-Gerrit/1027/ has 56 failures whereas 1024 has 137 failures. ( in theory looks like some improvement but cant be sure actually)

However there are new types of error log. However the testcase I was targeting looks fixed  (TargetEnvironmentTestCase.testStateEEProperties).

Next step, I will add "Eclipse 2.0 Style Plugin Support" ( thanks David for the id).

Once I get result for that, I will investigate the pending failures ( if any).
Comment 13 Vikas Chandra CLA 2016-02-27 01:09:59 EST
The logs in latest result says

[ERROR] Cannot resolve project dependencies:
[ERROR]   You requested to install 'bundle org.eclipse.osgi.compatibility.plugins.feature.feature.group 0.0.0' but it could not be found

If id is correct, probably the type is different.
Comment 14 David Williams CLA 2016-02-27 02:00:05 EST
(In reply to Vikas Chandra from comment #13)
> The logs in latest result says
> 
> [ERROR] Cannot resolve project dependencies:
> [ERROR]   You requested to install 'bundle
> org.eclipse.osgi.compatibility.plugins.feature.feature.group 0.0.0' but it
> could not be found
> 
> If id is correct, probably the type is different.

It is an eclipse-feature. But the feature consists of exactly one bundle -- guess what it's name is? :) It is org.eclipse.osgi.compatibility.plugins. 

[Do these tests run in your workspace? You'd have to install that bundle/feature from a repository since it is not part of our SDK.]

So, I would first try changing the type to eclipse-feature or change the id to the bundle: org.eclipse.osgi.compatibility.plugins. 

There is still a chance it may fail in a similar way even after that change. The reason is that normally the org.eclipse.osgi.compatibility.plugins is built very close to the end, after pde.core (where are these tests?).  I do not know if specification in the surefire section is enough to change build-order. If not, then I'll give you some secret sauce to control build order.
Comment 15 David Williams CLA 2016-02-27 02:13:59 EST
(In reply to David Williams from comment #14)
> ... If not, then I'll give you some secret sauce to control build
> order.

Well, here's the secret sauce up front. Given at least one other bundle found it necessary, I suspect you will too. 

See http://git.eclipse.org/c/platform/eclipse.platform.resources.git/tree/tests/org.eclipse.core.tests.resources/pom.xml#n31

The first section controls "build order" (only required when there is no other dependency that exists between manifests.mf files. 

  <plugin>
  <groupId>org.eclipse.tycho</groupId>  
  <artifactId>target-platform-configuration</artifactId>
  <version>${tycho.version}</version>
  <configuration>
  <dependency-resolution>
  <extraRequirements>
  <requirement>
  <versionRange>0.0.0</versionRange>
  <type>eclipse-feature</type>
  <id>org.eclipse.core.tests.filesystem.feature</id>
  ....
  
And this section section says to use that same think in sure fire. 

 <plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>tycho-surefire-plugin</artifactId>
  <version>${tycho.version}</version>
  <configuration>
  <useUIHarness>false</useUIHarness>
   <useUIThread>false</useUIThread>
   <dependencies>
   <dependency>
   <artifactId>org.eclipse.core.tests.filesystem.feature</artifactId>
   <type>eclipse-feature</type>
   </dependency>
   ....

HTH
Comment 16 Vikas Chandra CLA 2016-02-27 02:15:42 EST
David, I had already changed the type to eclipse feature but it now fails with 

]   You requested to install 'org.eclipse.osgi.compatibility.plugins.feature.feature.group.feature.group 0.0.0' but it could not be found


May be I need to strip the id to org.eclipse.osgi.compatibility.plugins.feature

Doing this and running another build.


Let me try this before going for the secret sauce :-)
Comment 17 Eclipse Genie CLA 2016-03-03 04:14:36 EST
New Gerrit change created: https://git.eclipse.org/r/67729
Comment 18 Vikas Chandra CLA 2016-03-03 04:20:37 EST
Looks like some issues with my gerrit setting that is either creating a new branch or a new gerrit patch when I amend my previous gerrit patch. I am working on this.
Comment 19 Vikas Chandra CLA 2016-03-03 06:20:15 EST
created Bug 488931  for deletion of other branches. Henceforth will work with commit 67729
Comment 20 Vikas Chandra CLA 2016-03-14 04:07:54 EDT
From  the debug statement, I found out that 

install location of eclipse is /jobs/genie.platform/eclipse.pde.ui-Gerrit/workspace/ui/org.eclipse.pde.ui.tests/target/work 

default location --Location location = Platform.getInstallLocation();

And there are only 2 plugins there 

org.eclipse.pde.build_3.9.200.N20160312-1500
pdebuild.jar
.....
customTargets.xml
packager.properties
org.eclipse.jdt.debug_3.10.0.N20160312-1500

In my local setup, I get 400+ plugins..


David, any idea what is going on here?
Comment 21 Vikas Chandra CLA 2016-03-14 04:13:27 EDT
This is for debugging LocalTargetDefinitionTests::testMissingVersionRestrictedDefaultTargetPlatform
Comment 22 Eclipse Genie CLA 2016-04-04 05:11:53 EDT
New Gerrit change created: https://git.eclipse.org/r/69810
Comment 23 Eclipse Genie CLA 2016-04-04 08:47:00 EDT
New Gerrit change created: https://git.eclipse.org/r/69822
Comment 24 Vikas Chandra CLA 2016-04-04 08:56:39 EDT
Debug code for nightly test results to compare  the result with the one on hudson gerrit build.

http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=1a41583c0bb2c6b6b37644bb684c1672aff29a47

I checked with other tests also. Most of all ( if not all) are because of comment#20.

They are 56 failing tests. I think disabling them will defeat the purpose of hudson gerrit build as plugin state tests are very important and on hudson gerrit, they wont be tested at all. Once failures fall below 10, then we can probably think of disabling them ( only on hudson gerrit).
Comment 25 Vikas Chandra CLA 2016-04-04 08:58:08 EDT
Working on https://git.eclipse.org/r/69810 and abandoning https://git.eclipse.org/r/69822
Comment 26 Vikas Chandra CLA 2016-04-05 03:01:23 EDT
On nightly test results

container for testMissingVersionRestrictedDefaultTargetPlatform=Installation /opt/users/genie.shared/workspace/ep46N-unit-lin64/workarea/N20160404-2000/eclipse-testing/test-eclipse/eclipse Default Configuration

And at that location, all relevant eclipse plugins and jars are present  unlike comment#20

I will revert commit of comment#24 later today
Comment 28 David Williams CLA 2016-04-05 09:18:48 EDT
(In reply to Vikas Chandra from comment #26)
> On nightly test results
> 
> container for testMissingVersionRestrictedDefaultTargetPlatform=Installation
> /opt/users/genie.shared/workspace/ep46N-unit-lin64/workarea/N20160404-2000/
> eclipse-testing/test-eclipse/eclipse Default Configuration
> 
> And at that location, all relevant eclipse plugins and jars are present 
> unlike comment#20

All I know is that in Eclipse Test Framework (used for our "production builds and tests") We install the whole SDK, then install the tests (and occasionally a few other things) and then run the tests. So all tests have the "whole SDK" present. 

In sure-fire (on Hudson/Gerrit) I believe it installs "the minimum amount of bundles necessary" -- usually based on "manifest.mf", a few others always required, and some people have to specify extra dependencies in pom, in sure-fire configuration. BUT, I do not think you could install "the whole SDK" as a dependency. If you tried, it would basically try to build everything else before building your bundle (conceptually). But, you could probably install/required "equinox runtime" if that's enough. 

It *might* also interact with "BREE". Not sure if you set the VM for sure-fire, but if not, then I think it tries to use the VM based on the BREE of the bundle you are building (which would "rule out" any prereqs that required a higher BREE). 

Oh, nm about BREE. I see that "useJDK" assumes "SYSTEM" by default. (So, as long as you don't change that, the Gerrit/Hudson jobs I'm sure are using Java 8). 

There sure are a lot of options for sure-fire, see 
https://eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html

Not sure if you can find what you need .. or, if not possible to do the type of test you are trying to do.
Comment 29 Vikas Chandra CLA 2016-04-07 05:27:27 EDT
changed test case here

http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=958938ffdd53f4e377db2da31650e2a59d5413db


It tests exactly the same thing as before but now will work on hudson gerrit.
Comment 30 Vikas Chandra CLA 2016-04-07 08:59:07 EDT
I think the best way forward is to run those tests on hudson gerrit that don't require the whole plugin model registry.

I have updated the code here https://git.eclipse.org/r/69810

AllImportTests, ExportBundleTests, ClasspathContributorTest, LocalTargetDefinitionTests , WorkspaceTargetDefinitionTests test and few more tests wont run at hudson gerrit. But rest of the tests
which is > 80% of the total test cases will run.

That will help us spotting issues like bug 477909 earlier than now.


However this patch needs lot of cleanup ( in removing debug code and also renaming files to a better name). But this is the approach I am going to take on this one.

If someone has a better approach, please let me know.
Comment 31 Vikas Chandra CLA 2016-04-12 05:34:54 EDT
https://git.eclipse.org/r/#/c/69810/14 is my proposed patch for this issue.
Comment 33 Vikas Chandra CLA 2016-04-15 05:24:28 EDT
Resolved via comment in previous commit. ( see comment#30 for details)
Comment 34 Vikas Chandra CLA 2016-04-19 05:49:56 EDT
https://hudson.eclipse.org/platform/job/eclipse.pde.ui-Gerrit/1192/

436 tests run with any pde.ui gerrit change