1
Fork 0
Commit graph

26 commits

Author SHA1 Message Date
Alisa Sireneva
b01c7f6b9c fix(libtest): Enable Instant on Emscripten targets
`Instant::now()` works correctly on Emscripten since
https://github.com/rust-lang/libc/pull/3962. All wasm-family targets
with OS support can now handle instants.
2025-02-09 23:51:54 +03:00
Urgau
939b7047a0 test: add #![warn(unreachable_pub)] 2025-01-20 18:46:29 +01:00
Nicholas Nethercote
84ac80f192 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Ralf Jung
510720e9fc libtest: also measure time in Miri 2024-04-15 09:50:42 +02:00
Arthur Carcano
ccd99b384e Remove unused fields in some structures
The dead_code lint was previously eroneously missing those.
Since this lint bug has been fixed, the unused fields need
to be removed.
2024-03-12 10:59:40 +01:00
Alex Crichton
8fcc009f7d libtest: Print timing information on WASI
This commit updates the libtest conditionals to use `std::time::Instant`
on WASI targets where it's implemented. Previously all wasm targets
wouldn't use this type.
2024-03-11 09:36:35 -07:00
Erik Kaneda
966b94e0a2
rustc: implement support for riscv32im_risc0_zkvm_elf
This also adds changes in the rust test suite in order to get a few of them to
pass.

Co-authored-by: Frank Laub <flaub@risc0.com>
Co-authored-by: Urgau <3616612+Urgau@users.noreply.github.com>
2024-01-22 10:07:36 -08:00
Pietro Albini
2f7fd2e5f7
add StaticBenchAsTestFn and DynBenchAsTestFn to convert benches to tests
Before this commit, both static and dynamic benches were converted to a
DynTestFn, with a boxed closure that ran the benchmarks exactly once.

While this worked, it conflicted with -Z panic-abort-tests as the flag
does not support dynamic tests. With this change, a StaticBenchFn is
converted to a StaticBenchAsTestFn, avoiding any dynamic test creation.
DynBenchFn is also converted to DynBenchAsTestFn for completeness.
2023-05-26 14:57:38 +02:00
Partha P. Das
3720753632
Implementing "<test_binary> --list --format json" #107307 #49359 2023-03-15 14:20:20 -04:00
Lenko Donchev
77133370ce Print why a test was ignored if it's the only test specified. 2023-01-22 18:56:13 -06:00
Joshua Nelson
3534e0a393 Fix a few clippy lints in libtest
- Remove unnecessary references and dereferences
- Use `.contains` instead of `a <= x && x <= b`
- Use `mem::take` instead of `mem::replace` where possible
2023-01-03 18:55:03 +00:00
Oli Scherer
e59025867d Create a hacky fail-fast mode that stops tests at the first failure 2022-12-01 20:29:18 +00:00
Ben Kimock
17b86cb611 Do fewer passes and generally be more efficient when filtering tests 2022-10-27 21:34:56 -04:00
Ben Kimock
df6221adc6 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.
2022-09-01 09:04:25 -04:00
Ben Kimock
90dc0b02ae Lock stdout once when listing tests 2022-07-22 18:39:26 -04:00
Pietro Albini
181d28bb61
trivial cfg(bootstrap) changes 2022-04-05 23:18:40 +02:00
Antonio Yang
14daf47e0a Show ignore message in console and json output 2022-03-11 07:15:27 -05:00
T-O-R-U-S
72a25d05bf Use implicit capture syntax in format_args
This updates the standard library's documentation to use the new syntax. The
documentation is worthwhile to update as it should be more idiomatic
(particularly for features like this, which are nice for users to get acquainted
with). The general codebase is likely more hassle than benefit to update: it'll
hurt git blame, and generally updates can be done by folks updating the code if
(and when) that makes things more readable with the new format.

A few places in the compiler and library code are updated (mostly just due to
already having been done when this commit was first authored).
2022-03-10 10:23:40 -05:00
Antonio Yang
bb3b5574cd Include ignore message in libtest output
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-24 17:36:36 -05:00
yuhaixin.hx
6562069ebe remove allow_fail test flag 2022-01-28 18:31:49 +08:00
Alex Crichton
d2a3c24a95 Update more rustc/libtest things for wasm64
* Add wasm64 variants for inline assembly along the same lines as wasm32
* Update a few directives in libtest to check for `target_family`
  instead of `target_arch`
* Update some rustc codegen and typechecks specialized for wasm32 to
  also work for wasm64.
2021-11-10 08:35:42 -08:00
Samuel E. Moelius III
fa23d4fe93 Implement #85440 2021-09-29 21:51:46 -04:00
Charles Lew
950f569c91 Fix compilation errors. 2021-07-18 20:51:47 +08:00
Andrey Cherkashin
38485a9e34 feat(libtest): Add JUnit formatter 2021-04-25 15:51:50 -07:00
Jakob Schikowski
470c059e69 libtest: Print the total time taken to execute a test suite 2020-11-27 17:53:59 +01:00
mark
2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00
Renamed from src/libtest/console.rs (Browse further)