From ec79d368d2f9b56ac1d00825108b4e8b8bd26498 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 31 Jul 2014 08:13:25 -0700 Subject: [PATCH] Test fixes from the rollup Closes #16097 (fix variable name in tutorial) Closes #16100 (More defailbloating) Closes #16104 (Fix deprecation commment on `core::cmp::lexical_ordering`) Closes #16105 (fix formatting in pointer guide table) Closes #16107 (remove serialize::ebml, add librbml) Closes #16108 (Fix heading levels in pointer guide) Closes #16109 (rustrt: Don't conditionally init the at_exit QUEUE) Closes #16111 (hexfloat: Deprecate to move out of the repo) Closes #16113 (Add examples for GenericPath methods.) Closes #16115 (Byte literals!) Closes #16116 (Add a non-regression test for issue #8372) Closes #16120 (Deprecate semver) Closes #16124 (Deprecate uuid) Closes #16126 (Deprecate fourcc) Closes #16127 (Remove incorrect example) Closes #16129 (Add note about production deployments.) Closes #16131 (librustc: Don't ICE when trying to subst regions in destructor call.) Closes #16133 (librustc: Don't ICE with struct exprs where the name is not a valid struct.) Closes #16136 (Implement slice::Vector for Option and CVec) Closes #16137 (alloc, arena, test, url, uuid: Elide lifetimes.) --- src/librustrt/task.rs | 2 +- src/libuuid/lib.rs | 2 ++ src/test/auxiliary/lang-item-public.rs | 2 +- src/test/run-pass/backtrace.rs | 16 +++++++++++----- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/librustrt/task.rs b/src/librustrt/task.rs index e3d9b7d136e..5873c8273e7 100644 --- a/src/librustrt/task.rs +++ b/src/librustrt/task.rs @@ -649,7 +649,7 @@ mod test { #[should_fail] fn test_begin_unwind() { use std::rt::unwind::begin_unwind; - begin_unwind("cause", file!(), line!()) + begin_unwind("cause", &(file!(), line!())) } #[test] diff --git a/src/libuuid/lib.rs b/src/libuuid/lib.rs index 6a5148c4a94..2ffed792abd 100644 --- a/src/libuuid/lib.rs +++ b/src/libuuid/lib.rs @@ -29,6 +29,8 @@ unlikely. To create a new random (V4) UUID and print it out in hexadecimal form: ```rust +# #![allow(deprecated)] +# extern crate uuid; use uuid::Uuid; fn main() { diff --git a/src/test/auxiliary/lang-item-public.rs b/src/test/auxiliary/lang-item-public.rs index 7b84e11ef31..5723b59a60b 100644 --- a/src/test/auxiliary/lang-item-public.rs +++ b/src/test/auxiliary/lang-item-public.rs @@ -12,7 +12,7 @@ #![feature(lang_items)] #[lang="fail_"] -fn fail(_: &'static str, _: &'static str, _: uint) -> ! { loop {} } +fn fail(_: &(&'static str, &'static str, uint)) -> ! { loop {} } #[lang = "stack_exhausted"] extern fn stack_exhausted() {} diff --git a/src/test/run-pass/backtrace.rs b/src/test/run-pass/backtrace.rs index c2a1c01b919..0e4be12aa45 100644 --- a/src/test/run-pass/backtrace.rs +++ b/src/test/run-pass/backtrace.rs @@ -24,7 +24,10 @@ fn start(argc: int, argv: *const *const u8) -> int { #[inline(never)] fn foo() { - fail!() + let _v = vec![1i, 2, 3]; + if os::getenv("IS_TEST").is_some() { + fail!() + } } #[inline(never)] @@ -37,8 +40,11 @@ fn double() { } fn runtest(me: &str) { + let mut template = Command::new(me); + template.env("IS_TEST", "1"); + // Make sure that the stack trace is printed - let mut p = Command::new(me).arg("fail").env("RUST_BACKTRACE", "1").spawn().unwrap(); + let p = template.clone().arg("fail").env("RUST_BACKTRACE", "1").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success()); let s = str::from_utf8(out.error.as_slice()).unwrap(); @@ -46,7 +52,7 @@ fn runtest(me: &str) { "bad output: {}", s); // Make sure the stack trace is *not* printed - let mut p = Command::new(me).arg("fail").spawn().unwrap(); + let p = template.clone().arg("fail").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success()); let s = str::from_utf8(out.error.as_slice()).unwrap(); @@ -54,7 +60,7 @@ fn runtest(me: &str) { "bad output2: {}", s); // Make sure a stack trace is printed - let mut p = Command::new(me).arg("double-fail").spawn().unwrap(); + let p = template.clone().arg("double-fail").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success()); let s = str::from_utf8(out.error.as_slice()).unwrap(); @@ -62,7 +68,7 @@ fn runtest(me: &str) { "bad output3: {}", s); // Make sure a stack trace isn't printed too many times - let mut p = Command::new(me).arg("double-fail") + let p = template.clone().arg("double-fail") .env("RUST_BACKTRACE", "1").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success());