1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 use std::io::process::Command;
16 // lifted from the test module
17 // Inlining to avoid llvm turning the recursive functions into tail calls,
18 // which doesn't consume stack.
20 pub fn black_box<T>(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } }
23 let buf = [0i, ..1000];
31 black_box(()); // don't optimize this into a tail call. please.
35 let args = os::args();
36 let args = args.as_slice();
37 if args.len() > 1 && args[1].as_slice() == "silent" {
39 } else if args.len() > 1 && args[1].as_slice() == "loud" {
42 let silent = Command::new(args[0].as_slice()).arg("silent").output().unwrap();
43 assert!(!silent.status.success());
44 let error = String::from_utf8_lossy(silent.error.as_slice());
45 // FIXME #17562: Windows is using stack probes and isn't wired up to print an error
47 assert!(error.as_slice().contains("has overflowed its stack"));
50 let loud = Command::new(args[0].as_slice()).arg("loud").output().unwrap();
51 assert!(!loud.status.success());
52 let error = String::from_utf8_lossy(silent.error.as_slice());
53 // FIXME #17562: Windows is using stack probes and isn't wired up to print an error
55 assert!(error.as_slice().contains("has overflowed its stack"));