about summary refs log tree commit diff
path: root/src/libtest
AgeCommit message (Collapse)AuthorLines
2017-02-14enable tools to use test runners programmaticallyOliver Schneider-2/+2
2017-02-12Auto merge of #38945 - battisti:fix_thread_num, r=alexcrichtonbors-0/+2
treat setting the number of test-threads to 0 as an error It is currently possible to call `cargo test -- --test-threads=0` which will cause cargo to hang until aborted. This change will fix that and will report an appropriate error to the user.
2017-02-11removed trailing whitespaceAlexander Battisti-1/+1
2017-01-12Auto merge of #38779 - Craig-Macomber:bench, r=alexcrichtonbors-97/+148
Do not run outer setup part of benchmarks multiple times to fix issue 20142 Fix #20142 This is my first real rust code, so I expect the quality is quite bad. Please let me know in which ways it is horrible and I'll fix it. Previously the whole benchmark function was rerun many times, but with this change, only the callback passed to iter is rerun. This improves performances by saving benchmark startup time. The setup used to be called a minimum of 101 times, and now only runs once. I wasn't sure exactly what should be done for the case where iter is never called, so I left a FIXME for that: currently it does not error, and I added tests to cover that. I have left the algorithm and statistics unchanged: I don't like how the minimum number of runs is 301 (that's bad for very slow benchmarks) but I consider such changes out of scope for this fix.
2017-01-09Fix for for setting test-threads to 0Alexander Battisti-0/+2
Running test with cargo test -- --test-threads=0 causes cargo to hang as 0 is a valid usize. Adding zero threads as a special case to the error handling.
2017-01-02do not run outter part of benchmarks multimple times to fix issue 20142Craig Macomber-97/+148
2016-12-29Remove not(stage0) from deny(warnings)Alex Crichton-1/+1
Historically this was done to accommodate bugs in lints, but there hasn't been a bug in a lint since this feature was added which the warnings affected. Let's completely purge warnings from all our stages by denying warnings in all stages. This will also assist in tracking down `stage0` code to be removed whenever we're updating the bootstrap compiler.
2016-12-15WIP: Cross-compilation for Redox targetJeremy Soller-0/+11
2016-12-14libtest: add --list option to list tests and benchmarksJeremy Fitzhardinge-20/+78
This option lists all the tests and benchmarks a binary provides. By default the listing is sent to stdout, but if --logfile is also specified, it is written there. If filters are specified, they're applied before the output is emitted.
2016-12-05libtest: add --exact to make filter matching exactJeremy Fitzhardinge-2/+90
Filter matching is by substring by default. This makes it impossible to run a single test if its name is a substring of some other test. For example, its not possible to run just "mymod::test" with these tests: mymod::test mymod::test1 mymod::test_module::moretests You could declare by convention that no test has a name that's a substring of another test, but that's not really practical. This PR adds the "--exact" flag, to make filter matching exactly match the complete name.
2016-11-30Update the bootstrap compilerAlex Crichton-1/+0
Now that we've got a beta build, let's use it!
2016-11-18Warn when a #[should_panic] test has an unexpected messageJosh Driver-13/+30
2016-10-31Changed most vec! invocations to use square bracesiirelu-2/+2
Most of the Rust community agrees that the vec! macro is clearer when called using square brackets [] instead of regular brackets (). Most of these ocurrences are from before macros allowed using different types of brackets. There is one left unchanged in a pretty-print test, as the pretty printer still wants it to have regular brackets.
2016-10-22Add Fuchsia supportRaph Levien-1/+2
Adds support for the x86_64-unknown-fuchsia target, which covers the Fuchsia operating system.
2016-10-12Stabilise `?`Nick Cameron-1/+1
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-10-06std: Minor cleanup to libtestAlex Crichton-65/+65
* Don't spawn two threads for all tests, just one now that `catch_unwind` is stable. * Remove usage of the unstable `box` keyword * Remove usage of the unstable `FnBox` trait
2016-09-30Change the sigs of set_print/set_panic to allow restoring the default objectsBrian Anderson-10/+6
2016-09-30Update libtest for single-threaded emscripten supportBrian Anderson-16/+53
2016-09-30Preliminary wasm32 supportBrian Anderson-2/+2
2016-09-28Auto merge of #36604 - japaric:libtest-skip, r=alexcrichtonbors-0/+10
libtest: add a --skip flag to the test runner This flag takes a FILTER argument and instructs the test runner to skip the tests whose names contain the word FILTER. --skip can be used several times. --- My motivation for submitting this is that while using [smoke] to run `std` unit tests for cross targets I found that a few of the tests always fail due to limitations in QEMU (it can't handle too many threads) and I'd like to skip these problematic tests from the command line to be able to run the rest of the unit tests. [smoke]: https://github.com/japaric/smoke I know there is another mechanism to skip tests: `#[ignore]` but this doesn't work in my use case because I can't (easily) modify the source of the standard libraries to `#[ignore]` some tests. And even if I could, the change would involve conditionally ignoring some tests for some targets but that's not a perfect solution because those tests should pass if executed on real hardware so they should not be `#[ignored]` in that scenario. r? @alexcrichton cc @brson
2016-09-25Haiku: Style, TODO to FIXMEAlexander von Gluck IV-1/+1
2016-09-25Add support for the Haiku operating system on x86 and x86_64 machinesNiels Sascha Reedijk-0/+6
* Hand rebased from Niels original work on 1.9.0
2016-09-20libtest: add a --skip flag to the test runnerJorge Aparicio-0/+10
This flag takes a FILTER argument and instructs the test runner to skip the tests whose names contain the word FILTER. --skip can be used several times.
2016-08-19std: Stabilize APIs for the 1.12 releaseAlex Crichton-1/+0
Stabilized * `Cell::as_ptr` * `RefCell::as_ptr` * `IpAddr::is_{unspecified,loopback,multicast}` * `Ipv6Addr::octets` * `LinkedList::contains` * `VecDeque::contains` * `ExitStatusExt::from_raw` - both on Unix and Windows * `Receiver::recv_timeout` * `RecvTimeoutError` * `BinaryHeap::peek_mut` * `PeekMut` * `iter::Product` * `iter::Sum` * `OccupiedEntry::remove_entry` * `VacantEntry::into_key` Deprecated * `Cell::as_unsafe_cell` * `RefCell::as_unsafe_cell` * `OccupiedEntry::remove_pair` Closes #27708 cc #27709 Closes #32313 Closes #32630 Closes #32713 Closes #34029 Closes #34392 Closes #34285 Closes #34529
2016-08-13Auto merge of #35414 - jupp0r:feature/test-threads-flag, r=alexcrichtonbors-4/+23
Add --test-threads option to test binaries This change allows parallelism of test runs to be specified by a command line flag names --test-threads in addition to the existing environment variable RUST_TEST_THREADS. Fixes #25636.
2016-08-07save an Instant for the timeout instead of a DurationFelix Rath-24/+35
requires less bookkeeping. also move some functionality into functions, to keep the loop cleaner.
2016-08-07Add --test-threads option to test binariesJupp Müller-4/+23
This change allows parallelism of test runs to be specified by a command line flag names --test-threads in addition to the existing environment variable RUST_TEST_THREADS. Fixes #25636.
2016-08-06add warning timeout for tests that run >1minFelix Rath-1/+47
this makes it easier to identify hanging tests
2016-07-12Use `ptr::{null, null_mut}` instead of `0 as *{const, mut}`Tobias Bucher-2/+6
2016-07-03prefer `if let` to match with `None => {}` arm in some placesZack M. Davis-6/+3
This is a spiritual succesor to #34268/8531d581, in which we replaced a number of matches of None to the unit value with `if let` conditionals where it was judged that this made for clearer/simpler code (as would be recommended by Manishearth/rust-clippy's `single_match` lint). The same rationale applies to matches of None to the empty block.
2016-06-05run rustfmt on libtest folderSrinivas Reddy Thatiparthy-2/+1
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-0/+2
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-04-12Remove unused trait importsSeo Sanghyeon-2/+0
2016-04-06avoid "==" in assert! when one of the values is a boolTshepang Lekhonkhobe-1/+1
2016-03-31allow RUST_BACKTRACE=0 to act as if unsetEmanuel Czirai-3/+6
/# This is a combination of 16 commits. /# The first commit's message is: allow RUST_BACKTRACE=disabled to act as if unset When RUST_BACKTRACE is set to "disabled" then this acts as if the env. var is unset. /# This is the 2nd commit message: case insensitive "DiSaBLeD" RUST_BACKTRACE value previously it expected a lowercase "disabled" to treat the env. var as unset /# This is the 3rd commit message: RUST_BACKTRACE=0 acts as if unset previously RUST_BACKTRACE=disabled was doing the same thing /# This is the 4th commit message: RUST_BACKTRACE=0|n|no|off acts as if unset previously only RUST_BACKTRACE=0 acted as if RUST_BACKTRACE was unset Now added more options (case-insensitive): 'n','no' and 'off' eg. RUST_BACKTRACE=oFF /# This is the 5th commit message: DRY on the value of 2 DRY=don't repeat yourself Because having to remember to keep the two places of '2' in sync is not ideal, even though this is a simple enough case. /# This is the 6th commit message: Revert "DRY on the value of 2" This reverts commit 95a0479d5cf72a2b2d9d21ec0bed2823ed213fef. Nevermind this DRY on 2, because we already have a RY on 1, besides the code is less readable this way... /# This is the 7th commit message: attempt to document unsetting RUST_BACKTRACE /# This is the 8th commit message: curb allocations when checking for RUST_BACKTRACE this means we don't check for case-insensitivity anymore /# This is the 9th commit message: as decided, RUST_BACKTRACE=0 turns off backtrace /# This is the 10th commit message: RUST_TEST_NOCAPTURE=0 acts as if unset (that is, capture is on) Any other value acts as if nocapture is enabled (that is, capture is off) /# This is the 11th commit message: update other RUST_TEST_NOCAPTURE occurrences apparently only one place needs updating /# This is the 12th commit message: update RUST_BACKTRACE in man page /# This is the 13th commit message: handle an occurrence of RUST_BACKTRACE /# This is the 14th commit message: ensure consistency with new rules for backtrace /# This is the 15th commit message: a more concise comment for RUST_TEST_NOCAPTURE /# This is the 16th commit message: update RUST_TEST_NOCAPTURE in man page
2016-03-22sprinkle feature gates here and thereJorge Aparicio-0/+1
2016-03-22try! -> ?Jorge Aparicio-30/+30
Automated conversion using the untry tool [1] and the following command: ``` $ find -name '*.rs' -type f | xargs untry ``` at the root of the Rust repo. [1]: https://github.com/japaric/untry
2016-03-15Auto merge of #31887 - SimonSapin:quiet-test, r=alexcrichtonbors-16/+34
Shorter output for `rustc --test` binaries. Until now, a program created with `rustc --test` prints at least one line per test. This can be very verbose, especially with [data-driven tests](https://internals.rust-lang.org/t/test-and-external-test-harnesses/3145) when hundreds or thousands of tests is not rare. This changes the default output to one character per test (except metrics and benchmarks results which have additional data to show): ``` Running target/debug/wpt-75c594dc1e6e6187 running 314 tests .............................................................................. .............................................................................. .............................................................................. .............................................................................. .. test result: ok. 314 passed; 0 failed; 0 ignored; 0 measured ``` <s>The previous behavior is available by passing `--verbose` to the test program. Maybe `cargo test --verbose` could be changed to do that?</s> **Edit:** the default is now unchanged, `-q` or `--quiet` enables the new output.
2016-03-15Shorter output for `rustc --test` binaries.Simon Sapin-16/+34
A program created with `rustc --test` prints at least one line per test. This can be very verbose, especially with [data-driven tests]( https://internals.rust-lang.org/t/test-and-external-test-harnesses/3145) when hundreds or thousands of tests is not rare. This adds a `-q` or `--quiet` option that changes the output to one character instead of one line per test (except metrics and benchmarks results which have additional data to show): ``` Running target/debug/wpt-75c594dc1e6e6187 running 314 tests .............................................................................. .............................................................................. .............................................................................. .............................................................................. .. test result: ok. 314 passed; 0 failed; 0 ignored; 0 measured ``` This is a breaking change since the `test::TestOpts` struct now has one more field.
2016-03-07mk: Distribute fewer TARGET_CRATESAlex Crichton-5/+1
Right now everything in TARGET_CRATES is built by default for all non-fulldeps tests and is distributed by default for all target standard library packages. Currenly this includes a number of unstable crates which are rarely used such as `graphviz` and `rbml`> This commit trims down the set of `TARGET_CRATES`, moves a number of tests to `*-fulldeps` as a result, and trims down the dependencies of libtest so we can distribute fewer crates in the `rust-std` packages.
2016-02-29std: Stabilize APIs for the 1.8 releaseAlex Crichton-1/+0
This commit is the result of the FCPs ending for the 1.8 release cycle for both the libs and the lang suteams. The full list of changes are: Stabilized * `braced_empty_structs` * `augmented_assignments` * `str::encode_utf16` - renamed from `utf16_units` * `str::EncodeUtf16` - renamed from `Utf16Units` * `Ref::map` * `RefMut::map` * `ptr::drop_in_place` * `time::Instant` * `time::SystemTime` * `{Instant,SystemTime}::now` * `{Instant,SystemTime}::duration_since` - renamed from `duration_from_earlier` * `{Instant,SystemTime}::elapsed` * Various `Add`/`Sub` impls for `Time` and `SystemTime` * `SystemTimeError` * `SystemTimeError::duration` * Various impls for `SystemTimeError` * `UNIX_EPOCH` * `ops::{Add,Sub,Mul,Div,Rem,BitAnd,BitOr,BitXor,Shl,Shr}Assign` Deprecated * Scoped TLS (the `scoped_thread_local!` macro) * `Ref::filter_map` * `RefMut::filter_map` * `RwLockReadGuard::map` * `RwLockWriteGuard::map` * `Condvar::wait_timeout_with` Closes #27714 Closes #27715 Closes #27746 Closes #27748 Closes #27908 Closes #29866
2016-02-24Generalize from passing around a single path to the test file to passingNiko Matsakis-1/+6
around a set of paths called `TestPaths` This commit is not quite standalone; it basically contains all the borrowing plumbing bits, the interesting stuff comes in the next commit.
2016-02-11bootstrap: Add a bunch of Cargo.toml filesAlex Crichton-0/+14
These describe the structure of all our crate dependencies.
2016-02-06Add the asmjs-unknown-emscripten triple. Add cfgs to libs.Brian Anderson-3/+6
Backtraces, and the compilation of libbacktrace for asmjs, are disabled. This port doesn't use jemalloc so, like pnacl, it disables jemalloc *for all targets* in the configure file. It disables stack protection.
2016-02-03Auto merge of #31078 - nbaksalyar:illumos, r=alexcrichtonbors-1/+2
This pull request adds support for [Illumos](http://illumos.org/)-based operating systems: SmartOS, OpenIndiana, and others. For now it's x86-64 only, as I'm not sure if 32-bit installations are widespread. This PR is based on #28589 by @potatosalad, and also closes #21000, #25845, and #25846. Required changes in libc are already merged: https://github.com/rust-lang-nursery/libc/pull/138 Here's a snapshot required to build a stage0 compiler: https://s3-eu-west-1.amazonaws.com/nbaksalyar/rustc-sunos-snapshot.tar.gz It passes all checks from `make check`. There are some changes I'm not quite sure about, e.g. macro usage in `src/libstd/num/f64.rs` and `DirEntry` structure in `src/libstd/sys/unix/fs.rs`, so any comments on how to rewrite it better would be greatly appreciated. Also, LLVM configure script might need to be patched to build it successfully, or a pre-built libLLVM should be used. Some details can be found here: https://llvm.org/bugs/show_bug.cgi?id=25409 Thanks! r? @brson
2016-02-02Fixes #31229Dave Huseby-8/+2
2016-01-31Rename sunos to solarisNikita Baksalyar-1/+1
2016-01-31Add Illumos supportNikita Baksalyar-1/+2
2016-01-24mk: Move from `-D warnings` to `#![deny(warnings)]`Alex Crichton-0/+1
This commit removes the `-D warnings` flag being passed through the makefiles to all crates to instead be a crate attribute. We want these attributes always applied for all our standard builds, and this is more amenable to Cargo-based builds as well. Note that all `deny(warnings)` attributes are gated with a `cfg(stage0)` attribute currently to match the same semantics we have today
2016-01-19manual fixupsNick Cameron-20/+13