Glean Team here. Can confirm that libxul-provided symbols aren't in
rusttests builds at present (Rust stuff is built first then wrapped in the
loving embrace of libxul). We do write rusttests in our crates that
(currently) have no Gecko symbols (see toolkit/components/glean/api/), but
have ended up having to rely on GTest to execute our one-and-only FFI
entrypoint (see toolkit/components/glean/gtest/). This leaves us with a
hole in our testing capabilities for everything in a crate that has Gecko
symbols that isn't reachable from FFI.

:glandium (+Cc) tells us that it might be possible to fix this by using
build.rs to build the parts of Gecko needed for tests[1], but that's both
beyond my current knowledge (am a Rust neophyte) and outside my current
focus (gotta bring Glean to Firefox) so that's as far as I've gotten.

A specific wrinkle you may run across is that tests written for crates that
use Gecko symbols _can_ run rusttests so long as the tests don't exercise
any code that needs Gecko symbols... But Only On Not-Windows. On Windows
any crate with Gecko symbols will fail to link in the rusttests config.
Stylo gets around this by disabling their tests on Windows[2], so if you
want to use rusttests to cover your non-Gecko-needing pieces of your
Gecko-symbol-having crates, maybe that'll help.

Hope this helps!

:chutten

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1628074#c2
[2]:
https://searchfox.org/mozilla-central/rev/4d2a9d5dc8f0e65807ee66e2b04c64596c643b7a/servo/ports/geckolib/tests/lib.rs#5-12

On Tue, May 12, 2020 at 6:00 AM James Graham <ja...@hoppipolla.co.uk> wrote:

> On 11/05/2020 23:54, Mike Hommey wrote:
> > On Mon, May 11, 2020 at 03:37:07PM -0700, Dave Townsend wrote:
> >> Do we have any standard way to test in-tree Rust code?
> >>
> >> Context: We're building a standalone binary in Rust that in the future
> will
> >> be distributed with Firefox and of course we want to test it. It lives
> >> in-tree and while we could use something like xpcshell to drive the
> >> produced executable and verify its effects it would be much nicer to be
> >> able to use Rust tests themselves. But I don't see a standard way to do
> >> that right now.
> >>
> >> Is there something, should we build something?
> >
> >
> https://searchfox.org/mozilla-central/rev/446160560bf32ebf4cb7c4e25d7386ee22667255/python/mozbuild/mozbuild/frontend/context.py#1393
>
> If it helps to have an example, Geckodriver is using RUST_TESTS
>
>
> https://searchfox.org/mozilla-central/source/testing/geckodriver/moz.build#9-20
>
> It's not depending on gecko, so it's a simpler case than the one Lina
> mentioned.
> _______________________________________________
> dev-platform mailing list
> dev-platform@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-platform
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to