Closed Bug 1628074 Opened 4 years ago Closed 4 years ago

Can't run rusttests against crates that use gecko symbols

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: chutten, Assigned: glandium)

References

Details

Attachments

(1 file)

It appears as though Gecko symbols are not present in rusttests builds.

This manifests in a couple of ways, the first of which is that any rusttests build on Windows fails to run tests in Gecko-using crates because of unresolved symbols (for example, this try job and this note in stylo). This is even if the tests don't use Gecko symbols.

The fix that Stylo employed for this was to disable testing on Windows whenever Gecko isn't linked. This won't work for our purposes as quite a bit of the code we're going to want to test will use Gecko things (like nsACString). In the case of tests that actually use those symbols, all platforms of rusttests fail, not just Windows.

Is it at all possible to link these symbols in from (I have no idea) a spare libxul we have lying around?

Assignee: nobody → mh+mozilla
Status: NEW → ASSIGNED

Anything I can help with to get this started? We're about to start working on some intricate pieces and I'd love to write the tests as a go.

Flags: needinfo?(mh+mozilla)

Sorry for the late answer, I needed to dig a little more into this, which I'm glad I did, because the quick answer (the simple answer below) wouldn't have been useful.

The simple answer is you can't run rusttests with rust code that uses gecko code. The long answer is that you maybe could, if you are lucky, if you add a build.rs that builds the right pieces that you need, with the right build flags, and only when building tests.

You probably don't want to do doing rusttests, but rust gtests instead. See the various crates in toolkit/library/gtest/rust/Cargo.toml.

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Flags: needinfo?(mh+mozilla)
Resolution: --- → INVALID

I had an email exchange with chutten and it seems he didn't realize that with the GTest option you can write a Rust crate for the GTest, and that allows some more powerful things. (The documentation just added in bug 1647987 makes this clearer than it was before.)

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: