This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 205033 - Test error/failure in editor.bracesmatching module
Summary: Test error/failure in editor.bracesmatching module
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 7.1
Hardware: PC Linux
: P2 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-12 17:50 UTC by tomwheeler
Modified: 2011-11-18 15:44 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tomwheeler 2011-11-12 17:50:26 UTC
While testing a patch submitted by Maxim Shekhovets for the First Patch program, I found that the unit tests currently in the editor.bracesmatching module do not pass.  This is using the tip on core-main and is before applying any patch to the source.  I have further found that these tests aren't being run on Hudson, so you may not be aware of these failures.

There are two problems with unit tests in the editor.bracesmatching module.  

#1: Simply trying to run the Ant "test" target in that module fails with the following error:

Null Test: 	Caused an ERROR
org/netbeans/insane/scanner/Filter
java.lang.NoClassDefFoundError: org/netbeans/insane/scanner/Filter
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
Caused by: java.lang.ClassNotFoundException: org.netbeans.insane.scanner.Filter

This is easily corrected by adding INSANE (a non-API module) to the list of unit test dependencies.

#2: Once #1 is corrected, trying to run the 

Testsuite: org.netbeans.modules.editor.bracesmatching.MasterMatcherTest
Tests run: 4, Failures: 1, Errors: 0, Time elapsed: 11.47 sec

Testcase: testThreadResultsGCed(org.netbeans.modules.editor.bracesmatching.MasterMatcherTest):	FAILED
There should be no highlights
junit.framework.AssertionFailedError: There should be no highlights
	at org.netbeans.modules.editor.bracesmatching.MasterMatcherTest.testBlockingByForLoop(MasterMatcherTest.java:195)
	at org.netbeans.modules.editor.bracesmatching.MasterMatcherTest.testThreadResultsGCed(MasterMatcherTest.java:204)
	at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:99)
	at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:405)
	at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:331)
	at java.lang.Thread.run(Thread.java:662)

Unfortunately, I do not know enough about the editor infrastructure to fix this problem.  I can tell you that it seems to fail 100% of the time on Linux, but for some reason seems to pass on Windows XP in ~ 10% of cases.

As far as I can tell, the unit tests for editor.bracesmatching module are not even being run in continuous integration:

  http://deadlock.netbeans.org/hudson/job/NB-Core-Build/7485/testReport/?

I don't know whether they're not being run because they are known to fail, or whether you don't know they fail because they aren't being run.
Comment 1 tomwheeler 2011-11-12 19:21:24 UTC
Further testing shows that the intermittent passes happen on Linux too, not just Windows.  Here is an excerpt from a session in which the "ant test" in editor.bracesmatching failed, then the same command passed when run immediately afterwards.  Tests with Thread.sleep statements like these are always suspect.


$ ant test 

...

test-unit:
    [junit] Testsuite: org.netbeans.modules.editor.bracesmatching.MasterMatcherTest
    [junit] Tests run: 5, Failures: 1, Errors: 0, Time elapsed: 12.383 sec
    [junit] 
    [junit] Testcase: testThreadResultsGCed(org.netbeans.modules.editor.bracesmatching.MasterMatcherTest):	FAILED
    [junit] There should be no highlights
    [junit] junit.framework.AssertionFailedError: There should be no highlights
    [junit] 	at org.netbeans.modules.editor.bracesmatching.MasterMatcherTest.testBlockingByForLoop(MasterMatcherTest.java:240)
    [junit] 	at org.netbeans.modules.editor.bracesmatching.MasterMatcherTest.testThreadResultsGCed(MasterMatcherTest.java:249)
    [junit] 	at org.netbeans.junit.NbTestCase.access$200(NbTestCase.java:99)
    [junit] 	at org.netbeans.junit.NbTestCase$2.doSomething(NbTestCase.java:405)
    [junit] 	at org.netbeans.junit.NbTestCase$1Guard.run(NbTestCase.java:331)
    [junit] 	at java.lang.Thread.run(Thread.java:662)
    [junit] 
    [junit] 
    [junit] Test org.netbeans.modules.editor.bracesmatching.MasterMatcherTest FAILED

BUILD FAILED
Total time: 15 seconds

$ ant test



...

test-unit:
    [junit] Testsuite: org.netbeans.modules.editor.bracesmatching.MasterMatcherTest
    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 13.34 sec
    [junit] 

...

BUILD SUCCESSFUL
Total time: 16 seconds
Comment 2 Svata Dedic 2011-11-15 12:37:13 UTC
Changeset: 6f7937bdaa49
Author:    Svata Dedic <sdedic@netbeans.org>
Date:      2011-11-15 13:37
Message:   #205033: fixed race conditions in test, added INSANE dependency
Issue #205033 - Test error/failure in editor.bracesmatching module: fixed
Comment 3 Quality Engineering 2011-11-16 15:49:15 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/6f7937bdaa49
User: Svata Dedic <sdedic@netbeans.org>
Log: #205033: fixed race conditions in test, added INSANE dependency
Issue #205033 - Test error/failure in editor.bracesmatching module: fixed
Comment 4 tomwheeler 2011-11-16 18:23:27 UTC
I just checked Hudson on deadlock:

   http://deadlock.netbeans.org/hudson/job/NB-Core-Build/7501/testReport/

and it still doesn't look like the tests in the editor.bracesmatching module are being run during build jobs.  I would think that since this module has tests, they ought to get run with every build as they do for every other module.
Comment 5 Jan Lahoda 2011-11-16 18:58:55 UTC
The tests shouldn't most likely be run for in the core-main builder, but rather on the jet-main builder, as the module belong to jet-main's "jurisdiction". (there are a lot of editor and Java tests that are not run by the core-main builder, so I see no reason why tests for this particular module should). I will add the module to the list in jet-main builder in a few days, after 7.1 is branched.

http://bertram2.netbeans.org:8080/job/jet-main/
Comment 6 Quality Engineering 2011-11-18 15:44:06 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/7d4b67a0cb96
User: Jesse Glick <jglick@netbeans.org>
Log: Fix of #205033 made project.xml invalid according to schema, resulting in console warnings when scanning module list.
Next time use Alt-Shift-F9 to validate changes to XML, or simply use the GUI under Test Libraries.