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.
Unit test are not working on Mac OS X. According to Tomas and Honza it is caused by javac bundled in rt.jar on Mac JDK. Test infrastructure should take care about this (see also build.xml of java/source module).
I forgot to mention important thing: it is specially for unit tests using Retouche.
Created attachment 39302 [details] Simple ugly local workaround for test-single target
Thanks a lot for your patch. The boot.classpath initialization can be moved to test-init target. The changes have to be applied also to ant scripts of xtest. Jesse what do you think about modification in common.xml for test run on Mac OS X?
The patch is very primitive, path to Classes/*.jar is already defined somewhere probably.
Maybe there could be a property test.unit.bootcp.extra defined in appropriate projects. I would prefer to avoid hardcoding JARs as in the current patch.
> I would prefer to avoid hardcoding JARs as in the current patch. Definitely. My patch is just simple workaround to get things working quickly. > Maybe there could be a property test.unit.bootcp.extra defined in appropriate projects Problem is related to OS platform, not the project. I don't know what will be the definite fix, but if there will be somewhere switch 'IF OSX THEN boot_cp=...', the property should reflect that somehow: test.unit.osx.bootcp.extra ?
>Problem is related to OS platform, not the project. I don't know what will be >the definite fix, but if there will be somewhere switch 'IF OSX THEN >boot_cp=...', the property should reflect that somehow: >test.unit.osx.bootcp.extra ? It becomes to be quite complicated. The same property have to be propagated to xtest. It works on all platforms if you add these items ${nb_all}/java/external/javac-api.jar" ${nb_all}/java/external/javac-impl.jar" before default boot classpath, isn't it. We can use test.unit.bootcp.extra for all platforms.
Sure. If Tomas and Honza don't have any objections, I am fine with that.
For example I tried to modify bootclasspath for my Linux. <junit showoutput="true" fork="true" failureproperty="tests.failed" errorproperty="tests.failed" filtertrace="${test.filter.trace}" tempdir="${build.test.unit.results.dir}"> <batchtest todir="${build.test.unit.results.dir}"> <fileset dir="${build.test.unit.classes.dir}"> <include name="**/*Test.class"/> </fileset> </batchtest> <bootclasspath> <pathelement path="${java.home}/jre/lib/rt.jar"/> <pathelement path="${nb_all}/java/external/javac-api.jar"/> <pathelement path="${nb_all}/java/external/javac-impl.jar"/> </bootclasspath> <classpath refid="test.unit.run.cp"/> <syspropertyset refid="test.unit.properties"/> <jvmarg value="-ea"/> <formatter type="brief" usefile="false"/> <formatter type="xml"/> </junit> It throws NPE : java/lang/NoClassDefFoundError: java/lang/Object I am not feeling comfortable to fix this issue.
Since I have no Mac machine to test on, I do not plan to touch this. If someone else wants to propose a patch, I will review it.
I will try to borrow some Mac and create a patch.
P3, future for now.
Can't we do something like this: <condition property="isMacOX"> <and> <os family="mac"/> <os family="unix"/> </and> </condition> ... <path id="additional.mac.cp"> <pathelement path="${nb_all}/libs.javacapi/external/javac-api-nb-7.0-b07.jar"/> <pathelement path="${nb_all}/libs.javacimpl/external/javac-impl-nb-7.0-b07.jar"/> <pathelement path="/System/Library/Frameworks/JavaVM.framework/Classes/classes.jar"/> <pathelement path="/System/Library/Frameworks/JavaVM.framework/Classes/laf.jar"/> <pathelement path="/System/Library/Frameworks/JavaVM.framework/Classes/ui.jar"/> </path> ... And and in the tasks/macros based on the condition: <bootclasspath refid="additional.mac.cp"/>
Here's a new version of the patch - alas it still has to be applied manually, since conditionals are only allowed on targets in ant but not on path's.
Created attachment 63946 [details] Refined patch, including debugging support.
*** Issue 148009 has been marked as a duplicate of this issue. ***
*** Issue 159658 has been marked as a duplicate of this issue. ***
Upgrading to priority of a duplicate. Reassigning to me.
Created attachment 78570 [details] platform-independent fix, including debugging support
Here's a patch, it's rather complicated because of ant restrictions. In case there will be no objections, I'll do some testing and integrate it next week.
Do not modify semantics of common.xml for something that is specific to a handful of nb.org modules. Patch looks much too complicated to me. Would seem to be much easier to always define bootpath.prepend, but conditionally set it to a real value if=is.mac (otherwise to ""). You can use <pathconvert> to define it as a fileset so you can use wildcards rather than hardcoding version numbers in JAR names. In fact the <path> named javacimpl in projectized.xml may be all you need (this is OpenJDK 6 but probably fine). @{disable.apple.ui} is a macro param and will not be propagated thru <antcall> I think. In sum, I would recommend having common.xml just look for ${bootclasspath.mac} with a fallback value of "", and in projectized.xml something like: <condition name="bootclasspath.mac" refid="javacimpl"> <os family="mac"/> </> Richard should approve any patch in this area. I would also be more comfortable with an optional new property that would be defined only in selected projects which are known to make use of java.source classes, rather than modifying the behavior of all module projects, including the great majority which are fine as they are.
Thanks for your comments, Jesse. Empty bootclasspath for other platforms sounds as best solution.
I've prepared a new patch (mac-tests-v2.diff). > In fact the <path> named javacimpl in projectized.xml may be all you need (this is OpenJDK 6 but probably fine). This does not suffice, a reference to our javac jars has to be created (in projectized.xml, see diff). Models requiring out javac have to define something like <target name="test-preinit" depends="init"> <property name="requires.nb.javac" value=""/> </target> in their build scripts from now on, is that what you mean? I've tested this on Mac and Linux and haven't encountered any problems. Jesse or Richard, could you please make another review? Thank you very much.
Created attachment 78723 [details] another patch file
bootclasspath.mac has to be defaulted to "" in common.xml or you will cause a mess for external modules. requires.nb.javac should be set to true or false, not the empty string. (Use <istrue>.) And when set, it should be defined in project.properties, not the build script. Delete the extra <echo>. <path id="retouche.javac">...</><pathconvert property="retouche.javac" refid="retouche.javac"/> could be simplified to either <pathconvert property="retouche.javac">...</> or <path id="retouche.javac">...</><property name="retouche.javac" refid="retouche.javac"/>. I am concerned about the addition of a new <bootclasspath> to <junit>. If ${nbjdk.bootclasspath} was not quite precise, this could affect test runs for unrelated modules. Would prefer use of -Xbootclasspath/p with just ${bootclasspath.mac} if that is possible.
Created attachment 78814 [details] patch
I've made requested changes. -Xbootclasspath/p works OK, thanks for all you hints Jesse.
bootclasspath.mac may need to be defaulted before test-init, since the <javac> presetdef is used for non-test compilation too. Otherwise the unevaluated string "${bootclasspath.mac}" will be included in <javac>'s bootcp, which might cause some kind of issue. On non-Macs, does passing "-Xbootclasspath/p:" (empty) cause any harm? Doesn't seem to hurt anything on Linux.
Created attachment 78894 [details] patch
Hopefully final patch version. ${bootclasspath.mac} is initialized in projectized.xml's build-init, with fallback to "" using ant condition "else" parameter.
*** Issue 161172 has been marked as a duplicate of this issue. ***
Raising to P1 because it was resolved duplicate to #161172
The last patch will leave the property unset, hence using the literal value "${bootclasspath.mac}", for external modules. You could default it to "" in apisupport.harness/release/build.xml but this poses potential version skew issues. I would rather suggest getting rid of the 'else' clause and instead just add <property name="bootclasspath.mac" value=""/> to common.xml#-javac-init.
This surely cannot be a P1 if it slipped two releases as a P3...
> I would rather suggest getting rid of the 'else' clause and instead just add > <property name="bootclasspath.mac" value=""/> > to common.xml#-javac-init. Done, thanks. Will be part of my next push as soon as M3 cloning will be finished.
http://hg.netbeans.org/jet-main/rev/db7e8e910073 http://hg.netbeans.org/jet-main/rev/b8c336505dce Fixed.
Integrated into 'main-golden', will be available in build *200903281400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/db7e8e910073 User: Max Sauer <msauer@netbeans.org> Log: #97290: Unit tests using Retouche not working on Mac OS X
Integrated into 'main-golden', will be available in build *200907090200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/0311cf96ed75 User: Jesse Glick <jglick@netbeans.org> Log: #97290 is already applied.