rust/src/compiletest
Huon Wilson d73545ceca Run benchmarks once, as a test by default.
E.g. if `foo.rs` looks like

    #![feature(test)]
    extern crate test;

    #[bench]
    fn bar(b: &mut test::Bencher) {
        b.iter(|| {
            1
        })
    }

    #[test]
    fn baz() {}

    #[bench]
    fn qux(b: &mut test::Bencher) {
        b.iter(|| {
            panic!()
        })
    }

Then

    $ rustc --test foo.rs
    $ ./foo

    running 3 tests
    test baz ... ok
    test qux ... FAILED
    test bar ... ok

    failures:

    ---- qux stdout ----
    	thread 'qux' panicked at 'explicit panic', bench.rs:17

    failures:
        qux

    test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured

    $ ./foo --bench ba

    running 2 tests
    test baz ... ignored
    test bar ... bench:        97 ns/iter (+/- 74)

    test result: ok. 0 passed; 0 failed; 1 ignored; 1 measured

In particular, the two benchmark are being run as tests in the default
mode.

This helps for the main distribution, since benchmarks are only run with
`PLEASE_BENCH=1`, which is rarely set (and never set on the test bots),
and helps for code-coverage tools: benchmarks are run and so don't count
as dead code.

Fixes #15842.
2015-05-02 15:45:23 +10:00
..
common.rs compiletest: Add support for running rustdoc tests 2015-04-07 17:54:33 -07:00
compiletest.rs Run benchmarks once, as a test by default. 2015-05-02 15:45:23 +10:00
errors.rs Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
header.rs compiletest: Add support for // ignore-musl 2015-04-27 10:11:15 -07:00
procsrv.rs Test fixes and rebase conflicts, round 2 2015-03-27 13:43:42 -07:00
raise_fd_limit.rs More test fixes 2015-04-14 10:14:19 -07:00
runtest.rs compiletest: Don't force dylibs on musl 2015-04-27 10:11:15 -07:00
util.rs compiletest: Add support for // ignore-musl 2015-04-27 10:11:15 -07:00