Oooh, this question comes at a perfect time, the Glean team has been looking at this recently in bug 1627024, too!
Nick's quote from the Oxidation wiki alludes to this, but, if your Rust code is pulling in Gecko crates like `nsstring`, `xpcom`, and such, I don't think `RUST_TESTS` will workâyou'd have to write a GTest. There's been some more discussion about that in bug 1628074 and bug 1373878 that came down to "because of complicated reasons, you can't write Rust tests that link against Gecko symbols". (Please correct me if that's no longer the case, though!) https://searchfox.org/mozilla-central/source/toolkit/library/gtest/rust has a list of Rust GTests, and https://searchfox.org/mozilla-central/source/xpcom/rust/gtest/nsstring is a nice example of the glue needed to set one up. Hope this helps! Cheers, ~ lina On Mon, May 11, 2020 at 3:54 PM Mike Hommey <m...@glandium.org> 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 > > Mike > _______________________________________________ > 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