mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 06:22:00 +00:00
Test fixes and rebase conflicts
This commit switches over the backtrace infrastructure from piggy-backing off the RUST_LOG environment variable to using the RUST_BACKTRACE environment variable (logging is now disabled in libstd).
This commit is contained in:
parent
17ad504fef
commit
0015cab1fd
@ -82,7 +82,7 @@ DEPS_test := std collections getopts serialize term time
|
||||
DEPS_time := std serialize
|
||||
DEPS_rand := std
|
||||
DEPS_url := std collections
|
||||
DEPS_workcache := std serialize collections std
|
||||
DEPS_workcache := std serialize collections log
|
||||
DEPS_log := std sync
|
||||
|
||||
TOOL_DEPS_compiletest := test green rustuv getopts
|
||||
|
@ -51,6 +51,7 @@ li {list-style-type: none; }
|
||||
* [The `uuid` 128-bit universally unique identifier library](uuid/index.html)
|
||||
* [The `url` library](url/index.html)
|
||||
* [The `workcache` library](workcache/index.html)
|
||||
* [The `log` library](log/index.html)
|
||||
|
||||
# Tooling
|
||||
|
||||
|
@ -18,6 +18,7 @@ Simple compression
|
||||
#[crate_type = "rlib"];
|
||||
#[crate_type = "dylib"];
|
||||
#[license = "MIT/ASL2"];
|
||||
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
|
||||
html_root_url = "http://static.rust-lang.org/doc/master")];
|
||||
#[feature(phase)];
|
||||
|
@ -12,9 +12,24 @@
|
||||
|
||||
Utilities for program-wide and customizable logging
|
||||
|
||||
This module is used by the compiler when emitting output for the logging family
|
||||
of macros. The methods of this module shouldn't necessarily be used directly,
|
||||
but rather through the logging macros defined.
|
||||
## Example
|
||||
|
||||
```
|
||||
#[feature(phase)];
|
||||
#[phase(syntax, link)] extern crate log;
|
||||
|
||||
fn main() {
|
||||
debug!("this is a debug {}", "message");
|
||||
error!("this is printed by default");
|
||||
|
||||
if log_enabled!(log::INFO) {
|
||||
let x = 3 * 4; // expensive computation
|
||||
info!("the answer was: {}", x);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Logging Macros
|
||||
|
||||
There are five macros that the logging subsystem uses:
|
||||
|
||||
|
@ -238,7 +238,7 @@ impl Drop for Inner {
|
||||
if self.close_on_drop && self.fd > libc::STDERR_FILENO {
|
||||
let n = unsafe { libc::close(self.fd) };
|
||||
if n != 0 {
|
||||
warn!("error {} when closing file descriptor {}", n, self.fd);
|
||||
println!("error {} when closing file descriptor {}", n, self.fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,9 +70,12 @@ println!("{:?}", tuple_ptr)
|
||||
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
|
||||
html_root_url = "http://static.rust-lang.org/doc/master")];
|
||||
|
||||
#[feature(macro_rules, managed_boxes)];
|
||||
#[feature(macro_rules, managed_boxes, phase)];
|
||||
#[allow(deprecated_owned_vector)];
|
||||
|
||||
#[cfg(test)]
|
||||
#[phase(syntax, link)] extern crate log;
|
||||
|
||||
use std::cast;
|
||||
use std::kinds::marker;
|
||||
use std::local_data;
|
||||
|
@ -410,7 +410,7 @@ pub fn monitor(f: proc()) {
|
||||
let xs = [
|
||||
~"the compiler hit an unexpected failure path. this is a bug.",
|
||||
"we would appreciate a bug report: " + BUG_REPORT_URL,
|
||||
~"run with `RUST_LOG=std::rt::backtrace` for a backtrace",
|
||||
~"run with `RUST_BACKTRACE=1` for a backtrace",
|
||||
];
|
||||
for note in xs.iter() {
|
||||
emitter.emit(None, *note, diagnostic::Note)
|
||||
|
@ -176,7 +176,7 @@ impl CStore {
|
||||
RequireDynamic => src.dylib.clone(),
|
||||
RequireStatic => src.rlib.clone(),
|
||||
}))
|
||||
.collect();
|
||||
.collect::<Vec<(ast::CrateNum, Option<Path>)>>();
|
||||
libs.sort_by(|&(a, _), &(b, _)| {
|
||||
ordering.position_elem(&a).cmp(&ordering.position_elem(&b))
|
||||
});
|
||||
|
@ -1155,10 +1155,7 @@ impl MemoryMap {
|
||||
MapAddr(addr_) => { lpAddress = addr_ as LPVOID; },
|
||||
MapFd(fd_) => { fd = fd_; },
|
||||
MapOffset(offset_) => { offset = offset_; },
|
||||
MapNonStandardFlags(f) => {
|
||||
info!("MemoryMap::new: MapNonStandardFlags used on \
|
||||
Windows: {}", f)
|
||||
}
|
||||
MapNonStandardFlags(..) => {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1256,15 +1253,15 @@ impl Drop for MemoryMap {
|
||||
MapVirtual => {
|
||||
if libc::VirtualFree(self.data as *mut c_void, 0,
|
||||
libc::MEM_RELEASE) == 0 {
|
||||
error!("VirtualFree failed: {}", errno());
|
||||
println!("VirtualFree failed: {}", errno());
|
||||
}
|
||||
},
|
||||
MapFile(mapping) => {
|
||||
if libc::UnmapViewOfFile(self.data as LPCVOID) == FALSE {
|
||||
error!("UnmapViewOfFile failed: {}", errno());
|
||||
println!("UnmapViewOfFile failed: {}", errno());
|
||||
}
|
||||
if libc::CloseHandle(mapping as HANDLE) == FALSE {
|
||||
error!("CloseHandle failed: {}", errno());
|
||||
println!("CloseHandle failed: {}", errno());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,15 +16,31 @@ use from_str::from_str;
|
||||
use io::{IoResult, Writer};
|
||||
use iter::Iterator;
|
||||
use option::{Some, None};
|
||||
use os;
|
||||
use result::{Ok, Err};
|
||||
use str::StrSlice;
|
||||
use sync::atomics;
|
||||
|
||||
pub use self::imp::write;
|
||||
|
||||
// This function is defined in this module so that the way to enable logging of
|
||||
// backtraces has the word 'backtrace' in it: std::rt::backtrace.
|
||||
// For now logging is turned off by default, and this function checks to see
|
||||
// whether the magical environment variable is present to see if it's turned on.
|
||||
pub fn log_enabled() -> bool {
|
||||
log_enabled!(::logging::DEBUG)
|
||||
static mut ENABLED: atomics::AtomicInt = atomics::INIT_ATOMIC_INT;
|
||||
unsafe {
|
||||
match ENABLED.load(atomics::SeqCst) {
|
||||
1 => return false,
|
||||
2 => return true,
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
let val = match os::getenv("RUST_BACKTRACE") {
|
||||
Some(..) => 2,
|
||||
None => 1,
|
||||
};
|
||||
unsafe { ENABLED.store(val, atomics::SeqCst); }
|
||||
val == 2
|
||||
}
|
||||
|
||||
#[cfg(target_word_size = "64")] static HEX_WIDTH: uint = 18;
|
||||
|
@ -398,6 +398,8 @@ fn begin_unwind_inner(msg: ~Any, file: &'static str, line: uint) -> ! {
|
||||
if backtrace::log_enabled() {
|
||||
let mut err = ::rt::util::Stderr;
|
||||
let _err = backtrace::write(&mut err);
|
||||
} else {
|
||||
rterrln!("run with `RUST_BACKTRACE=1` to see a backtrace");
|
||||
}
|
||||
unsafe { intrinsics::abort() }
|
||||
}
|
||||
|
@ -21,10 +21,10 @@
|
||||
html_root_url = "http://static.rust-lang.org/doc/master")];
|
||||
#[feature(phase)];
|
||||
|
||||
#[cfg(test)] #[phase(syntax, link)] extern crate log;
|
||||
|
||||
#[allow(deprecated_owned_vector)];
|
||||
|
||||
#[cfg(test)] #[phase(syntax, link)] extern crate log;
|
||||
|
||||
pub use arc::{Arc, MutexArc, RWArc, RWWriteMode, RWReadMode, ArcCondvar, CowArc};
|
||||
pub use sync::{Mutex, RWLock, Condvar, Semaphore, RWLockWriteMode,
|
||||
RWLockReadMode, Barrier, one, mutex};
|
||||
|
@ -15,8 +15,10 @@
|
||||
#[doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
|
||||
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
|
||||
html_root_url = "http://static.rust-lang.org/doc/master")];
|
||||
#[feature(phase)];
|
||||
#[allow(deprecated_owned_vector, visible_private_types)];
|
||||
|
||||
#[phase(syntax, link)] extern crate log;
|
||||
extern crate serialize;
|
||||
extern crate collections;
|
||||
extern crate sync;
|
||||
|
@ -37,11 +37,11 @@ fn double() {
|
||||
|
||||
fn runtest(me: &str) {
|
||||
let mut env = os::env();
|
||||
match env.iter().position(|&(ref s, _)| "RUST_LOG" == *s) {
|
||||
match env.iter().position(|&(ref s, _)| "RUST_BACKTRACE" == *s) {
|
||||
Some(i) => { env.remove(i); }
|
||||
None => {}
|
||||
}
|
||||
env.push((~"RUST_LOG", ~"std::rt::backtrace"));
|
||||
env.push((~"RUST_BACKTRACE", ~"1"));
|
||||
|
||||
// Make sure that the stack trace is printed
|
||||
let mut p = Process::configure(ProcessConfig {
|
||||
|
@ -20,7 +20,7 @@ pub fn main() {
|
||||
}
|
||||
|
||||
fn child(c: &Sender<int>) {
|
||||
error!("sending");
|
||||
println!("sending");
|
||||
c.send(10);
|
||||
println!("value sent");
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
|
||||
|
||||
// ignore-test #12920
|
||||
|
||||
pub fn main() { if 1 == 1 { return; } println!("Paul is dead"); }
|
||||
|
@ -10,6 +10,8 @@
|
||||
|
||||
#[allow(unreachable_code)];
|
||||
|
||||
// ignore-test #12920
|
||||
|
||||
fn dont_call_me() { fail!(); println!("{}", 1); }
|
||||
|
||||
pub fn main() { }
|
||||
|
Loading…
Reference in New Issue
Block a user