# How is Rust's testsuite driven

**URL:** <https://internals.rust-lang.org/t/how-is-rusts-testsuite-driven/6131>\
**Category:** Uncategorized\
**Created:** [October 30, 2017, 3:53pm UTC](https://internals.rust-lang.org/t/how-is-rusts-testsuite-driven/6131 "2017-10-30T15:53:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shindere](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@shindere](https://internals.rust-lang.org/u/shindere)\
**Post date:** [October 30, 2017, 3:53pm UTC](https://internals.rust-lang.org/t/how-is-rusts-testsuite-driven/6131/1 "2017-10-30T15:53:25Z")

</div>

```
    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,

Sébastien.

---

<div class="post-metadata">

**Author:** ![notriddle](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/notriddle/32/14082_2.png) [@notriddle](https://internals.rust-lang.org/u/notriddle)\
**Post date:** [October 30, 2017, 7:19pm UTC](https://internals.rust-lang.org/t/how-is-rusts-testsuite-driven/6131/3 "2017-10-30T19:19:21Z")

</div>

[https://brson.github.io/2017/07/10/how-rust-is-tested](https://brson.github.io/2017/07/10/how-rust-is-tested)

---

<div class="post-metadata">

**Author:** ![atagunov](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/atagunov/32/5877_2.png) [@atagunov](https://internals.rust-lang.org/u/atagunov)\
**Post date:** [October 31, 2017, 2:36pm UTC](https://internals.rust-lang.org/t/how-is-rusts-testsuite-driven/6131/4 "2017-10-31T14:36:36Z")

</div>

> [@notriddle](#):
>
> [How Rust is tested](https://brson.github.io/2017/07/10/how-rust-is-tested)

Most educative! 💖

@shindere, does [Rust Book 2nd Edition Chapter 11](https://doc.rust-lang.org/book/second-edition/ch11-00-testing.html) help?

---

<div class="post-metadata">

**Author:** ![shindere](https://avatars.discourse-cdn.com/v4/letter/s/b9bd4f/32.png) [@shindere](https://internals.rust-lang.org/u/shindere)\
**Post date:** [October 31, 2017, 3:00pm UTC](https://internals.rust-lang.org/t/how-is-rusts-testsuite-driven/6131/5 "2017-10-31T15:00:31Z")

</div>

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

> > [@notriddle](#):
> >
> > [How Rust is tested](https://brson.github.io/2017/07/10/how-rust-is-tested)
> 
> Most educative! 💖

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. 🙂

> @shindere, does [Rust Book 2nd Edition Chapter 11](https://doc.rust-lang.org/book/second-edition/ch11-00-testing.html) 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!

---

<div class="post-metadata">

**Author:** ![atagunov](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/atagunov/32/5877_2.png) [@atagunov](https://internals.rust-lang.org/u/atagunov)\
**Post date:** [October 31, 2017, 5:50pm UTC](https://internals.rust-lang.org/t/how-is-rusts-testsuite-driven/6131/6 "2017-10-31T17:50:51Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![ExpHP](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/exphp/32/6208_2.png) [@ExpHP](https://internals.rust-lang.org/u/ExpHP)\
**Post date:** [November 1, 2017, 7:13pm UTC](https://internals.rust-lang.org/t/how-is-rusts-testsuite-driven/6131/7 "2017-11-01T19:13:21Z")

</div>

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

[Here’s an example I can find](https://github.com/rust-lang/rust/blob/master/src/test/run-pass/x86stdcall.rs). 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…_](https://github.com/rust-lang/rust/blob/master/src/test/run-pass/x86stdcall2.rs))

* * *

Another link: [https://forge.rust-lang.org/test-suite.html](https://forge.rust-lang.org/test-suite.html)

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)\
**Post date:** [March 25, 2019, 8:29am UTC](https://internals.rust-lang.org/t/how-is-rusts-testsuite-driven/6131/8 "2019-03-25T08:29:10Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
