Closed Bug 427286 Opened 16 years ago Closed 16 years ago

add xpcshell-based unit test framework for js-ctypes

Categories

(Core :: js-ctypes, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: nossralf, Assigned: nossralf)

Details

Attachments

(1 file, 1 obsolete file)

We need a unit test framework for js-ctypes since it's something that is supposed to "just work". It's still early in the development cycle, so adding it now will make future development easier since it can be test-driven.
Attached patch unit test framework WIP (obsolete) — Splinter Review
This is a start. It adds a tests/ directory in the root of the js-ctypes directory structure which there are a couple of things:

* unit/ 
A directory for unit tests, the same old story.

* libtest/
A directory in which there is an implementation of a shared library (js-ctypes-test) that's used by the unit tests. It's very bare at the moment, but the mechanics work; when it's built it's copied to dist/lib and dist/bin where it's (supposedly) always visible in the system's library path. (Relies on stuff defined in nscore.h, so xpcom is a dependency. Exported functions have to be visible, unless they're NS_EXPORT'ed they're hidden in the DLL.)

Note: DLL naming is different on Win and Linux at least (the OS X name is either the same as on Linux or a separate case). The unit test must open the library with a platform-specific name. In this WIP it only opens libjs-ctypes-test.so.
Assignee: nobody → nossralf
Status: NEW → ASSIGNED
OK, that's testlib/ not libtest/. Meh.
This is functionally the same, but I renamed everything called testlib to js-ctypes-test since that makes more sense.
Attachment #313838 - Attachment is obsolete: true
Comment on attachment 313841 [details] [diff] [review]
same WIP with a couple of renames

I had to tweak the makefile a bit and correct the the calls in the JS test file (call type is before return type). I also added a bit of code to the test JS file to handle library naming conventions of different platforms.

Works great - thanks
Attachment #313841 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Cool, yeah, I forgot to update the patch with the proper declare() order.

Also, I have it in extensions/js-ctypes which probably isn't the intended location. (Should it be under modules/ or where do you keep it in your tree? I never did quite get that bit.)
(In reply to comment #5)

> Also, I have it in extensions/js-ctypes which probably isn't the intended
> location. (Should it be under modules/ or where do you keep it in your tree? I
> never did quite get that bit.)
> 

I just changed the makefiles to work from the toolkit/components/js-ctypes location. Since I hope to get js-ctypes in the tree, that seemed like a good location.
(In reply to comment #6)
> I just changed the makefiles to work from the toolkit/components/js-ctypes
> location. Since I hope to get js-ctypes in the tree, that seemed like a good
> location.

Makes sense.
Product: Other Applications → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: