Skip to content

rustup; fix tests for new MIR optimization #1729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ function run_tests {

./miri test --locked
if [ -z "${MIRI_TEST_TARGET+exists}" ]; then
# Only for host architecture: tests with MIR optimizations
MIRIFLAGS="-Z mir-opt-level=3" ./miri test --locked
# Only for host architecture: tests with optimizations (`-O` is what cargo passes, but crank MIR
# optimizations up all the way).
MIRIFLAGS="-O -Zmir-opt-level=3" ./miri test --locked
fi

# On Windows, there is always "python", not "python3" or "python2".
Expand Down
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
d2731d8e9338d8fe844e19d3fbb39617753e65f4
09db05762b283bed62d4f92729cfee4646519833
5 changes: 2 additions & 3 deletions tests/compile-fail/data_race/dealloc_read_race_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ pub fn main() {
// 3. stack-deallocate
unsafe {
let j1 = spawn(move || {
// Concurrent allocate the memory.
// Uses relaxed semantics to not generate
// a release sequence.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JCTyblaidd these comments seem to be wrong here; there is no allocation and also nothing relaxed anywhere nearby...

let pointer = &*ptr.0;
{
let mut stack_var = 0usize;
Expand All @@ -38,6 +35,8 @@ pub fn main() {

sleep(Duration::from_millis(200));

// Now `stack_var` gets deallocated.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JCTyblaidd I think this is right, would be good to check.


} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Read on Thread(id = 2)
});

Expand Down
52 changes: 0 additions & 52 deletions tests/compile-fail/data_race/dealloc_read_race_stack_drop.rs

This file was deleted.

5 changes: 2 additions & 3 deletions tests/compile-fail/data_race/dealloc_write_race_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ pub fn main() {
// 3. stack-deallocate
unsafe {
let j1 = spawn(move || {
// Concurrent allocate the memory.
// Uses relaxed semantics to not generate
// a release sequence.
let pointer = &*ptr.0;
{
let mut stack_var = 0usize;
Expand All @@ -38,6 +35,8 @@ pub fn main() {

sleep(Duration::from_millis(200));

// Now `stack_var` gets deallocated.

} //~ ERROR Data race detected between Deallocate on Thread(id = 1) and Write on Thread(id = 2)
});

Expand Down
53 changes: 0 additions & 53 deletions tests/compile-fail/data_race/dealloc_write_race_stack_drop.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore-windows: No libc on Windows
// error-pattern: deadlock

#![feature(rustc_private)]

Expand All @@ -8,6 +9,6 @@ fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_rdlock(rw.get()), 0);
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
libc::pthread_rwlock_wrlock(rw.get());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore-windows: No libc on Windows
// error-pattern: deadlock

#![feature(rustc_private)]

Expand All @@ -8,6 +9,6 @@ fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
libc::pthread_rwlock_rdlock(rw.get()); //~ ERROR: deadlock
libc::pthread_rwlock_rdlock(rw.get());
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ignore-windows: No libc on Windows
// error-pattern: deadlock

#![feature(rustc_private)]

Expand All @@ -8,6 +9,6 @@ fn main() {
let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER);
unsafe {
assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0);
libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock
libc::pthread_rwlock_wrlock(rw.get());
}
}