Closed Bug 350886 Opened 14 years ago Closed 13 years ago

JavaXPCOM Unit Test

Categories

(Core Graveyard :: Java to XPCOM Bridge, defect)

defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jhpedemonte, Assigned: jhpedemonte)

References

Details

(Keywords: fixed1.8.1.4)

Attachments

(2 files, 3 obsolete files)

 
Attached patch patch (obsolete) — Splinter Review
This is an attempt at a browser based JavaXPCOM unit test.  This patch creates a Java component (using Java Component Loader code from bug 299263).  The tests are run by loading the web page and clicking on the 'Run' button.
Depends on: 299263
Depends on: 351871
Attached patch patch v2 - make check (obsolete) — Splinter Review
Different approach.  This patch cleans up the existing tests and adds some new ones, which can all be run from the command line when calling 'make check'.

As before, I am using the interfaces from the XPConnect tests.  However, since the C++ component of the XPConnect tests isn't built when building XULRunner (see bug 315090), I rolled my own version in Javascript (xpctests.js).

There is one issue remaining.  The Java tests are all built against MozillaInterfaces.jar, which isn't built until the end of 'libs' step (after the Java tests have supposedly been built).  So I need to find a clever way to build the Java tests after MozillaInterfaces.jar has been built.
Attachment #236251 - Attachment is obsolete: true
Depends on: 367792
No longer depends on: 299263
Depends on: 367793
Attached patch patch v2.1 - make check (obsolete) — Splinter Review
This patch rearranges how JavaXPCOM is built.  Currently, the main make call to JavaXPCOM happens in tier_toolkit.  This results in building the JNI code (which gets linked in to libXUL) and the glue code.  Later, there is a special call to extensions/java/xpcom/interfaces in tier_app (for XULRunner) to build MozillaInterfaces.jar.  This setup isn't very good since it requires special rules in order to build any other Java code that depends on MozillaInterfaces.jar.

This patch moves the main make call to JavaXPCOM to the tier_app XULRunner group.  Since this is the last tier, MozillaInterfaces.jar can be built during the 'libs' stage in order to pick up all of the interfaces.  Then any Java code depending on MozillaInterfaces.jar is built during the same 'libs' stage.

The only special case that needs to be handled is the JNI code.  Since it is linked into libXUL, it needs to be built before the call to build libXUL.  So there is a line in tier_toolkit to make in extensions/java/xpcom/src.

Benjamin, can you review the Makefile changes?
Attachment #252381 - Attachment is obsolete: true
Attachment #253345 - Flags: review?(benjamin)
Properly handle "install" make target.
Attachment #253345 - Attachment is obsolete: true
Attachment #254381 - Flags: review?(benjamin)
Attachment #253345 - Flags: review?(benjamin)
Duplicate of this bug: 369397
Comment on attachment 254381 [details] [diff] [review]
patch v2.2 - make check

>Index: extensions/java/xpcom/Makefile.in

>+# Build the implementation Java classes
>+libs::
>+	make -C src jar-libs
>+install::
>+	make -C src jar-install

Please add a line of whitespace between rules.
Attachment #254381 - Flags: review?(benjamin) → review+
Since I am making a change to nsIXPCTestIn interface (fixing a method declaration), do I need to change the IID?
In general, yes.
Checked in to trunk.  -> FIXED
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
This is the 1.8.1 branch version of the makefile reorg changes from the trunk patch.  XULRunner only.
Attachment #257077 - Flags: approval1.8.1.3?
This caused a build failure on the FF+XR tinderbox (the only one with --enable-tests):
d:/builds/tinderbox/Fx-XR/WINNT_5.2_Depend/mozilla/extensions/java/xpcom/tests/testparams/TestParams.java:64: warning: unmappable character for encoding Cp1252
	   "Non-Ascii 1 byte chars: Ž‰ŠˆŒ?, 2 byte chars: \u1234 \u1235 \u1236";

See http://tinderbox.mozilla.org/showlog.cgi?log=MozillaExperimental/1173081480.1173084330.23199.gz&fulltext=1
Actually, there error is that it cannot find LocationProvider.java.  Seems that this bit of the command is failing:

-sourcepath ".;/cygdrive/d/builds/tinderbox/Fx-XR/WINNT_5.2_Depend/mozilla/extensions/java/xpcom/tests/testparams;/cygdrive/d/builds/tinderbox/Fx-XR/WINNT_5.2_Depend/mozilla/extensions/java/xpcom/tests/testparams/.."

I know that 'javac' is sensitive to windows build paths.  The command is called using 'cygwin-wrapper', so I assume that is replacing the 'cygdrive' instances.  Plus, why is this failing for this build, but not for the standalone XULRunner?

I don't have cygwin installed any more, but I did try to reproduce using Benjamin's new Windows tools (MSYS).  This build failed in mozilla/extensions/java/xpcom/interfaces, for what seems to be a similar issue.  The '-sourcepath' flag arguments have MSYS style paths (i.e. "/e/builds/trunk/...").  When I manually edited this to start with "e:/builds/...", then 'javac' completed just fine.

Really not sure what is going on.
(In reply to comment #12)
> Actually, there error is that it cannot find LocationProvider.java.  Seems that
> this bit of the command is failing:
> 
> -sourcepath
> ".;/cygdrive/d/builds/tinderbox/Fx-XR/WINNT_5.2_Depend/mozilla/extensions/java/xpcom/tests/testparams;/cygdrive/d/builds/tinderbox/Fx-XR/WINNT_5.2_Depend/mozilla/extensions/java/xpcom/tests/testparams/.."

The problem is that both the cygwin wrapper and the msys magic /c/path know how to convert standalone arguments, but they don't know how to convert an argument with semicolons.

>  Plus, why is this failing for this build, but not for the standalone
> XULRunner?

The main build has --disable-tests
Moving Cygwin/MSYS build break discussion to already existing bug 363485.
Comment on attachment 257077 [details] [diff] [review]
1.8.1 patch - makefile changes

approved for 1.8.1.4, a=dveditz for release-drivers
Attachment #257077 - Flags: approval1.8.1.4? → approval1.8.1.4+
Makefile changes checked in to MOZILLA_1_8_BRANCH.
Keywords: fixed1.8.1.4
Comment on attachment 257077 [details] [diff] [review]
1.8.1 patch - makefile changes

>+jar-install:: $(JARFILE)
>+	$(SYSINSTALL) $(IFLAGS2) $(JARFILE) $(DESTDIR)$(mozappdir)

This should be IFLAGS1, not IFLAGS2.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.