Skip to content
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

Fix a couple of compile-fail tests #376

Merged
merged 5 commits into from
Jun 5, 2018
Merged

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented May 9, 2018

failures:

---- [compile-fail] compile-fail/match_char.rs stdout ----

error: compile-fail test compiled successfully!
status: exit code: 0
command: "target/debug/miri" "tests/compile-fail/match_char.rs" "-L" "/tmp/compiletestpMJMuw" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/tmp/compiletestpMJMuw/match_char.stage-id" "--sysroot" "/home/bjorn/.xargo/HOST" "-Zmir-emit-validate=1" "-L" "/tmp/compiletestpMJMuw/match_char.stage-id.aux" "-A" "unused"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------

------------------------------------------

thread '[compile-fail] compile-fail/match_char.rs' panicked at 'explicit panic', /home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.3.11/src/runtest.rs:2544:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- [compile-fail] compile-fail/memleak.rs stdout ----

error: compile-fail test compiled successfully!
status: exit code: 0
command: "target/debug/miri" "tests/compile-fail/memleak.rs" "-L" "/tmp/compiletestpMJMuw" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "-o" "/tmp/compiletestpMJMuw/memleak.stage-id" "--sysroot" "/home/bjorn/.xargo/HOST" "-Zmir-emit-validate=1" "-L" "/tmp/compiletestpMJMuw/memleak.stage-id.aux" "-A" "unused"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------

------------------------------------------

thread '[compile-fail] compile-fail/memleak.rs' panicked at 'explicit panic', /home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.3.11/src/runtest.rs:2544:9

---- [compile-fail] compile-fail/memleak_rc.rs stdout ----

error: compile-fail test compiled successfully!
status: exit code: 0
command: "target/debug/miri" "tests/compile-fail/memleak_rc.rs" "-L" "/tmp/compiletestpMJMuw" "--target=x86_64-unknown-linux-gnu" "-C" "prefer-dynamic" "-o" "/tmp/compiletestpMJMuw/memleak_rc.stage-id" "--sysroot" "/home/bjorn/.xargo/HOST" "-Zmir-emit-validate=1" "-L" "/tmp/compiletestpMJMuw/memleak_rc.stage-id.aux" "-A" "unused"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------

------------------------------------------

thread '[compile-fail] compile-fail/memleak_rc.rs' panicked at 'explicit panic', /home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.3.11/src/runtest.rs:2544:9

---- [compile-fail] compile-fail/overflowing-rsh-2.rs stdout ----

error: compile-fail test compiled successfully!
status: exit code: 0
command: "target/debug/miri" "tests/compile-fail/overflowing-rsh-2.rs" "-L" "/tmp/compiletestpMJMuw" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/tmp/compiletestpMJMuw/overflowing-rsh-2.stage-id" "--sysroot" "/home/bjorn/.xargo/HOST" "-Zmir-emit-validate=1" "-L" "/tmp/compiletestpMJMuw/overflowing-rsh-2.stage-id.aux" "-A" "unused"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------

------------------------------------------

thread '[compile-fail] compile-fail/overflowing-rsh-2.rs' panicked at 'explicit panic', /home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.3.11/src/runtest.rs:2544:9

---- [compile-fail] compile-fail/static_memory_modification.rs stdout ----

error: compile-fail test compiled successfully!
status: exit code: 0
command: "target/debug/miri" "tests/compile-fail/static_memory_modification.rs" "-L" "/tmp/compiletestpMJMuw" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/tmp/compiletestpMJMuw/static_memory_modification.stage-id" "--sysroot" "/home/bjorn/.xargo/HOST" "-Zmir-emit-validate=1" "-L" "/tmp/compiletestpMJMuw/static_memory_modification.stage-id.aux" "-A" "unused"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------

------------------------------------------

thread '[compile-fail] compile-fail/static_memory_modification.rs' panicked at 'explicit panic', /home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.3.11/src/runtest.rs:2544:9


failures:
    [compile-fail] compile-fail/match_char.rs
    [compile-fail] compile-fail/memleak.rs
    [compile-fail] compile-fail/memleak_rc.rs
    [compile-fail] compile-fail/overflowing-rsh-2.rs
    [compile-fail] compile-fail/static_memory_modification.rs

test result: FAILED. 59 passed; 5 failed; 14 ignored; 0 measured; 0 filtered out

Edit: updated failure summary

@@ -1,17 +0,0 @@
// This should fail even without validation
Copy link
Member Author

Choose a reason for hiding this comment

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

This causes an ICE

Copy link
Member

Choose a reason for hiding this comment

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

That's a bug, isn't it? Why remove the test?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

still... ignoring it for now is better so we can add it once upstream fixes it

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see.

Is this reported upstream? The ignore-test comment should link to the issue.

Copy link
Member Author

@bjorn3 bjorn3 May 9, 2018

Choose a reason for hiding this comment

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

@@ -1,16 +0,0 @@
#![feature(alloc, allocator_api)]
Copy link
Member Author

Choose a reason for hiding this comment

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

This is simply not possible with the new api

Copy link
Member

Choose a reason for hiding this comment

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

How so? What's changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

realloc doesn't have a new alignment param anymore.

unsafe fn realloc(
    &self, 
    ptr: *mut Opaque, 
    layout: Layout, 
    new_size: usize
) -> *mut Opaque;

@@ -1,16 +0,0 @@
#![feature(alloc, allocator_api)]
Copy link
Member Author

Choose a reason for hiding this comment

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

This is simply not possible with the new api

@@ -1,3 +1,5 @@
// ignore-test
Copy link
Member Author

Choose a reason for hiding this comment

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

Takes too long

Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to make the array smaller and still get the failure?

If not I'd vote for just removing the test instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

fun fact: we don't have any limits except stack frame depth anymore. This test won't ever trigger the error

@oli-obk
Copy link
Contributor

oli-obk commented May 9, 2018

how were these not failing before? are they disabled by default?

@bjorn3
Copy link
Member Author

bjorn3 commented May 9, 2018

They are disabled by me at https://github.com/solson/miri/blob/0eb3c18565070e4af530e0ec0f707d99be7c5cef/tests/compiletest.rs#L206-L207 because most of them were just failing, because of the new error format

@oli-obk
Copy link
Contributor

oli-obk commented May 9, 2018

Can we turn them back on now? Or what are the next steps for doing that?

@bjorn3
Copy link
Member Author

bjorn3 commented May 9, 2018

Can we turn them back on now? Or what are the next steps for doing that?

Once all errors have been converted to the new error format. Sadly compile-test only detects the constant evaluation error [E0080] message, but not what caused the error like for example "a memory access tried to interpret some bytes as a pointer".

@oli-obk
Copy link
Contributor

oli-obk commented May 9, 2018

you should be able to add //~^ NOTE a memory access tried to interpret... in the line after the error

@bjorn3
Copy link
Member Author

bjorn3 commented May 9, 2018

Will try

Edit: it works, will convert them all

@bjorn3
Copy link
Member Author

bjorn3 commented May 9, 2018

Don't have time to convert them all right now. Some errors have either strange placement or different message.

Foo::B => {},
Foo::C => {},
Foo::D => {},
}
}
} //~ ERROR constant evaluation error [E0080]
Copy link
Member Author

Choose a reason for hiding this comment

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

Why here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why exactly here, but it's delayed because we don't have validation anymore

Copy link
Member Author

@bjorn3 bjorn3 left a comment

Choose a reason for hiding this comment

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

memleak.

@@ -1,6 +1,7 @@
fn main() {
assert!(std::char::from_u32(-1_i32 as u32).is_none());
match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ERROR tried to interpret an invalid 32-bit value as a char: 4294967295
match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR constant evaluation error [E0080]
Copy link
Member Author

Choose a reason for hiding this comment

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

This test doesn't error

@@ -12,5 +12,6 @@

fn main() {
// Make sure we catch overflows that would be hidden by first casting the RHS to u32
let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ Overflow(Shr)
let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ ERROR constant evaluation error [E0080]
Copy link
Member Author

Choose a reason for hiding this comment

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

This test doesn't error

@@ -3,7 +3,8 @@ static X: usize = 5;
#[allow(mutable_transmutes)]
fn main() {
unsafe {
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR: tried to modify constant memory
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR constant evaluation error [E0080]
Copy link
Member Author

Choose a reason for hiding this comment

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

Statics aren't marked static yet.

@@ -171,6 +171,7 @@ pub fn eval_main<'a, 'tcx: 'a>(
Ok(()) => {
let leaks = ecx.memory().leak_report();
if leaks != 0 {
// TODO: Prevent leaks which aren't supposed to be there
//tcx.sess.err("the evaluated program leaked memory");
Copy link
Member Author

Choose a reason for hiding this comment

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

Needs to be uncommented to allow memleak.rs and memleak_rc.rs to pass.

@@ -203,7 +203,7 @@ fn run_pass_rustc() {
}

#[test]
#[ignore] // TODO: update test errors
#[should_panic] // TODO: update test errors
Copy link
Member Author

Choose a reason for hiding this comment

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

Remove when all tests pass

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 1, 2018

Rebased on top of #376

@oli-obk
Copy link
Contributor

oli-obk commented Jun 3, 2018

can you rebase again?

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 5, 2018

Rebased

@oli-obk oli-obk merged commit 0755fd6 into rust-lang:master Jun 5, 2018
@oli-obk
Copy link
Contributor

oli-obk commented Jun 5, 2018

Thanks! I'm tracking the leftover failing tests in #382

@bjorn3 bjorn3 deleted the fix_some_tests branch June 5, 2018 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants