Commit Graph

1300 Commits

Author SHA1 Message Date
JCTyBlaidd
ed32b260f9 Add tests, and fix bug in atomic RMW relaxed stores 2020-11-02 02:57:06 +00:00
Ralf Jung
e7246be4f0 backtrace tests: support more ways of checking out Rust locally 2020-10-31 13:47:42 +01:00
Ralf Jung
2a4faf638b increase timeout to avoid spurious test failures 2020-10-30 18:59:58 +01:00
Ralf Jung
1ad827c511 rustup 2020-10-29 20:57:38 +01:00
bors
83f7657ed0 Auto merge of #1603 - RalfJung:track-raw, r=oli-obk
add an option to track raw pointer tags in Stacked Borrows

Also make error messages more informative by printing the affected memory location
2020-10-28 13:19:25 +00:00
Ralf Jung
bf54607ba0 test raw pointer tracking; we cannot track raw pointers on Windows 2020-10-28 13:54:50 +01:00
Ralf Jung
1044099c19 disable debug assertions in the standard library 2020-10-28 12:43:11 +01:00
Ralf Jung
19e78a65d9 run some tests with raw pointer tracking 2020-10-28 12:35:05 +01:00
Ralf Jung
ecf330f39e test Box::into_raw aliasing 2020-10-27 17:26:36 +01:00
Ralf Jung
ddcc4f241e rustup; make panic output less dependent on stdlib internals 2020-10-25 10:00:50 +01:00
Ralf Jung
80c4b5d674 fix './miri test' 2020-10-22 10:36:05 +02:00
Ralf Jung
ad07b2bd44 rustup; increase slack for timing tests 2020-10-22 09:47:02 +02:00
Aaron Hill
05bb560de2
Enable backtrace feature in the generated Xargo.toml
This allows the normal std panic hook to print a backtrace if
`RUST_BACKTRACE=1` and `-Z miri-disable-isolation` are set
2020-10-20 18:27:55 -04:00
bors
d5380be209 Auto merge of #1586 - RalfJung:available-concurrency, r=RalfJung
test new available_concurrency function

Cc https://github.com/rust-lang/rust/pull/74480
2020-10-18 09:22:59 +00:00
Ralf Jung
5df6d8bec6 test new available_concurrency function 2020-10-18 11:22:09 +02:00
Aaron Hill
8b10dbfeaa
Test std::backtrace::Backtrace
Fixes #1578
2020-10-17 19:45:26 -04:00
Ralf Jung
67cf6c2176 rustup; the bad compile times for the float test are fixed 2020-10-18 00:49:52 +02:00
Aaron Hill
be51e6bd07
Add an fn_ptr field to MiriFrame
The `backtrace-rs` crate can use this to implement
`Frame::symbol_address`, which is used to skip frames
above the call to `Backtrace::capture` on the stack.

The function pointer will not be useable for comparison purposes if the
function is generic, as CTFE creates a new function pointer for each
cast of a (monomorphized) generic function. However, this already
affects code running under Miri, and isn't a problem for `backtrace-rs`
(which only casts a non-generic function).

I've added logic to allow `MiriFrame` to have either 4 or 5 fields - if
a 5th field is present, we write the function pointer to it.
2020-10-10 13:07:57 -04:00
Ralf Jung
3e655665b7 test VecDeque::iter_mut aliasing 2020-10-07 09:00:55 +02:00
Aaron Hill
8e8828259a
Use macro callsite spans in backtrace
This mirrors what we do in the debuginfo used for runtime backtraces.
2020-10-05 17:29:55 -04:00
bors
60c1075820 Auto merge of #1564 - Aaron1011:readlink, r=RalfJung
Implement `readlink`

Due to the truncating behavior of `readlink`, I was not able to
directly use any of the existing C-cstring helper functions.
2020-10-04 21:07:55 +00:00
Aaron Hill
4eea02e725
Normalize MIRI_TEMP before using it 2020-10-04 16:26:09 -04:00
Ralf Jung
02257870a6 rustup; test NaN conversion issue 2020-10-04 18:56:51 +02:00
Aaron Hill
bbba87ce54
Swap order of assertions for easier debugging 2020-10-04 12:06:51 -04:00
Aaron Hill
5fc5490bc8
Add trailing punctuation
Co-authored-by: Ralf Jung <post@ralfj.de>
2020-10-04 12:06:51 -04:00
Aaron Hill
0e59b6f673
Merge fs and fs_libc tests 2020-10-04 12:06:51 -04:00
Aaron Hill
78bc89b4fc
Implement readlink
Due to the truncating behavior of `readlink`, I was not able to
directly use any of the existing C-cstring helper functions.
2020-10-04 12:06:51 -04:00
Ralf Jung
a4cbbddc8e merge parking test into general synchronization test 2020-10-03 15:27:23 +02:00
Ralf Jung
b350c80a31 add backtics back in isolation error message 2020-10-03 15:25:30 +02:00
Mara Bos
dc36988f38 Add test for futex syscall. 2020-10-03 13:34:49 +02:00
Mara Bos
5880e7d809 Update expected error messages in tests. 2020-10-03 12:00:29 +02:00
Mara Bos
81138825b3 Add park/park_timeout/unpark test. 2020-10-02 23:35:00 +02:00
Ralf Jung
17e16aad62 normalize backtrace stderr even more 2020-09-30 10:02:53 +02:00
Aaron Hill
7fba3c2cf2
Normalize out generic arguments in backtrace-api stderr 2020-09-28 13:55:23 -04:00
Aaron Hill
5571bcfc4f
Require #[repr(C)] on MiriFrame 2020-09-28 13:44:46 -04:00
Aaron Hill
dba7f13549
Apply #[inline(never)] to functions that we want in the backtrace 2020-09-28 13:44:46 -04:00
Aaron Hill
e1bce19ca9
Make some error messages lowercase 2020-09-28 13:44:45 -04:00
Aaron Hill
b89f6561e5
Move things around 2020-09-28 13:44:45 -04:00
Aaron Hill
9fc384fcf9
Print non-std frames to stdout in backtrace-api test 2020-09-28 13:44:45 -04:00
Aaron Hill
ef43c5a614
Use a 'flags' parameter instead of 'version' 2020-09-28 13:44:45 -04:00
Aaron Hill
ae18659d52
Normalize line and column numbers from the sysroot 2020-09-28 13:44:45 -04:00
Aaron Hill
22f1eb01ee
Add API for capturing backtrace
This PR adds two new Miri-defined extern functions:
`miri_get_backtrace` and `miri_resolve_frame`, which are documented in
the README. Together, they allow obtaining a backtrace for the currently
executing program.

I've added a test showing how these APIs are used. I've also prepared a
companion PR `backtrace-rs`, which will allow
`backtrace::Backtrace::new()` to work automatically under Miri.

Once these two PRs are merged, we will be able to print backtraces from
the normal Rust panic hook (since libstd is now using backtrace-rs).

A few notes:
* Resolving the backtrace frames is *very* slow - you can actually see
  each line being printed out one at a time. Some local testing showed
  that this is not (primrary) caused by resolving a `Span` - it seems
  to be just Miri being slow.
* For the first time, we now interact directly with a user-defined
  struct (instead of just executing the user-provided MIR that
  manipulates the struct). To allow for future changes, I've added
  a 'version' parameter (currently required to be 0). This should allow
  us to change the `MiriFrame` struct should the need ever arise.
* I used the approach suggested by @oli-obk - a returned backtrace
  pointer consists of a base function allocation, with the 'offset'
  used to encode the `Span.lo`. This allows losslessly reconstructing
  the location information in `miri_resolve_frame`.
* There are a few quirks on the `backtrace-rs` side:
  * `backtrace-rs` calls `getcwd()` by default to try to simplify
    the filename. This results in an isolation error by default,
    which could be annoying when printing a backtrace from libstd.
  * `backtrace-rs` tries to remove 'internal' frames (everything between
     the call to `Backtrace::new()` and the internal API call made by
     backtrace-rs) by comparing the returned frame pointer value to
     a Rust function pointer. This doesn't work due to the way we
     construct the frame pointers passed to the caller. We could
     attempt to support this kind of comparison, or just add a
    `#[cfg(miri)]` and ignore the frames ourselves.
2020-09-28 13:44:45 -04:00
Ralf Jung
67c5067a2f rustup; fix tests 2020-09-24 09:19:03 +02:00
Ralf Jung
4b5e78052a rustup; support panic=abort on Windows 2020-09-20 15:55:36 +02:00
Ralf Jung
08e076c658 account for mir-opts masking more errors 2020-09-20 12:18:02 +02:00
Ralf Jung
83a339e5a9 rustup; make sure the iterator moves even with smarter optimizations 2020-09-20 10:26:22 +02:00
Ralf Jung
32cdb7131b support panic=abort 2020-09-18 13:10:18 +02:00
Ralf Jung
9a9988a4b0 update docs, and also use MIRIFLAGS for the test suite 2020-09-17 17:29:19 +02:00
Ralf Jung
bc548d3004 test BTreeMap::drain_filter for leaks 2020-09-11 12:20:08 +02:00
Ralf Jung
e61be0b8b8 expand collection tests 2020-09-10 08:44:27 +02:00