about summary refs log tree commit diff
path: root/library/test/src/tests.rs
AgeCommit message (Collapse)AuthorLines
2025-04-28Remove backticks from `ShouldPanic::YesWithMessage`'s `TrFailedMsg`Lieselotte-3/+3
2025-01-24Remove a bunch of emscripten test ignoresbjorn3-10/+0
They are either outdated as emscripten now supports i128 or they are subsumed by #[cfg_attr(not(panic = "unwind"), ignore]
2025-01-20test: add `#![warn(unreachable_pub)]`Urgau-14/+14
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+2
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2023-12-10remove redundant importssurechen-17/+0
detects redundant imports that can be eliminated. for #117772 : In order to facilitate review and modification, split the checking code and removing redundant imports code into two PR.
2023-06-13ignore core, alloc and test tests that require unwinding on panic=abortPietro Albini-0/+5
2023-04-28handle cfg(bootstrap)Pietro Albini-100/+0
2023-03-15Implementing "<test_binary> --list --format json" #107307 #49359Partha P. Das-0/+200
2023-01-22Print why a test was ignored if it's the only test specified.Lenko Donchev-0/+1
2022-12-01Create a hacky fail-fast mode that stops tests at the first failureOli Scherer-0/+1
2022-10-28libtest: run all tests in their own thread, if supported by the hostRalf Jung-17/+9
2022-10-24Rollup merge of #99939 - saethlin:pre-sort-tests, r=thomcc,jackh726Yuki Okushi-27/+0
Sort tests at compile time, not at startup Recently, another Miri user was trying to run `cargo miri test` on the crate `iced-x86` with `--features=code_asm,mvex`. This configuration has a startup time of ~18 minutes. That's ~18 minutes before any tests even start to run. The fact that this crate has over 26,000 tests and Miri is slow makes a lot of code which is otherwise a bit sloppy but fine into a huge runtime issue. Sorting the tests when the test harness is created instead of at startup time knocks just under 4 minutes out of those ~18 minutes. I have ways to remove most of the rest of the startup time, but this change requires coordinating changes of both the compiler and libtest, so I'm sending it separately. (except for doctests, because there is no compile-time harness)
2022-09-16Do not panic when a test function returns Result::Err.Bradford Hovinen-22/+68
Rust's test library allows test functions to return a Result, so that the test is deemed to have failed if the function returns a Result::Err variant. Currently, this works by having Result implement the Termination trait and asserting in assert_test_result that Termination::report() indicates successful completion. This turns a Result::Err into a panic, which is caught and unwound in the test library. This approach is problematic in certain environments where one wishes to save on both binary size and compute resources when running tests by: * Compiling all code with --panic=abort to avoid having to generate unwinding tables, and * Running most tests in-process to avoid the overhead of spawning new processes. This change removes the intermediate panic step and passes a Result::Err directly through to the test runner. To do this, it modifies assert_test_result to return a Result<(), String> where the Err variant holds what was previously the panic message. It changes the types in the TestFn enum to return Result<(), String>. This tries to minimise the changes to benchmark tests, so it calls unwrap() on the Result returned by assert_test_result, effectively keeping the same behaviour as before.
2022-09-01Sort tests at compile time, not at startupBen Kimock-27/+0
Recently, another Miri user was trying to run `cargo miri test` on the crate `iced-x86` with `--features=code_asm,mvex`. This configuration has a startup time of ~18 minutes. That's ~18 minutes before any tests even start to run. The fact that this crate has over 26,000 tests and Miri is slow makes a lot of code which is otherwise a bit sloppy but fine into a huge runtime issue. Sorting the tests when the test harness is created instead of at startup time knocks just under 4 minutes out of those ~18 minutes. I have ways to remove most of the rest of the startup time, but this change requires coordinating changes of both the compiler and libtest, so I'm sending it separately.
2022-04-05trivial cfg(bootstrap) changesPietro Albini-19/+0
2022-02-25Switch bootstrap cfgsMark Rousskov-38/+0
2022-02-24Include ignore message in libtest outputAntonio Yang-0/+38
As an example: #[test] #[ignore = "not yet implemented"] fn test_ignored() { ... } Will now render as: running 2 tests test tests::test_ignored ... ignored, not yet implemented test result: ok. 1 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out; finished in 0.00s
2022-02-17Rollup merge of #93479 - smoelius:master, r=yaahcMatthias Krüger-1/+0
Use `optflag` for `--report-time` Essentially, what is described here: https://github.com/rust-lang/rust/issues/64888#issuecomment-1008047228 There is one difference. The comment proposes to add a `--report-time-color` option. This change instead uses libtest's existing `--color` option for that purpose.
2022-01-30Use `optflag` for `--report-time`Samuel E. Moelius III-1/+0
Essentially, what is described here: https://github.com/rust-lang/rust/issues/64888#issuecomment-1008047228 There is one difference. The comment proposes to add a `--report-time-color` option. This change instead uses libtest's existing `--color` option for that purpose.
2022-01-28add allow_fail field in TestDesc to pass checkyuhaixin.hx-0/+38
2022-01-28remove allow_fail test flagyuhaixin.hx-20/+0
2022-01-09eplace usages of vec![].into_iter with [].into_iterLucas Kent-1/+1
2021-09-29Add testsSamuel E. Moelius III-25/+92
2021-09-29Implement #85440Samuel E. Moelius III-0/+2
2021-06-28Update to new bootstrap compilerMark Rousskov-38/+0
2021-05-09add bootstrap cfgAliénore Bouttefeux-0/+38
2021-05-03proof of concept add test type on printsAliénore Bouttefeux-0/+38
2021-03-24libtest: Index tests by a unique TestIdAnders Kaseorg-11/+19
This more robustly avoids problems with duplicate TestDesc. See #81852 and #82274. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2021-02-08Rollup merge of #81356 - ehuss:libtest-filters, r=m-ou-seMara Bos-9/+26
libtest: allow multiple filters Libtest ignores any filters after the first. This changes it so that if multiple filters are passed, it will test against all of them. This also affects compiletest to do the same. Closes #30422
2021-02-07Auto merge of #81821 - nikic:update-wasm32, r=sanxiynbors-1/+1
Upgrade wasm32 image to Ubuntu 20.04 This switches the wasm32 image, which is used to test wasm32-unknown-emscripten, to Ubuntu 20.04. While at it, enable most of the excluded tests, as they seem to work fine with some minor fixes.
2021-02-06Upgrade wasm32 image to Ubuntu 20.04Nikita Popov-1/+1
This switches the wasm32 image, which is used to test wasm32-unknown-emscripten to Ubuntu 20.04. While at it, enable most of the excluded tests, as they seem to work fine with some minor fixes.
2021-02-03Allow/fix non_fmt_panic in tests.Mara Bos-1/+1
2021-01-31Rollup merge of #80053 - gilescope:include-ignore, r=m-ou-seJonas Schievink-6/+1
stabilise `cargo test -- --include-ignored` stabilise `cargo test -- --include-ignored` On stable there's no way to run ignored tests as well as the normal tests. An example use case where stabilising this would help: Exercism has some initial tests and then some additional ignored tests that people run currently with --ignore but currently they can't run all the tests in one go without being on nightly. It would be a little more ergonomic if this flag was stablilised. ( Fixes #65770 ) I built with ./x.py build -i library/test - but as libtest is a dylib is there an easy way to invoke it manually to check it's working as expected? (I've updated the automated tests.)
2021-01-24libtest: allow multiple filtersEric Huss-9/+26
2021-01-10Print failure message on all tests that should panic, but don'tjohanngan-15/+24
This already happens with should_panic tests without an expected message. This commit fixes should_panic tests with an expected message to have the same behavior.
2020-12-15stabilise --include-ignoredGiles Cope-6/+1
2020-11-27libtest: Print the total time taken to execute a test suiteJakob Schikowski-0/+1
2020-07-27mv std libs to library/mark-0/+688