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.
17 // lifted from the test module
18 // Inlining to avoid llvm turning the recursive functions into tail calls,
19 // which doesn't consume stack.
21 pub fn black_box<T>(dummy: T) { unsafe { asm!("" : : "r"(&dummy)) } }
24 let buf = [0, ..1000];
32 black_box(()); // don't optimize this into a tail call. please.
36 let args = os::args();
37 if args.len() > 1 && args[1].as_slice() == "silent" {
39 } else if args.len() > 1 && args[1].as_slice() == "loud" {
42 let silent = Process::output(args[0], ["silent".to_owned()]).unwrap();
43 assert!(!silent.status.success());
44 let error = str::from_utf8_lossy(silent.error.as_slice());
45 assert!(error.as_slice().contains("has overflowed its stack"));
47 let loud = Process::output(args[0], ["loud".to_owned()]).unwrap();
48 assert!(!loud.status.success());
49 let error = str::from_utf8_lossy(silent.error.as_slice());
50 assert!(error.as_slice().contains("has overflowed its stack"));