How is Rust's testsuite driven

    AA                Dear all,

I am a member of OCaml’s developement team. More specifically, I am working on a test-driver for the OCaml compiler, which will be part of OCaml’s 4.06 release.

I am currently writing an article to describe the tool and its principles. In this article, I would like to also talk about how other compilers’ testsuites are driven and loking how things are done in Rust seemed natural to me.

In OCaml, our testsuite essentially consist in whole programs that we compile and run, checking that the compilation and execution results match the expected ones.

I tried to understand how tests are run for the Rust compiler but was not able to get an overall picture. It seems there are special comments to declare expected errors, for instance, but how do you deal, for instance, with conditional tests that should be executed only on one platform?

Any comment / hint on this aspect of the test harness’ design would be really helpful.

Many thanks in advance,




Most educative! :sparkling_heart:

@shindere, does Rust Book 2nd Edition Chapter 11 help?


Anton Tagunov (2017/10/31 14:47 +0000):

Most educative! :sparkling_heart:

Yeah that link helped a lot, thanks to the person who posted it. Sorry for not having replied earlier, I am blind and find the forum rather hard to use. Here I was mentionned so I received an email. :slight_smile:

@shindere, does Rust Book 2nd Edition Chapter 11 help?

Not as much as the previous link, because I was specifically interested in how the compiler itself is tested and how its testsuite is driven, but it’s still interesting, thanks a lot!


Once your article is done please feel free to post a link here!

It’ll be interesting to read about your setup as well


I imagine that platform-specific testing uses the language features for conditional compilation.

Here’s an example I can find. An interesting thing about this test is how all platforms are explicitly accounted for in the file, presumably so that the test will “break” (due to a missing main) whenever a new platform is tested. (I wonder why they didn’t do that here…)

Another link: