Remove uses of log
This commit is contained in:
parent
2fef18abf2
commit
82f190355b
222 changed files with 874 additions and 955 deletions
73
doc/rust.md
73
doc/rust.md
|
@ -212,7 +212,7 @@ do drop
|
||||||
else enum extern
|
else enum extern
|
||||||
false fn for
|
false fn for
|
||||||
if impl
|
if impl
|
||||||
let log loop
|
let loop
|
||||||
match mod mut
|
match mod mut
|
||||||
priv pub pure
|
priv pub pure
|
||||||
ref return
|
ref return
|
||||||
|
@ -805,21 +805,20 @@ Use declarations support a number of "convenience" notations:
|
||||||
An example of `use` declarations:
|
An example of `use` declarations:
|
||||||
|
|
||||||
~~~~
|
~~~~
|
||||||
use foo = core::info;
|
|
||||||
use core::float::sin;
|
use core::float::sin;
|
||||||
use core::str::{slice, to_upper};
|
use core::str::{slice, to_upper};
|
||||||
use core::option::Some;
|
use core::option::Some;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Equivalent to 'log(core::info, core::float::sin(1.0));'
|
// Equivalent to 'info!(core::float::sin(1.0));'
|
||||||
log(foo, sin(1.0));
|
info!(sin(1.0));
|
||||||
|
|
||||||
// Equivalent to 'log(core::info, core::option::Some(1.0));'
|
// Equivalent to 'info!(core::option::Some(1.0));'
|
||||||
log(info, Some(1.0));
|
info!(Some(1.0));
|
||||||
|
|
||||||
// Equivalent to 'log(core::info,
|
// Equivalent to
|
||||||
// core::str::to_upper(core::str::slice("foo", 0, 1)));'
|
// 'info!(core::str::to_upper(core::str::slice("foo", 0, 1)));'
|
||||||
log(info, to_upper(slice("foo", 0, 1)));
|
info!(to_upper(slice("foo", 0, 1)));
|
||||||
}
|
}
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
|
@ -990,7 +989,7 @@ output slot type would normally be. For example:
|
||||||
|
|
||||||
~~~~
|
~~~~
|
||||||
fn my_err(s: &str) -> ! {
|
fn my_err(s: &str) -> ! {
|
||||||
log(info, s);
|
info!(s);
|
||||||
fail!();
|
fail!();
|
||||||
}
|
}
|
||||||
~~~~
|
~~~~
|
||||||
|
@ -2397,58 +2396,6 @@ fn max(a: int, b: int) -> int {
|
||||||
}
|
}
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
### Log expressions
|
|
||||||
|
|
||||||
~~~~~~~~{.ebnf .gram}
|
|
||||||
log_expr : "log" '(' level ',' expr ')' ;
|
|
||||||
~~~~~~~~
|
|
||||||
|
|
||||||
Evaluating a `log` expression may, depending on runtime configuration, cause a
|
|
||||||
value to be appended to an internal diagnostic logging buffer provided by the
|
|
||||||
runtime or emitted to a system console. Log expressions are enabled or
|
|
||||||
disabled dynamically at run-time on a per-task and per-item basis. See
|
|
||||||
[logging system](#logging-system).
|
|
||||||
|
|
||||||
Each `log` expression must be provided with a *level* argument in
|
|
||||||
addition to the value to log. The logging level is a `u32` value, where
|
|
||||||
lower levels indicate more-urgent levels of logging. By default, the lowest
|
|
||||||
four logging levels (`1_u32 ... 4_u32`) are predefined as the constants
|
|
||||||
`error`, `warn`, `info` and `debug` in the `core` library.
|
|
||||||
|
|
||||||
Additionally, the macros `error!`, `warn!`, `info!` and `debug!` are defined
|
|
||||||
in the default syntax-extension namespace. These expand into calls to the
|
|
||||||
logging facility composed with calls to the `fmt!` string formatting
|
|
||||||
syntax-extension.
|
|
||||||
|
|
||||||
The following examples all produce the same output, logged at the `error`
|
|
||||||
logging level:
|
|
||||||
|
|
||||||
~~~~
|
|
||||||
# let filename = "bulbasaur";
|
|
||||||
|
|
||||||
// Full version, logging a value.
|
|
||||||
log(core::error, ~"file not found: " + filename);
|
|
||||||
|
|
||||||
// Log-level abbreviated, since core::* is used by default.
|
|
||||||
log(error, ~"file not found: " + filename);
|
|
||||||
|
|
||||||
// Formatting the message using a format-string and fmt!
|
|
||||||
log(error, fmt!("file not found: %s", filename));
|
|
||||||
|
|
||||||
// Using the error! macro, that expands to the previous call.
|
|
||||||
error!("file not found: %s", filename);
|
|
||||||
~~~~
|
|
||||||
|
|
||||||
A `log` expression is *not evaluated* when logging at the specified logging-level, module or task is disabled at runtime.
|
|
||||||
This makes inactive `log` expressions very cheap;
|
|
||||||
they should be used extensively in Rust code, as diagnostic aids,
|
|
||||||
as they add little overhead beyond a single integer-compare and branch at runtime.
|
|
||||||
|
|
||||||
Logging is presently implemented as a language built-in feature,
|
|
||||||
as it makes use of compiler-provided, per-module data tables and flags.
|
|
||||||
In the future, logging will move into a library, and will no longer be a core expression type.
|
|
||||||
It is therefore recommended to use the macro forms of logging (`error!`, `debug!`, etc.) to minimize disruption in code that uses logging.
|
|
||||||
|
|
||||||
|
|
||||||
# Type system
|
# Type system
|
||||||
|
|
||||||
|
@ -3149,7 +3096,7 @@ communication facilities.
|
||||||
|
|
||||||
The runtime contains a system for directing [logging
|
The runtime contains a system for directing [logging
|
||||||
expressions](#log-expressions) to a logging console and/or internal logging
|
expressions](#log-expressions) to a logging console and/or internal logging
|
||||||
buffers. Logging expressions can be enabled per module.
|
buffers. Logging can be enabled per module.
|
||||||
|
|
||||||
Logging output is enabled by setting the `RUST_LOG` environment
|
Logging output is enabled by setting the `RUST_LOG` environment
|
||||||
variable. `RUST_LOG` accepts a logging specification made up of a
|
variable. `RUST_LOG` accepts a logging specification made up of a
|
||||||
|
|
|
@ -744,7 +744,7 @@ unit, `()`, as the empty tuple if you like).
|
||||||
~~~~
|
~~~~
|
||||||
let mytup: (int, int, float) = (10, 20, 30.0);
|
let mytup: (int, int, float) = (10, 20, 30.0);
|
||||||
match mytup {
|
match mytup {
|
||||||
(a, b, c) => log(info, a + b + (c as int))
|
(a, b, c) => info!(a + b + (c as int))
|
||||||
}
|
}
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
|
@ -760,7 +760,7 @@ For example:
|
||||||
struct MyTup(int, int, float);
|
struct MyTup(int, int, float);
|
||||||
let mytup: MyTup = MyTup(10, 20, 30.0);
|
let mytup: MyTup = MyTup(10, 20, 30.0);
|
||||||
match mytup {
|
match mytup {
|
||||||
MyTup(a, b, c) => log(info, a + b + (c as int))
|
MyTup(a, b, c) => info!(a + b + (c as int))
|
||||||
}
|
}
|
||||||
~~~~
|
~~~~
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,6 @@ pub fn path_div() -> ~str { ~":" }
|
||||||
pub fn path_div() -> ~str { ~";" }
|
pub fn path_div() -> ~str { ~";" }
|
||||||
|
|
||||||
pub fn logv(config: config, s: ~str) {
|
pub fn logv(config: config, s: ~str) {
|
||||||
log(debug, s);
|
debug!("%s", s);
|
||||||
if config.verbose { io::println(s); }
|
if config.verbose { io::println(s); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -683,7 +683,7 @@ impl Writer for *libc::FILE {
|
||||||
*self);
|
*self);
|
||||||
if nout != len as size_t {
|
if nout != len as size_t {
|
||||||
error!("error writing buffer");
|
error!("error writing buffer");
|
||||||
log(error, os::last_os_error());
|
error!("%s", os::last_os_error());
|
||||||
fail!();
|
fail!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -733,7 +733,7 @@ impl Writer for fd_t {
|
||||||
let nout = libc::write(*self, vb, len as size_t);
|
let nout = libc::write(*self, vb, len as size_t);
|
||||||
if nout < 0 as ssize_t {
|
if nout < 0 as ssize_t {
|
||||||
error!("error writing buffer");
|
error!("error writing buffer");
|
||||||
log(error, os::last_os_error());
|
error!("%s", os::last_os_error());
|
||||||
fail!();
|
fail!();
|
||||||
}
|
}
|
||||||
count += nout as uint;
|
count += nout as uint;
|
||||||
|
@ -1288,7 +1288,6 @@ pub mod fsync {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use debug;
|
|
||||||
use i32;
|
use i32;
|
||||||
use io::{BytesWriter, SeekCur, SeekEnd, SeekSet};
|
use io::{BytesWriter, SeekCur, SeekEnd, SeekSet};
|
||||||
use io;
|
use io;
|
||||||
|
@ -1301,10 +1300,10 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simple() {
|
fn test_simple() {
|
||||||
let tmpfile = &Path("tmp/lib-io-test-simple.tmp");
|
let tmpfile = &Path("tmp/lib-io-test-simple.tmp");
|
||||||
log(debug, tmpfile);
|
debug!(tmpfile);
|
||||||
let frood: ~str =
|
let frood: ~str =
|
||||||
~"A hoopy frood who really knows where his towel is.";
|
~"A hoopy frood who really knows where his towel is.";
|
||||||
log(debug, copy frood);
|
debug!(copy frood);
|
||||||
{
|
{
|
||||||
let out: io::Writer =
|
let out: io::Writer =
|
||||||
result::get(
|
result::get(
|
||||||
|
@ -1313,7 +1312,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
let inp: io::Reader = result::get(&io::file_reader(tmpfile));
|
let inp: io::Reader = result::get(&io::file_reader(tmpfile));
|
||||||
let frood2: ~str = inp.read_c_str();
|
let frood2: ~str = inp.read_c_str();
|
||||||
log(debug, copy frood2);
|
debug!(copy frood2);
|
||||||
fail_unless!(frood == frood2);
|
fail_unless!(frood == frood2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,8 +208,8 @@ pub fn env() -> ~[(~str,~str)] {
|
||||||
let mut result = ~[];
|
let mut result = ~[];
|
||||||
ptr::array_each(environ, |e| {
|
ptr::array_each(environ, |e| {
|
||||||
let env_pair = str::raw::from_c_str(e);
|
let env_pair = str::raw::from_c_str(e);
|
||||||
log(debug, fmt!("get_env_pairs: %s",
|
debug!("get_env_pairs: %s",
|
||||||
env_pair));
|
env_pair);
|
||||||
result.push(env_pair);
|
result.push(env_pair);
|
||||||
});
|
});
|
||||||
result
|
result
|
||||||
|
@ -219,9 +219,8 @@ pub fn env() -> ~[(~str,~str)] {
|
||||||
let mut pairs = ~[];
|
let mut pairs = ~[];
|
||||||
for input.each |p| {
|
for input.each |p| {
|
||||||
let vs = str::splitn_char(*p, '=', 1);
|
let vs = str::splitn_char(*p, '=', 1);
|
||||||
log(debug,
|
debug!("splitting: len: %u",
|
||||||
fmt!("splitting: len: %u",
|
vs.len());
|
||||||
vs.len()));
|
|
||||||
fail_unless!(vs.len() == 2);
|
fail_unless!(vs.len() == 2);
|
||||||
pairs.push((copy vs[0], copy vs[1]));
|
pairs.push((copy vs[0], copy vs[1]));
|
||||||
}
|
}
|
||||||
|
@ -682,10 +681,10 @@ pub fn list_dir(p: &Path) -> ~[~str] {
|
||||||
let input = p.to_str();
|
let input = p.to_str();
|
||||||
let mut strings = ~[];
|
let mut strings = ~[];
|
||||||
let input_ptr = ::cast::transmute(&input[0]);
|
let input_ptr = ::cast::transmute(&input[0]);
|
||||||
log(debug, "os::list_dir -- BEFORE OPENDIR");
|
debug!("os::list_dir -- BEFORE OPENDIR");
|
||||||
let dir_ptr = opendir(input_ptr);
|
let dir_ptr = opendir(input_ptr);
|
||||||
if (dir_ptr as uint != 0) {
|
if (dir_ptr as uint != 0) {
|
||||||
log(debug, "os::list_dir -- opendir() SUCCESS");
|
debug!("os::list_dir -- opendir() SUCCESS");
|
||||||
let mut entry_ptr = readdir(dir_ptr);
|
let mut entry_ptr = readdir(dir_ptr);
|
||||||
while (entry_ptr as uint != 0) {
|
while (entry_ptr as uint != 0) {
|
||||||
strings.push(
|
strings.push(
|
||||||
|
@ -697,11 +696,11 @@ pub fn list_dir(p: &Path) -> ~[~str] {
|
||||||
closedir(dir_ptr);
|
closedir(dir_ptr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, "os::list_dir -- opendir() FAILURE");
|
debug!("os::list_dir -- opendir() FAILURE");
|
||||||
}
|
}
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("os::list_dir -- AFTER -- #: %?",
|
"os::list_dir -- AFTER -- #: %?",
|
||||||
strings.len()));
|
strings.len());
|
||||||
strings
|
strings
|
||||||
}
|
}
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
@ -1258,7 +1257,6 @@ pub mod consts {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[allow(non_implicitly_copyable_typarams)]
|
#[allow(non_implicitly_copyable_typarams)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use debug;
|
|
||||||
use libc::{c_int, c_void, size_t};
|
use libc::{c_int, c_void, size_t};
|
||||||
use libc;
|
use libc;
|
||||||
use option::{None, Option, Some};
|
use option::{None, Option, Some};
|
||||||
|
@ -1274,7 +1272,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
pub fn last_os_error() {
|
pub fn last_os_error() {
|
||||||
log(debug, os::last_os_error());
|
debug!(os::last_os_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1320,7 +1318,7 @@ mod tests {
|
||||||
while i < 100 { s += ~"aaaaaaaaaa"; i += 1; }
|
while i < 100 { s += ~"aaaaaaaaaa"; i += 1; }
|
||||||
let n = make_rand_name();
|
let n = make_rand_name();
|
||||||
setenv(n, s);
|
setenv(n, s);
|
||||||
log(debug, copy s);
|
debug!(copy s);
|
||||||
fail_unless!(getenv(n) == option::Some(s));
|
fail_unless!(getenv(n) == option::Some(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1329,7 +1327,7 @@ mod tests {
|
||||||
let path = os::self_exe_path();
|
let path = os::self_exe_path();
|
||||||
fail_unless!(path.is_some());
|
fail_unless!(path.is_some());
|
||||||
let path = path.get();
|
let path = path.get();
|
||||||
log(debug, copy path);
|
debug!(copy path);
|
||||||
|
|
||||||
// Hard to test this function
|
// Hard to test this function
|
||||||
fail_unless!(path.is_absolute);
|
fail_unless!(path.is_absolute);
|
||||||
|
@ -1342,7 +1340,7 @@ mod tests {
|
||||||
fail_unless!(vec::len(e) > 0u);
|
fail_unless!(vec::len(e) > 0u);
|
||||||
for vec::each(e) |p| {
|
for vec::each(e) |p| {
|
||||||
let (n, v) = copy *p;
|
let (n, v) = copy *p;
|
||||||
log(debug, copy n);
|
debug!(copy n);
|
||||||
let v2 = getenv(n);
|
let v2 = getenv(n);
|
||||||
// MingW seems to set some funky environment variables like
|
// MingW seems to set some funky environment variables like
|
||||||
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
|
// "=C:=C:\MinGW\msys\1.0\bin" and "!::=::\" that are returned
|
||||||
|
@ -1367,10 +1365,10 @@ mod tests {
|
||||||
fn test() {
|
fn test() {
|
||||||
fail_unless!((!Path("test-path").is_absolute));
|
fail_unless!((!Path("test-path").is_absolute));
|
||||||
|
|
||||||
log(debug, ~"Current working directory: " + getcwd().to_str());
|
debug!(~"Current working directory: " + getcwd().to_str());
|
||||||
|
|
||||||
log(debug, make_absolute(&Path("test-path")));
|
debug!(make_absolute(&Path("test-path")));
|
||||||
log(debug, make_absolute(&Path("/usr/bin")));
|
debug!(make_absolute(&Path("/usr/bin")));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1433,7 +1431,7 @@ mod tests {
|
||||||
fail_unless!((vec::len(dirs) > 0u));
|
fail_unless!((vec::len(dirs) > 0u));
|
||||||
|
|
||||||
for vec::each(dirs) |dir| {
|
for vec::each(dirs) |dir| {
|
||||||
log(debug, copy *dir);
|
debug!(copy *dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ use sys;
|
||||||
#[cfg(test)] use vec;
|
#[cfg(test)] use vec;
|
||||||
#[cfg(test)] use str;
|
#[cfg(test)] use str;
|
||||||
#[cfg(notest)] use cmp::{Eq, Ord};
|
#[cfg(notest)] use cmp::{Eq, Ord};
|
||||||
use debug;
|
|
||||||
use uint;
|
use uint;
|
||||||
|
|
||||||
pub mod libc_ {
|
pub mod libc_ {
|
||||||
|
@ -191,7 +190,7 @@ pub pure fn ref_eq<T>(thing: &a/T, other: &b/T) -> bool {
|
||||||
SAFETY NOTE: Pointer-arithmetic. Dragons be here.
|
SAFETY NOTE: Pointer-arithmetic. Dragons be here.
|
||||||
*/
|
*/
|
||||||
pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: &fn(*T)) {
|
pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: &fn(*T)) {
|
||||||
log(debug, "array_each_with_len: before iterate");
|
debug!("array_each_with_len: before iterate");
|
||||||
if (arr as uint == 0) {
|
if (arr as uint == 0) {
|
||||||
fail!(~"ptr::array_each_with_len failure: arr input is null pointer");
|
fail!(~"ptr::array_each_with_len failure: arr input is null pointer");
|
||||||
}
|
}
|
||||||
|
@ -201,7 +200,7 @@ pub unsafe fn array_each_with_len<T>(arr: **T, len: uint, cb: &fn(*T)) {
|
||||||
cb(*n);
|
cb(*n);
|
||||||
true
|
true
|
||||||
});
|
});
|
||||||
log(debug, "array_each_with_len: after iterate");
|
debug!("array_each_with_len: after iterate");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -218,8 +217,8 @@ pub unsafe fn array_each<T>(arr: **T, cb: &fn(*T)) {
|
||||||
fail!(~"ptr::array_each_with_len failure: arr input is null pointer");
|
fail!(~"ptr::array_each_with_len failure: arr input is null pointer");
|
||||||
}
|
}
|
||||||
let len = buf_len(arr);
|
let len = buf_len(arr);
|
||||||
log(debug, fmt!("array_each inferred len: %u",
|
debug!("array_each inferred len: %u",
|
||||||
len));
|
len);
|
||||||
array_each_with_len(arr, len, cb);
|
array_each_with_len(arr, len, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +433,6 @@ pub fn test_is_null() {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod ptr_tests {
|
pub mod ptr_tests {
|
||||||
use debug;
|
|
||||||
use ptr;
|
use ptr;
|
||||||
use str;
|
use str;
|
||||||
use libc;
|
use libc;
|
||||||
|
@ -460,9 +458,9 @@ pub mod ptr_tests {
|
||||||
|e| {
|
|e| {
|
||||||
let actual = str::raw::from_c_str(e);
|
let actual = str::raw::from_c_str(e);
|
||||||
let expected = copy expected_arr[ctr];
|
let expected = copy expected_arr[ctr];
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("test_ptr_array_each e: %s, a: %s",
|
"test_ptr_array_each e: %s, a: %s",
|
||||||
expected, actual));
|
expected, actual);
|
||||||
fail_unless!(actual == expected);
|
fail_unless!(actual == expected);
|
||||||
ctr += 1;
|
ctr += 1;
|
||||||
iteration_count += 1;
|
iteration_count += 1;
|
||||||
|
@ -492,9 +490,9 @@ pub mod ptr_tests {
|
||||||
ptr::array_each(arr_ptr, |e| {
|
ptr::array_each(arr_ptr, |e| {
|
||||||
let actual = str::raw::from_c_str(e);
|
let actual = str::raw::from_c_str(e);
|
||||||
let expected = copy expected_arr[ctr];
|
let expected = copy expected_arr[ctr];
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("test_ptr_array_each e: %s, a: %s",
|
"test_ptr_array_each e: %s, a: %s",
|
||||||
expected, actual));
|
expected, actual);
|
||||||
fail_unless!(actual == expected);
|
fail_unless!(actual == expected);
|
||||||
ctr += 1;
|
ctr += 1;
|
||||||
iteration_count += 1;
|
iteration_count += 1;
|
||||||
|
|
|
@ -494,7 +494,6 @@ pub fn random() -> uint {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
pub mod tests {
|
pub mod tests {
|
||||||
use debug;
|
|
||||||
use option::{None, Option, Some};
|
use option::{None, Option, Some};
|
||||||
use rand;
|
use rand;
|
||||||
|
|
||||||
|
@ -563,7 +562,7 @@ pub mod tests {
|
||||||
let r = rand::Rng();
|
let r = rand::Rng();
|
||||||
let a = r.gen_float();
|
let a = r.gen_float();
|
||||||
let b = r.gen_float();
|
let b = r.gen_float();
|
||||||
log(debug, (a, b));
|
debug!((a, b));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -576,9 +575,9 @@ pub mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
pub fn gen_str() {
|
pub fn gen_str() {
|
||||||
let r = rand::Rng();
|
let r = rand::Rng();
|
||||||
log(debug, r.gen_str(10u));
|
debug!(r.gen_str(10u));
|
||||||
log(debug, r.gen_str(10u));
|
debug!(r.gen_str(10u));
|
||||||
log(debug, r.gen_str(10u));
|
debug!(r.gen_str(10u));
|
||||||
fail_unless!(r.gen_str(0u).len() == 0u);
|
fail_unless!(r.gen_str(0u).len() == 0u);
|
||||||
fail_unless!(r.gen_str(10u).len() == 10u);
|
fail_unless!(r.gen_str(10u).len() == 10u);
|
||||||
fail_unless!(r.gen_str(16u).len() == 16u);
|
fail_unless!(r.gen_str(16u).len() == 16u);
|
||||||
|
|
|
@ -458,7 +458,6 @@ pub fn waitpid(pid: pid_t) -> int {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use debug;
|
|
||||||
use option::{None, Some};
|
use option::{None, Some};
|
||||||
use os;
|
use os;
|
||||||
use run::{readclose, writeclose};
|
use run::{readclose, writeclose};
|
||||||
|
@ -494,8 +493,8 @@ mod tests {
|
||||||
readclose(pipe_err.in);
|
readclose(pipe_err.in);
|
||||||
os::waitpid(pid);
|
os::waitpid(pid);
|
||||||
|
|
||||||
log(debug, copy expected);
|
debug!(copy expected);
|
||||||
log(debug, copy actual);
|
debug!(copy actual);
|
||||||
fail_unless!((expected == actual));
|
fail_unless!((expected == actual));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2437,7 +2437,6 @@ impl OwnedStr for ~str {
|
||||||
mod tests {
|
mod tests {
|
||||||
use char;
|
use char;
|
||||||
use option::Some;
|
use option::Some;
|
||||||
use debug;
|
|
||||||
use libc::c_char;
|
use libc::c_char;
|
||||||
use libc;
|
use libc;
|
||||||
use ptr;
|
use ptr;
|
||||||
|
@ -2523,7 +2522,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_split_char() {
|
fn test_split_char() {
|
||||||
fn t(s: &str, c: char, u: &[~str]) {
|
fn t(s: &str, c: char, u: &[~str]) {
|
||||||
log(debug, ~"split_byte: " + s);
|
debug!(~"split_byte: " + s);
|
||||||
let v = split_char(s, c);
|
let v = split_char(s, c);
|
||||||
debug!("split_byte to: %?", v);
|
debug!("split_byte to: %?", v);
|
||||||
fail_unless!(vec::all2(v, u, |a,b| a == b));
|
fail_unless!(vec::all2(v, u, |a,b| a == b));
|
||||||
|
@ -2552,7 +2551,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_splitn_char() {
|
fn test_splitn_char() {
|
||||||
fn t(s: &str, c: char, n: uint, u: &[~str]) {
|
fn t(s: &str, c: char, n: uint, u: &[~str]) {
|
||||||
log(debug, ~"splitn_byte: " + s);
|
debug!(~"splitn_byte: " + s);
|
||||||
let v = splitn_char(s, c, n);
|
let v = splitn_char(s, c, n);
|
||||||
debug!("split_byte to: %?", v);
|
debug!("split_byte to: %?", v);
|
||||||
debug!("comparing vs. %?", u);
|
debug!("comparing vs. %?", u);
|
||||||
|
@ -3192,8 +3191,8 @@ mod tests {
|
||||||
while i < n1 {
|
while i < n1 {
|
||||||
let a: u8 = s1[i];
|
let a: u8 = s1[i];
|
||||||
let b: u8 = s2[i];
|
let b: u8 = s2[i];
|
||||||
log(debug, a);
|
debug!(a);
|
||||||
log(debug, b);
|
debug!(b);
|
||||||
fail_unless!((a == b));
|
fail_unless!((a == b));
|
||||||
i += 1u;
|
i += 1u;
|
||||||
}
|
}
|
||||||
|
|
|
@ -930,8 +930,8 @@ pub unsafe fn tcp_connect(connect_ptr: *uv_connect_t,
|
||||||
addr_ptr: *sockaddr_in,
|
addr_ptr: *sockaddr_in,
|
||||||
after_connect_cb: *u8)
|
after_connect_cb: *u8)
|
||||||
-> libc::c_int {
|
-> libc::c_int {
|
||||||
log(debug, fmt!("b4 foreign tcp_connect--addr port: %u cb: %u",
|
debug!("b4 foreign tcp_connect--addr port: %u cb: %u",
|
||||||
(*addr_ptr).sin_port as uint, after_connect_cb as uint));
|
(*addr_ptr).sin_port as uint, after_connect_cb as uint);
|
||||||
return rustrt::rust_uv_tcp_connect(connect_ptr, tcp_handle_ptr,
|
return rustrt::rust_uv_tcp_connect(connect_ptr, tcp_handle_ptr,
|
||||||
after_connect_cb, addr_ptr);
|
after_connect_cb, addr_ptr);
|
||||||
}
|
}
|
||||||
|
@ -1021,20 +1021,20 @@ pub unsafe fn async_send(async_handle: *uv_async_t) {
|
||||||
pub unsafe fn buf_init(input: *u8, len: uint) -> uv_buf_t {
|
pub unsafe fn buf_init(input: *u8, len: uint) -> uv_buf_t {
|
||||||
let out_buf = uv_buf_t { base: ptr::null(), len: 0 as libc::size_t };
|
let out_buf = uv_buf_t { base: ptr::null(), len: 0 as libc::size_t };
|
||||||
let out_buf_ptr = ptr::addr_of(&out_buf);
|
let out_buf_ptr = ptr::addr_of(&out_buf);
|
||||||
log(debug, fmt!("buf_init - input %u len %u out_buf: %u",
|
debug!("buf_init - input %u len %u out_buf: %u",
|
||||||
input as uint,
|
input as uint,
|
||||||
len as uint,
|
len as uint,
|
||||||
out_buf_ptr as uint));
|
out_buf_ptr as uint);
|
||||||
// yuck :/
|
// yuck :/
|
||||||
rustrt::rust_uv_buf_init(out_buf_ptr, input, len as size_t);
|
rustrt::rust_uv_buf_init(out_buf_ptr, input, len as size_t);
|
||||||
//let result = rustrt::rust_uv_buf_init_2(input, len as size_t);
|
//let result = rustrt::rust_uv_buf_init_2(input, len as size_t);
|
||||||
log(debug, ~"after rust_uv_buf_init");
|
debug!("after rust_uv_buf_init");
|
||||||
let res_base = get_base_from_buf(out_buf);
|
let res_base = get_base_from_buf(out_buf);
|
||||||
let res_len = get_len_from_buf(out_buf);
|
let res_len = get_len_from_buf(out_buf);
|
||||||
//let res_base = get_base_from_buf(result);
|
//let res_base = get_base_from_buf(result);
|
||||||
log(debug, fmt!("buf_init - result %u len %u",
|
debug!("buf_init - result %u len %u",
|
||||||
res_base as uint,
|
res_base as uint,
|
||||||
res_len as uint));
|
res_len as uint);
|
||||||
return out_buf;
|
return out_buf;
|
||||||
//return result;
|
//return result;
|
||||||
}
|
}
|
||||||
|
@ -1078,8 +1078,8 @@ pub unsafe fn ip6_name(src: &sockaddr_in6) -> ~str {
|
||||||
0u8,0u8,0u8,0u8,0u8,0u8];
|
0u8,0u8,0u8,0u8,0u8,0u8];
|
||||||
do vec::as_imm_buf(dst) |dst_buf, size| {
|
do vec::as_imm_buf(dst) |dst_buf, size| {
|
||||||
let src_unsafe_ptr = to_unsafe_ptr(src);
|
let src_unsafe_ptr = to_unsafe_ptr(src);
|
||||||
log(debug, fmt!("val of src *sockaddr_in6: %? sockaddr_in6: %?",
|
debug!("val of src *sockaddr_in6: %? sockaddr_in6: %?",
|
||||||
src_unsafe_ptr, src));
|
src_unsafe_ptr, src);
|
||||||
let result = rustrt::rust_uv_ip6_name(src_unsafe_ptr,
|
let result = rustrt::rust_uv_ip6_name(src_unsafe_ptr,
|
||||||
dst_buf, size as libc::size_t);
|
dst_buf, size as libc::size_t);
|
||||||
match result {
|
match result {
|
||||||
|
@ -1257,20 +1257,20 @@ pub mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fn after_close_cb(handle: *libc::c_void) {
|
extern fn after_close_cb(handle: *libc::c_void) {
|
||||||
log(debug, fmt!("after uv_close! handle ptr: %?",
|
debug!("after uv_close! handle ptr: %?",
|
||||||
handle));
|
handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fn on_alloc_cb(handle: *libc::c_void,
|
extern fn on_alloc_cb(handle: *libc::c_void,
|
||||||
suggested_size: libc::size_t)
|
suggested_size: libc::size_t)
|
||||||
-> uv_buf_t {
|
-> uv_buf_t {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, ~"on_alloc_cb!");
|
debug!("on_alloc_cb!");
|
||||||
let char_ptr = malloc_buf_base_of(suggested_size);
|
let char_ptr = malloc_buf_base_of(suggested_size);
|
||||||
log(debug, fmt!("on_alloc_cb h: %? char_ptr: %u sugsize: %u",
|
debug!("on_alloc_cb h: %? char_ptr: %u sugsize: %u",
|
||||||
handle,
|
handle,
|
||||||
char_ptr as uint,
|
char_ptr as uint,
|
||||||
suggested_size as uint));
|
suggested_size as uint);
|
||||||
return buf_init(char_ptr, suggested_size as uint);
|
return buf_init(char_ptr, suggested_size as uint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1280,11 +1280,11 @@ pub mod test {
|
||||||
++buf: uv_buf_t) {
|
++buf: uv_buf_t) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let nread = nread as int;
|
let nread = nread as int;
|
||||||
log(debug, fmt!("CLIENT entering on_read_cb nred: %d",
|
debug!("CLIENT entering on_read_cb nred: %d",
|
||||||
nread));
|
nread);
|
||||||
if (nread > 0) {
|
if (nread > 0) {
|
||||||
// we have data
|
// we have data
|
||||||
log(debug, fmt!("CLIENT read: data! nread: %d", nread));
|
debug!("CLIENT read: data! nread: %d", nread);
|
||||||
read_stop(stream);
|
read_stop(stream);
|
||||||
let client_data =
|
let client_data =
|
||||||
get_data_for_uv_handle(stream as *libc::c_void)
|
get_data_for_uv_handle(stream as *libc::c_void)
|
||||||
|
@ -1298,65 +1298,65 @@ pub mod test {
|
||||||
}
|
}
|
||||||
else if (nread == -1) {
|
else if (nread == -1) {
|
||||||
// err .. possibly EOF
|
// err .. possibly EOF
|
||||||
log(debug, ~"read: eof!");
|
debug!("read: eof!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// nread == 0 .. do nothing, just free buf as below
|
// nread == 0 .. do nothing, just free buf as below
|
||||||
log(debug, ~"read: do nothing!");
|
debug!("read: do nothing!");
|
||||||
}
|
}
|
||||||
// when we're done
|
// when we're done
|
||||||
free_base_of_buf(buf);
|
free_base_of_buf(buf);
|
||||||
log(debug, ~"CLIENT exiting on_read_cb");
|
debug!("CLIENT exiting on_read_cb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fn on_write_complete_cb(write_req: *uv_write_t,
|
extern fn on_write_complete_cb(write_req: *uv_write_t,
|
||||||
status: libc::c_int) {
|
status: libc::c_int) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("CLIENT beginning on_write_complete_cb status: %d",
|
"CLIENT beginning on_write_complete_cb status: %d",
|
||||||
status as int));
|
status as int);
|
||||||
let stream = get_stream_handle_from_write_req(write_req);
|
let stream = get_stream_handle_from_write_req(write_req);
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("CLIENT on_write_complete_cb: tcp:%d write_handle:%d",
|
"CLIENT on_write_complete_cb: tcp:%d write_handle:%d",
|
||||||
stream as int, write_req as int));
|
stream as int, write_req as int);
|
||||||
let result = read_start(stream, on_alloc_cb, on_read_cb);
|
let result = read_start(stream, on_alloc_cb, on_read_cb);
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("CLIENT ending on_write_complete_cb .. status: %d",
|
"CLIENT ending on_write_complete_cb .. status: %d",
|
||||||
result as int));
|
result as int);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fn on_connect_cb(connect_req_ptr: *uv_connect_t,
|
extern fn on_connect_cb(connect_req_ptr: *uv_connect_t,
|
||||||
status: libc::c_int) {
|
status: libc::c_int) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("beginning on_connect_cb .. status: %d",
|
debug!("beginning on_connect_cb .. status: %d",
|
||||||
status as int));
|
status as int);
|
||||||
let stream =
|
let stream =
|
||||||
get_stream_handle_from_connect_req(connect_req_ptr);
|
get_stream_handle_from_connect_req(connect_req_ptr);
|
||||||
if (status == 0i32) {
|
if (status == 0i32) {
|
||||||
log(debug, ~"on_connect_cb: in status=0 if..");
|
debug!("on_connect_cb: in status=0 if..");
|
||||||
let client_data = get_data_for_req(
|
let client_data = get_data_for_req(
|
||||||
connect_req_ptr as *libc::c_void)
|
connect_req_ptr as *libc::c_void)
|
||||||
as *request_wrapper;
|
as *request_wrapper;
|
||||||
let write_handle = (*client_data).write_req;
|
let write_handle = (*client_data).write_req;
|
||||||
log(debug, fmt!("on_connect_cb: tcp: %d write_hdl: %d",
|
debug!("on_connect_cb: tcp: %d write_hdl: %d",
|
||||||
stream as int, write_handle as int));
|
stream as int, write_handle as int);
|
||||||
let write_result = write(write_handle,
|
let write_result = write(write_handle,
|
||||||
stream as *libc::c_void,
|
stream as *libc::c_void,
|
||||||
(*client_data).req_buf,
|
(*client_data).req_buf,
|
||||||
on_write_complete_cb);
|
on_write_complete_cb);
|
||||||
log(debug, fmt!("on_connect_cb: write() status: %d",
|
debug!("on_connect_cb: write() status: %d",
|
||||||
write_result as int));
|
write_result as int);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let test_loop = get_loop_for_uv_handle(
|
let test_loop = get_loop_for_uv_handle(
|
||||||
stream as *libc::c_void);
|
stream as *libc::c_void);
|
||||||
let err_msg = get_last_err_info(test_loop);
|
let err_msg = get_last_err_info(test_loop);
|
||||||
log(debug, err_msg);
|
debug!("%?", err_msg);
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
log(debug, ~"finishing on_connect_cb");
|
debug!("finishing on_connect_cb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1376,7 +1376,7 @@ pub mod test {
|
||||||
// data field in our uv_connect_t struct
|
// data field in our uv_connect_t struct
|
||||||
let req_str_bytes = str::to_bytes(req_str);
|
let req_str_bytes = str::to_bytes(req_str);
|
||||||
let req_msg_ptr: *u8 = vec::raw::to_ptr(req_str_bytes);
|
let req_msg_ptr: *u8 = vec::raw::to_ptr(req_str_bytes);
|
||||||
log(debug, fmt!("req_msg ptr: %u", req_msg_ptr as uint));
|
debug!("req_msg ptr: %u", req_msg_ptr as uint);
|
||||||
let req_msg = ~[
|
let req_msg = ~[
|
||||||
buf_init(req_msg_ptr, vec::len(req_str_bytes))
|
buf_init(req_msg_ptr, vec::len(req_str_bytes))
|
||||||
];
|
];
|
||||||
|
@ -1384,9 +1384,9 @@ pub mod test {
|
||||||
// this to C..
|
// this to C..
|
||||||
let write_handle = write_t();
|
let write_handle = write_t();
|
||||||
let write_handle_ptr = ptr::addr_of(&write_handle);
|
let write_handle_ptr = ptr::addr_of(&write_handle);
|
||||||
log(debug, fmt!("tcp req: tcp stream: %d write_handle: %d",
|
debug!("tcp req: tcp stream: %d write_handle: %d",
|
||||||
tcp_handle_ptr as int,
|
tcp_handle_ptr as int,
|
||||||
write_handle_ptr as int));
|
write_handle_ptr as int);
|
||||||
let client_data = request_wrapper {
|
let client_data = request_wrapper {
|
||||||
write_req: write_handle_ptr,
|
write_req: write_handle_ptr,
|
||||||
req_buf: ptr::addr_of(&req_msg),
|
req_buf: ptr::addr_of(&req_msg),
|
||||||
|
@ -1396,18 +1396,18 @@ pub mod test {
|
||||||
let tcp_init_result = tcp_init(
|
let tcp_init_result = tcp_init(
|
||||||
test_loop as *libc::c_void, tcp_handle_ptr);
|
test_loop as *libc::c_void, tcp_handle_ptr);
|
||||||
if (tcp_init_result == 0i32) {
|
if (tcp_init_result == 0i32) {
|
||||||
log(debug, ~"sucessful tcp_init_result");
|
debug!("sucessful tcp_init_result");
|
||||||
|
|
||||||
log(debug, ~"building addr...");
|
debug!("building addr...");
|
||||||
let addr = ip4_addr(ip, port);
|
let addr = ip4_addr(ip, port);
|
||||||
// FIXME ref #2064
|
// FIXME ref #2064
|
||||||
let addr_ptr = ptr::addr_of(&addr);
|
let addr_ptr = ptr::addr_of(&addr);
|
||||||
log(debug, fmt!("after build addr in rust. port: %u",
|
debug!("after build addr in rust. port: %u",
|
||||||
addr.sin_port as uint));
|
addr.sin_port as uint);
|
||||||
|
|
||||||
// this should set up the connection request..
|
// this should set up the connection request..
|
||||||
log(debug, fmt!("b4 call tcp_connect connect cb: %u ",
|
debug!("b4 call tcp_connect connect cb: %u ",
|
||||||
on_connect_cb as uint));
|
on_connect_cb as uint);
|
||||||
let tcp_connect_result = tcp_connect(
|
let tcp_connect_result = tcp_connect(
|
||||||
connect_req_ptr, tcp_handle_ptr,
|
connect_req_ptr, tcp_handle_ptr,
|
||||||
addr_ptr, on_connect_cb);
|
addr_ptr, on_connect_cb);
|
||||||
|
@ -1420,17 +1420,17 @@ pub mod test {
|
||||||
set_data_for_uv_handle(
|
set_data_for_uv_handle(
|
||||||
tcp_handle_ptr as *libc::c_void,
|
tcp_handle_ptr as *libc::c_void,
|
||||||
ptr::addr_of(&client_data) as *libc::c_void);
|
ptr::addr_of(&client_data) as *libc::c_void);
|
||||||
log(debug, ~"before run tcp req loop");
|
debug!("before run tcp req loop");
|
||||||
run(test_loop);
|
run(test_loop);
|
||||||
log(debug, ~"after run tcp req loop");
|
debug!("after run tcp req loop");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, ~"tcp_connect() failure");
|
debug!("tcp_connect() failure");
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, ~"tcp_init() failure");
|
debug!("tcp_init() failure");
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
loop_delete(test_loop);
|
loop_delete(test_loop);
|
||||||
|
@ -1439,15 +1439,15 @@ pub mod test {
|
||||||
|
|
||||||
extern fn server_after_close_cb(handle: *libc::c_void) {
|
extern fn server_after_close_cb(handle: *libc::c_void) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("SERVER server stream closed, should exit. h: %?",
|
debug!("SERVER server stream closed, should exit. h: %?",
|
||||||
handle));
|
handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fn client_stream_after_close_cb(handle: *libc::c_void) {
|
extern fn client_stream_after_close_cb(handle: *libc::c_void) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug,
|
debug!(
|
||||||
~"SERVER: closed client stream, now closing server stream");
|
"SERVER: closed client stream, now closing server stream");
|
||||||
let client_data = get_data_for_uv_handle(
|
let client_data = get_data_for_uv_handle(
|
||||||
handle) as
|
handle) as
|
||||||
*tcp_server_data;
|
*tcp_server_data;
|
||||||
|
@ -1460,7 +1460,7 @@ pub mod test {
|
||||||
unsafe {
|
unsafe {
|
||||||
let client_stream_ptr =
|
let client_stream_ptr =
|
||||||
get_stream_handle_from_write_req(req);
|
get_stream_handle_from_write_req(req);
|
||||||
log(debug, ~"SERVER: resp sent... closing client stream");
|
debug!("SERVER: resp sent... closing client stream");
|
||||||
close(client_stream_ptr as *libc::c_void,
|
close(client_stream_ptr as *libc::c_void,
|
||||||
client_stream_after_close_cb)
|
client_stream_after_close_cb)
|
||||||
}
|
}
|
||||||
|
@ -1473,15 +1473,15 @@ pub mod test {
|
||||||
let nread = nread as int;
|
let nread = nread as int;
|
||||||
if (nread > 0) {
|
if (nread > 0) {
|
||||||
// we have data
|
// we have data
|
||||||
log(debug, fmt!("SERVER read: data! nread: %d", nread));
|
debug!("SERVER read: data! nread: %d", nread);
|
||||||
|
|
||||||
// pull out the contents of the write from the client
|
// pull out the contents of the write from the client
|
||||||
let buf_base = get_base_from_buf(buf);
|
let buf_base = get_base_from_buf(buf);
|
||||||
let buf_len = get_len_from_buf(buf) as uint;
|
let buf_len = get_len_from_buf(buf) as uint;
|
||||||
log(debug, fmt!("SERVER buf base: %u, len: %u, nread: %d",
|
debug!("SERVER buf base: %u, len: %u, nread: %d",
|
||||||
buf_base as uint,
|
buf_base as uint,
|
||||||
buf_len as uint,
|
buf_len as uint,
|
||||||
nread));
|
nread);
|
||||||
let bytes = vec::from_buf(buf_base, nread as uint);
|
let bytes = vec::from_buf(buf_base, nread as uint);
|
||||||
let request_str = str::from_bytes(bytes);
|
let request_str = str::from_bytes(bytes);
|
||||||
|
|
||||||
|
@ -1491,8 +1491,8 @@ pub mod test {
|
||||||
let server_kill_msg = copy (*client_data).server_kill_msg;
|
let server_kill_msg = copy (*client_data).server_kill_msg;
|
||||||
let write_req = (*client_data).server_write_req;
|
let write_req = (*client_data).server_write_req;
|
||||||
if str::contains(request_str, server_kill_msg) {
|
if str::contains(request_str, server_kill_msg) {
|
||||||
log(debug, ~"SERVER: client req contains kill_msg!");
|
debug!("SERVER: client req contains kill_msg!");
|
||||||
log(debug, ~"SERVER: sending response to client");
|
debug!("SERVER: sending response to client");
|
||||||
read_stop(client_stream_ptr);
|
read_stop(client_stream_ptr);
|
||||||
let server_chan = (*client_data).server_chan.clone();
|
let server_chan = (*client_data).server_chan.clone();
|
||||||
server_chan.send(request_str);
|
server_chan.send(request_str);
|
||||||
|
@ -1501,31 +1501,31 @@ pub mod test {
|
||||||
client_stream_ptr as *libc::c_void,
|
client_stream_ptr as *libc::c_void,
|
||||||
(*client_data).server_resp_buf,
|
(*client_data).server_resp_buf,
|
||||||
after_server_resp_write);
|
after_server_resp_write);
|
||||||
log(debug, fmt!("SERVER: resp write result: %d",
|
debug!("SERVER: resp write result: %d",
|
||||||
write_result as int));
|
write_result as int);
|
||||||
if (write_result != 0i32) {
|
if (write_result != 0i32) {
|
||||||
log(debug, ~"bad result for server resp write()");
|
debug!("bad result for server resp write()");
|
||||||
log(debug, get_last_err_info(
|
debug!("%s", get_last_err_info(
|
||||||
get_loop_for_uv_handle(client_stream_ptr
|
get_loop_for_uv_handle(client_stream_ptr
|
||||||
as *libc::c_void)));
|
as *libc::c_void)));
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, ~"SERVER: client req !contain kill_msg!");
|
debug!("SERVER: client req !contain kill_msg!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nread == -1) {
|
else if (nread == -1) {
|
||||||
// err .. possibly EOF
|
// err .. possibly EOF
|
||||||
log(debug, ~"read: eof!");
|
debug!("read: eof!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// nread == 0 .. do nothing, just free buf as below
|
// nread == 0 .. do nothing, just free buf as below
|
||||||
log(debug, ~"read: do nothing!");
|
debug!("read: do nothing!");
|
||||||
}
|
}
|
||||||
// when we're done
|
// when we're done
|
||||||
free_base_of_buf(buf);
|
free_base_of_buf(buf);
|
||||||
log(debug, ~"SERVER exiting on_read_cb");
|
debug!("SERVER exiting on_read_cb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1533,13 +1533,13 @@ pub mod test {
|
||||||
*uv_stream_t,
|
*uv_stream_t,
|
||||||
status: libc::c_int) {
|
status: libc::c_int) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, ~"client connecting!");
|
debug!("client connecting!");
|
||||||
let test_loop = get_loop_for_uv_handle(
|
let test_loop = get_loop_for_uv_handle(
|
||||||
server_stream_ptr as *libc::c_void);
|
server_stream_ptr as *libc::c_void);
|
||||||
if status != 0i32 {
|
if status != 0i32 {
|
||||||
let err_msg = get_last_err_info(test_loop);
|
let err_msg = get_last_err_info(test_loop);
|
||||||
log(debug, fmt!("server_connect_cb: non-zero status: %?",
|
debug!("server_connect_cb: non-zero status: %?",
|
||||||
err_msg));
|
err_msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let server_data = get_data_for_uv_handle(
|
let server_data = get_data_for_uv_handle(
|
||||||
|
@ -1551,7 +1551,7 @@ pub mod test {
|
||||||
client_stream_ptr as *libc::c_void,
|
client_stream_ptr as *libc::c_void,
|
||||||
server_data as *libc::c_void);
|
server_data as *libc::c_void);
|
||||||
if (client_init_result == 0i32) {
|
if (client_init_result == 0i32) {
|
||||||
log(debug, ~"successfully initialized client stream");
|
debug!("successfully initialized client stream");
|
||||||
let accept_result = accept(server_stream_ptr as
|
let accept_result = accept(server_stream_ptr as
|
||||||
*libc::c_void,
|
*libc::c_void,
|
||||||
client_stream_ptr as
|
client_stream_ptr as
|
||||||
|
@ -1563,23 +1563,23 @@ pub mod test {
|
||||||
on_alloc_cb,
|
on_alloc_cb,
|
||||||
on_server_read_cb);
|
on_server_read_cb);
|
||||||
if (read_result == 0i32) {
|
if (read_result == 0i32) {
|
||||||
log(debug, ~"successful server read start");
|
debug!("successful server read start");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, fmt!("server_connection_cb: bad read:%d",
|
debug!("server_connection_cb: bad read:%d",
|
||||||
read_result as int));
|
read_result as int);
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, fmt!("server_connection_cb: bad accept: %d",
|
debug!("server_connection_cb: bad accept: %d",
|
||||||
accept_result as int));
|
accept_result as int);
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, fmt!("server_connection_cb: bad client init: %d",
|
debug!("server_connection_cb: bad client init: %d",
|
||||||
client_init_result as int));
|
client_init_result as int);
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1599,8 +1599,8 @@ pub mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fn async_close_cb(handle: *libc::c_void) {
|
extern fn async_close_cb(handle: *libc::c_void) {
|
||||||
log(debug, fmt!("SERVER: closing async cb... h: %?",
|
debug!("SERVER: closing async cb... h: %?",
|
||||||
handle));
|
handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fn continue_async_cb(async_handle: *uv_async_t,
|
extern fn continue_async_cb(async_handle: *uv_async_t,
|
||||||
|
@ -1638,7 +1638,7 @@ pub mod test {
|
||||||
|
|
||||||
let resp_str_bytes = str::to_bytes(server_resp_msg);
|
let resp_str_bytes = str::to_bytes(server_resp_msg);
|
||||||
let resp_msg_ptr: *u8 = vec::raw::to_ptr(resp_str_bytes);
|
let resp_msg_ptr: *u8 = vec::raw::to_ptr(resp_str_bytes);
|
||||||
log(debug, fmt!("resp_msg ptr: %u", resp_msg_ptr as uint));
|
debug!("resp_msg ptr: %u", resp_msg_ptr as uint);
|
||||||
let resp_msg = ~[
|
let resp_msg = ~[
|
||||||
buf_init(resp_msg_ptr, vec::len(resp_str_bytes))
|
buf_init(resp_msg_ptr, vec::len(resp_str_bytes))
|
||||||
];
|
];
|
||||||
|
@ -1674,7 +1674,7 @@ pub mod test {
|
||||||
let bind_result = tcp_bind(tcp_server_ptr,
|
let bind_result = tcp_bind(tcp_server_ptr,
|
||||||
server_addr_ptr);
|
server_addr_ptr);
|
||||||
if (bind_result == 0i32) {
|
if (bind_result == 0i32) {
|
||||||
log(debug, ~"successful uv_tcp_bind, listening");
|
debug!("successful uv_tcp_bind, listening");
|
||||||
|
|
||||||
// uv_listen()
|
// uv_listen()
|
||||||
let listen_result = listen(tcp_server_ptr as
|
let listen_result = listen(tcp_server_ptr as
|
||||||
|
@ -1694,29 +1694,29 @@ pub mod test {
|
||||||
async_send(continue_async_handle_ptr);
|
async_send(continue_async_handle_ptr);
|
||||||
// uv_run()
|
// uv_run()
|
||||||
run(test_loop);
|
run(test_loop);
|
||||||
log(debug, ~"server uv::run() has returned");
|
debug!("server uv::run() has returned");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, fmt!("uv_async_init failure: %d",
|
debug!("uv_async_init failure: %d",
|
||||||
async_result as int));
|
async_result as int);
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, fmt!("non-zero result on uv_listen: %d",
|
debug!("non-zero result on uv_listen: %d",
|
||||||
listen_result as int));
|
listen_result as int);
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, fmt!("non-zero result on uv_tcp_bind: %d",
|
debug!("non-zero result on uv_tcp_bind: %d",
|
||||||
bind_result as int));
|
bind_result as int);
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, fmt!("non-zero result on uv_tcp_init: %d",
|
debug!("non-zero result on uv_tcp_init: %d",
|
||||||
tcp_init_result as int));
|
tcp_init_result as int);
|
||||||
fail_unless!(false);
|
fail_unless!(false);
|
||||||
}
|
}
|
||||||
loop_delete(test_loop);
|
loop_delete(test_loop);
|
||||||
|
@ -1751,9 +1751,9 @@ pub mod test {
|
||||||
};
|
};
|
||||||
|
|
||||||
// block until the server up is.. possibly a race?
|
// block until the server up is.. possibly a race?
|
||||||
log(debug, ~"before receiving on server continue_port");
|
debug!("before receiving on server continue_port");
|
||||||
continue_port.recv();
|
continue_port.recv();
|
||||||
log(debug, ~"received on continue port, set up tcp client");
|
debug!("received on continue port, set up tcp client");
|
||||||
|
|
||||||
let kill_server_msg_copy = copy kill_server_msg;
|
let kill_server_msg_copy = copy kill_server_msg;
|
||||||
do task::spawn_sched(task::ManualThreads(1u)) {
|
do task::spawn_sched(task::ManualThreads(1u)) {
|
||||||
|
@ -1808,7 +1808,7 @@ pub mod test {
|
||||||
let output = fmt!(
|
let output = fmt!(
|
||||||
"STRUCT_SIZE FAILURE: %s -- actual: %u expected: %u",
|
"STRUCT_SIZE FAILURE: %s -- actual: %u expected: %u",
|
||||||
t_name, rust_size, foreign_size as uint);
|
t_name, rust_size, foreign_size as uint);
|
||||||
log(debug, output);
|
debug!("%s", output);
|
||||||
}
|
}
|
||||||
fail_unless!(sizes_match);
|
fail_unless!(sizes_match);
|
||||||
}
|
}
|
||||||
|
@ -1869,7 +1869,7 @@ pub mod test {
|
||||||
let rust_handle_size = sys::size_of::<sockaddr_in6>();
|
let rust_handle_size = sys::size_of::<sockaddr_in6>();
|
||||||
let output = fmt!("sockaddr_in6 -- foreign: %u rust: %u",
|
let output = fmt!("sockaddr_in6 -- foreign: %u rust: %u",
|
||||||
foreign_handle_size as uint, rust_handle_size);
|
foreign_handle_size as uint, rust_handle_size);
|
||||||
log(debug, output);
|
debug!(output);
|
||||||
// FIXME #1645 .. rust appears to pad structs to the nearest
|
// FIXME #1645 .. rust appears to pad structs to the nearest
|
||||||
// byte..?
|
// byte..?
|
||||||
// .. can't get the uv::ll::sockaddr_in6 to == 28 :/
|
// .. can't get the uv::ll::sockaddr_in6 to == 28 :/
|
||||||
|
@ -1888,7 +1888,7 @@ pub mod test {
|
||||||
let rust_handle_size = sys::size_of::<addr_in>();
|
let rust_handle_size = sys::size_of::<addr_in>();
|
||||||
let output = fmt!("addr_in -- foreign: %u rust: %u",
|
let output = fmt!("addr_in -- foreign: %u rust: %u",
|
||||||
foreign_handle_size as uint, rust_handle_size);
|
foreign_handle_size as uint, rust_handle_size);
|
||||||
log(debug, output);
|
debug!(output);
|
||||||
// FIXME #1645 .. see note above about struct padding
|
// FIXME #1645 .. see note above about struct padding
|
||||||
fail_unless!((4u+foreign_handle_size as uint) ==
|
fail_unless!((4u+foreign_handle_size as uint) ==
|
||||||
rust_handle_size);
|
rust_handle_size);
|
||||||
|
|
|
@ -289,10 +289,10 @@ pub fn check_variants_T<T: Copy>(
|
||||||
|
|
||||||
if L < 100 {
|
if L < 100 {
|
||||||
do under(uint::min(L, 20)) |i| {
|
do under(uint::min(L, 20)) |i| {
|
||||||
log(error, ~"Replacing... #" + uint::to_str(i));
|
error!("Replacing... #%?", uint::to_str(i));
|
||||||
let fname = str::from_slice(filename.to_str());
|
let fname = str::from_slice(filename.to_str());
|
||||||
do under(uint::min(L, 30)) |j| {
|
do under(uint::min(L, 30)) |j| {
|
||||||
log(error, ~"With... " + stringifier(@things[j], intr));
|
error!("With... %?", stringifier(@things[j], intr));
|
||||||
let crate2 = @replacer(crate, i, things[j], cx.mode);
|
let crate2 = @replacer(crate, i, things[j], cx.mode);
|
||||||
// It would be best to test the *crate* for stability, but
|
// It would be best to test the *crate* for stability, but
|
||||||
// testing the string for stability is easier and ok for now.
|
// testing the string for stability is easier and ok for now.
|
||||||
|
@ -363,8 +363,8 @@ pub fn check_whole_compiler(code: ~str, suggested_filename_prefix: &Path,
|
||||||
removeDirIfExists(&suggested_filename_prefix.with_filetype("dSYM"));
|
removeDirIfExists(&suggested_filename_prefix.with_filetype("dSYM"));
|
||||||
}
|
}
|
||||||
failed(s) => {
|
failed(s) => {
|
||||||
log(error, ~"check_whole_compiler failure: " + s);
|
error!("check_whole_compiler failure: %?", s);
|
||||||
log(error, ~"Saved as: " + filename.to_str());
|
error!("Saved as: %?", filename.to_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,7 +387,7 @@ pub fn check_running(exe_filename: &Path) -> happiness {
|
||||||
~[exe_filename.to_str()]);
|
~[exe_filename.to_str()]);
|
||||||
let comb = p.out + ~"\n" + p.err;
|
let comb = p.out + ~"\n" + p.err;
|
||||||
if str::len(comb) > 1u {
|
if str::len(comb) > 1u {
|
||||||
log(error, ~"comb comb comb: " + comb);
|
error!("comb comb comb: %?", comb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if contains(comb, ~"Assertion failed:") {
|
if contains(comb, ~"Assertion failed:") {
|
||||||
|
@ -433,21 +433,21 @@ pub fn check_compiling(filename: &Path) -> happiness {
|
||||||
if contains(p.err, ~"error:") {
|
if contains(p.err, ~"error:") {
|
||||||
cleanly_rejected(~"rejected with span_error")
|
cleanly_rejected(~"rejected with span_error")
|
||||||
} else {
|
} else {
|
||||||
log(error, ~"Stderr: " + p.err);
|
error!("Stderr: %?", p.err);
|
||||||
failed(~"Unfamiliar error message")
|
failed(~"Unfamiliar error message")
|
||||||
}
|
}
|
||||||
} else if contains(p.out, ~"Assertion") && contains(p.out, ~"failed") {
|
} else if contains(p.out, ~"Assertion") && contains(p.out, ~"failed") {
|
||||||
log(error, ~"Stdout: " + p.out);
|
error!("Stdout: %?", p.out);
|
||||||
failed(~"Looks like an llvm assertion failure")
|
failed(~"Looks like an llvm assertion failure")
|
||||||
} else if contains(p.out, ~"internal compiler error unimplemented") {
|
} else if contains(p.out, ~"internal compiler error unimplemented") {
|
||||||
known_bug(~"Something unimplemented")
|
known_bug(~"Something unimplemented")
|
||||||
} else if contains(p.out, ~"internal compiler error") {
|
} else if contains(p.out, ~"internal compiler error") {
|
||||||
log(error, ~"Stdout: " + p.out);
|
error!("Stdout: %?", p.out);
|
||||||
failed(~"internal compiler error")
|
failed(~"internal compiler error")
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
log(error, p.status);
|
error!("%?", p.status);
|
||||||
log(error, ~"!Stdout: " + p.out);
|
error!("!Stdout: %?", p.out);
|
||||||
failed(~"What happened?")
|
failed(~"What happened?")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ pub fn check_variants(files: &[Path], cx: Context) {
|
||||||
|
|
||||||
let file_str = file.to_str();
|
let file_str = file.to_str();
|
||||||
|
|
||||||
log(error, ~"check_variants: " + file_str);
|
error!("check_variants: %?", file_str);
|
||||||
let sess = parse::new_parse_sess(option::None);
|
let sess = parse::new_parse_sess(option::None);
|
||||||
let crate =
|
let crate =
|
||||||
parse::parse_crate_from_source_str(
|
parse::parse_crate_from_source_str(
|
||||||
|
|
|
@ -758,7 +758,7 @@ pub fn link_binary(sess: Session,
|
||||||
/*bad*/copy *out_filename
|
/*bad*/copy *out_filename
|
||||||
};
|
};
|
||||||
|
|
||||||
log(debug, ~"output: " + output.to_str());
|
debug!("output: %s", output.to_str());
|
||||||
|
|
||||||
// The default library location, we need this to find the runtime.
|
// The default library location, we need this to find the runtime.
|
||||||
// The location of crates will be determined as needed.
|
// The location of crates will be determined as needed.
|
||||||
|
|
|
@ -803,12 +803,12 @@ pub fn invoke(bcx: block, llfn: ValueRef, +llargs: ~[ValueRef]) -> block {
|
||||||
let _icx = bcx.insn_ctxt("invoke_");
|
let _icx = bcx.insn_ctxt("invoke_");
|
||||||
if bcx.unreachable { return bcx; }
|
if bcx.unreachable { return bcx; }
|
||||||
if need_invoke(bcx) {
|
if need_invoke(bcx) {
|
||||||
log(debug, ~"invoking");
|
debug!("invoking");
|
||||||
let normal_bcx = sub_block(bcx, ~"normal return");
|
let normal_bcx = sub_block(bcx, ~"normal return");
|
||||||
Invoke(bcx, llfn, llargs, normal_bcx.llbb, get_landing_pad(bcx));
|
Invoke(bcx, llfn, llargs, normal_bcx.llbb, get_landing_pad(bcx));
|
||||||
return normal_bcx;
|
return normal_bcx;
|
||||||
} else {
|
} else {
|
||||||
log(debug, ~"calling");
|
debug!("calling");
|
||||||
Call(bcx, llfn, llargs);
|
Call(bcx, llfn, llargs);
|
||||||
return bcx;
|
return bcx;
|
||||||
}
|
}
|
||||||
|
@ -1487,7 +1487,7 @@ pub fn alloc_ty(bcx: block, t: ty::t) -> ValueRef {
|
||||||
let _icx = bcx.insn_ctxt("alloc_ty");
|
let _icx = bcx.insn_ctxt("alloc_ty");
|
||||||
let ccx = bcx.ccx();
|
let ccx = bcx.ccx();
|
||||||
let llty = type_of::type_of(ccx, t);
|
let llty = type_of::type_of(ccx, t);
|
||||||
if ty::type_has_params(t) { log(error, ty_to_str(ccx.tcx, t)); }
|
if ty::type_has_params(t) { error!("%s", ty_to_str(ccx.tcx, t)); }
|
||||||
fail_unless!(!ty::type_has_params(t));
|
fail_unless!(!ty::type_has_params(t));
|
||||||
let val = alloca(bcx, llty);
|
let val = alloca(bcx, llty);
|
||||||
return val;
|
return val;
|
||||||
|
|
|
@ -848,7 +848,7 @@ pub fn add_span_comment(bcx: block, sp: span, text: &str) {
|
||||||
let ccx = bcx.ccx();
|
let ccx = bcx.ccx();
|
||||||
if !ccx.sess.no_asm_comments() {
|
if !ccx.sess.no_asm_comments() {
|
||||||
let s = fmt!("%s (%s)", text, ccx.sess.codemap.span_to_str(sp));
|
let s = fmt!("%s (%s)", text, ccx.sess.codemap.span_to_str(sp));
|
||||||
log(debug, copy s);
|
debug!("%s", copy s);
|
||||||
add_comment(bcx, s);
|
add_comment(bcx, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -806,10 +806,10 @@ pub fn create_function(fcx: fn_ctxt) -> @Metadata<SubProgramMetadata> {
|
||||||
let dbg_cx = (/*bad*/copy cx.dbg_cx).get();
|
let dbg_cx = (/*bad*/copy cx.dbg_cx).get();
|
||||||
|
|
||||||
debug!("~~");
|
debug!("~~");
|
||||||
log(debug, fcx.id);
|
debug!("%?", fcx.id);
|
||||||
|
|
||||||
let sp = fcx.span.get();
|
let sp = fcx.span.get();
|
||||||
log(debug, cx.sess.codemap.span_to_str(sp));
|
debug!("%s", cx.sess.codemap.span_to_str(sp));
|
||||||
|
|
||||||
let (ident, ret_ty, id) = match cx.tcx.items.get(&fcx.id) {
|
let (ident, ret_ty, id) = match cx.tcx.items.get(&fcx.id) {
|
||||||
ast_map::node_item(item, _) => {
|
ast_map::node_item(item, _) => {
|
||||||
|
@ -841,8 +841,8 @@ pub fn create_function(fcx: fn_ctxt) -> @Metadata<SubProgramMetadata> {
|
||||||
sort of node")
|
sort of node")
|
||||||
};
|
};
|
||||||
|
|
||||||
log(debug, ident);
|
debug!("%?", ident);
|
||||||
log(debug, id);
|
debug!("%?", id);
|
||||||
|
|
||||||
let cache = get_cache(cx);
|
let cache = get_cache(cx);
|
||||||
match cached_metadata::<@Metadata<SubProgramMetadata>>(
|
match cached_metadata::<@Metadata<SubProgramMetadata>>(
|
||||||
|
|
|
@ -708,7 +708,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
|
||||||
free_glue: None,
|
free_glue: None,
|
||||||
visit_glue: None
|
visit_glue: None
|
||||||
};
|
};
|
||||||
log(debug, ~"--- declare_tydesc " + ppaux::ty_to_str(ccx.tcx, t));
|
debug!("--- declare_tydesc %s", ppaux::ty_to_str(ccx.tcx, t));
|
||||||
return inf;
|
return inf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ struct Bored {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Drop for Bored {
|
impl Drop for Bored {
|
||||||
fn finalize(&self) { log(error, self.bored); }
|
fn finalize(&self) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub fn run_passes(
|
||||||
) -> doc::Doc {
|
) -> doc::Doc {
|
||||||
let mut passno = 0;
|
let mut passno = 0;
|
||||||
do vec::foldl(doc, passes) |doc, pass| {
|
do vec::foldl(doc, passes) |doc, pass| {
|
||||||
log(debug, fmt!("pass #%d", passno));
|
debug!("pass #%d", passno);
|
||||||
passno += 1;
|
passno += 1;
|
||||||
do time(copy pass.name) {
|
do time(copy pass.name) {
|
||||||
(pass.f)(srv.clone(), copy doc)
|
(pass.f)(srv.clone(), copy doc)
|
||||||
|
|
|
@ -509,7 +509,7 @@ mod tests {
|
||||||
|
|
||||||
fail_unless!((*arc::get(&arc_v))[2] == 3);
|
fail_unless!((*arc::get(&arc_v))[2] == 3);
|
||||||
|
|
||||||
log(info, arc_v);
|
info!(arc_v);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -116,7 +116,6 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use core::cmp::Eq;
|
use core::cmp::Eq;
|
||||||
use core::kinds::{Durable, Copy};
|
use core::kinds::{Durable, Copy};
|
||||||
use core::prelude::debug;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_simple() {
|
fn test_simple() {
|
||||||
|
@ -128,21 +127,21 @@ mod tests {
|
||||||
fail_unless!(d.len() == 3u);
|
fail_unless!(d.len() == 3u);
|
||||||
d.add_back(137);
|
d.add_back(137);
|
||||||
fail_unless!(d.len() == 4u);
|
fail_unless!(d.len() == 4u);
|
||||||
log(debug, d.peek_front());
|
debug!(d.peek_front());
|
||||||
fail_unless!(*d.peek_front() == 42);
|
fail_unless!(*d.peek_front() == 42);
|
||||||
log(debug, d.peek_back());
|
debug!(d.peek_back());
|
||||||
fail_unless!(*d.peek_back() == 137);
|
fail_unless!(*d.peek_back() == 137);
|
||||||
let mut i: int = d.pop_front();
|
let mut i: int = d.pop_front();
|
||||||
log(debug, i);
|
debug!(i);
|
||||||
fail_unless!(i == 42);
|
fail_unless!(i == 42);
|
||||||
i = d.pop_back();
|
i = d.pop_back();
|
||||||
log(debug, i);
|
debug!(i);
|
||||||
fail_unless!(i == 137);
|
fail_unless!(i == 137);
|
||||||
i = d.pop_back();
|
i = d.pop_back();
|
||||||
log(debug, i);
|
debug!(i);
|
||||||
fail_unless!(i == 137);
|
fail_unless!(i == 137);
|
||||||
i = d.pop_back();
|
i = d.pop_back();
|
||||||
log(debug, i);
|
debug!(i);
|
||||||
fail_unless!(i == 17);
|
fail_unless!(i == 17);
|
||||||
fail_unless!(d.len() == 0u);
|
fail_unless!(d.len() == 0u);
|
||||||
d.add_back(3);
|
d.add_back(3);
|
||||||
|
@ -153,10 +152,10 @@ mod tests {
|
||||||
fail_unless!(d.len() == 3u);
|
fail_unless!(d.len() == 3u);
|
||||||
d.add_front(1);
|
d.add_front(1);
|
||||||
fail_unless!(d.len() == 4u);
|
fail_unless!(d.len() == 4u);
|
||||||
log(debug, d.get(0));
|
debug!(d.get(0));
|
||||||
log(debug, d.get(1));
|
debug!(d.get(1));
|
||||||
log(debug, d.get(2));
|
debug!(d.get(2));
|
||||||
log(debug, d.get(3));
|
debug!(d.get(3));
|
||||||
fail_unless!(*d.get(0) == 1);
|
fail_unless!(*d.get(0) == 1);
|
||||||
fail_unless!(*d.get(1) == 2);
|
fail_unless!(*d.get(1) == 2);
|
||||||
fail_unless!(*d.get(2) == 3);
|
fail_unless!(*d.get(2) == 3);
|
||||||
|
|
|
@ -881,7 +881,7 @@ mod tests {
|
||||||
let rs = getopts(args, opts);
|
let rs = getopts(args, opts);
|
||||||
match rs {
|
match rs {
|
||||||
Err(copy f) => {
|
Err(copy f) => {
|
||||||
log(error, fail_str(f));
|
error!(fail_str(f));
|
||||||
check_fail_type(f, UnexpectedArgument_);
|
check_fail_type(f, UnexpectedArgument_);
|
||||||
}
|
}
|
||||||
_ => fail!()
|
_ => fail!()
|
||||||
|
|
|
@ -117,7 +117,7 @@ pub fn get_addr(node: &str, iotask: &iotask)
|
||||||
do str::as_buf(node) |node_ptr, len| {
|
do str::as_buf(node) |node_ptr, len| {
|
||||||
let output_ch = output_ch.swap_unwrap();
|
let output_ch = output_ch.swap_unwrap();
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("slice len %?", len));
|
debug!("slice len %?", len);
|
||||||
let handle = create_uv_getaddrinfo_t();
|
let handle = create_uv_getaddrinfo_t();
|
||||||
let handle_ptr = ptr::addr_of(&handle);
|
let handle_ptr = ptr::addr_of(&handle);
|
||||||
let handle_data = GetAddrData {
|
let handle_data = GetAddrData {
|
||||||
|
@ -228,8 +228,8 @@ pub mod v4 {
|
||||||
|
|
||||||
let new_addr = uv_ip4_addr(str::from_slice(ip), 22);
|
let new_addr = uv_ip4_addr(str::from_slice(ip), 22);
|
||||||
let reformatted_name = uv_ip4_name(&new_addr);
|
let reformatted_name = uv_ip4_name(&new_addr);
|
||||||
log(debug, fmt!("try_parse_addr: input ip: %s reparsed ip: %s",
|
debug!("try_parse_addr: input ip: %s reparsed ip: %s",
|
||||||
ip, reformatted_name));
|
ip, reformatted_name);
|
||||||
let ref_ip_rep_result = parse_to_ipv4_rep(reformatted_name);
|
let ref_ip_rep_result = parse_to_ipv4_rep(reformatted_name);
|
||||||
if result::is_err(&ref_ip_rep_result) {
|
if result::is_err(&ref_ip_rep_result) {
|
||||||
let err_str = result::get_err(&ref_ip_rep_result);
|
let err_str = result::get_err(&ref_ip_rep_result);
|
||||||
|
@ -282,8 +282,8 @@ pub mod v6 {
|
||||||
// need to figure out how to establish a parse failure..
|
// need to figure out how to establish a parse failure..
|
||||||
let new_addr = uv_ip6_addr(str::from_slice(ip), 22);
|
let new_addr = uv_ip6_addr(str::from_slice(ip), 22);
|
||||||
let reparsed_name = uv_ip6_name(&new_addr);
|
let reparsed_name = uv_ip6_name(&new_addr);
|
||||||
log(debug, fmt!("v6::try_parse_addr ip: '%s' reparsed '%s'",
|
debug!("v6::try_parse_addr ip: '%s' reparsed '%s'",
|
||||||
ip, reparsed_name));
|
ip, reparsed_name);
|
||||||
// '::' appears to be uv_ip6_name() returns for bogus
|
// '::' appears to be uv_ip6_name() returns for bogus
|
||||||
// parses..
|
// parses..
|
||||||
if ip != &"::" && reparsed_name == ~"::" {
|
if ip != &"::" && reparsed_name == ~"::" {
|
||||||
|
@ -303,14 +303,14 @@ struct GetAddrData {
|
||||||
extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
||||||
res: *addrinfo) {
|
res: *addrinfo) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, ~"in get_addr_cb");
|
debug!("in get_addr_cb");
|
||||||
let handle_data = get_data_for_req(handle) as
|
let handle_data = get_data_for_req(handle) as
|
||||||
*GetAddrData;
|
*GetAddrData;
|
||||||
let output_ch = (*handle_data).output_ch.clone();
|
let output_ch = (*handle_data).output_ch.clone();
|
||||||
if status == 0i32 {
|
if status == 0i32 {
|
||||||
if res != (ptr::null::<addrinfo>()) {
|
if res != (ptr::null::<addrinfo>()) {
|
||||||
let mut out_vec = ~[];
|
let mut out_vec = ~[];
|
||||||
log(debug, fmt!("initial addrinfo: %?", res));
|
debug!("initial addrinfo: %?", res);
|
||||||
let mut curr_addr = res;
|
let mut curr_addr = res;
|
||||||
loop {
|
loop {
|
||||||
let new_ip_addr = if ll::is_ipv4_addrinfo(curr_addr) {
|
let new_ip_addr = if ll::is_ipv4_addrinfo(curr_addr) {
|
||||||
|
@ -322,8 +322,8 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
||||||
*ll::addrinfo_as_sockaddr_in6(curr_addr))))
|
*ll::addrinfo_as_sockaddr_in6(curr_addr))))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, ~"curr_addr is not of family AF_INET or "+
|
debug!("curr_addr is not of family AF_INET or \
|
||||||
~"AF_INET6. Error.");
|
AF_INET6. Error.");
|
||||||
output_ch.send(
|
output_ch.send(
|
||||||
result::Err(GetAddrUnknownError));
|
result::Err(GetAddrUnknownError));
|
||||||
break;
|
break;
|
||||||
|
@ -332,33 +332,33 @@ extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
|
||||||
|
|
||||||
let next_addr = ll::get_next_addrinfo(curr_addr);
|
let next_addr = ll::get_next_addrinfo(curr_addr);
|
||||||
if next_addr == ptr::null::<addrinfo>() as *addrinfo {
|
if next_addr == ptr::null::<addrinfo>() as *addrinfo {
|
||||||
log(debug, ~"null next_addr encountered. no mas");
|
debug!("null next_addr encountered. no mas");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
curr_addr = next_addr;
|
curr_addr = next_addr;
|
||||||
log(debug, fmt!("next_addr addrinfo: %?", curr_addr));
|
debug!("next_addr addrinfo: %?", curr_addr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log(debug, fmt!("successful process addrinfo result, len: %?",
|
debug!("successful process addrinfo result, len: %?",
|
||||||
vec::len(out_vec)));
|
vec::len(out_vec));
|
||||||
output_ch.send(result::Ok(out_vec));
|
output_ch.send(result::Ok(out_vec));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, ~"addrinfo pointer is NULL");
|
debug!("addrinfo pointer is NULL");
|
||||||
output_ch.send(
|
output_ch.send(
|
||||||
result::Err(GetAddrUnknownError));
|
result::Err(GetAddrUnknownError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, ~"status != 0 error in get_addr_cb");
|
debug!("status != 0 error in get_addr_cb");
|
||||||
output_ch.send(
|
output_ch.send(
|
||||||
result::Err(GetAddrUnknownError));
|
result::Err(GetAddrUnknownError));
|
||||||
}
|
}
|
||||||
if res != (ptr::null::<addrinfo>()) {
|
if res != (ptr::null::<addrinfo>()) {
|
||||||
uv_freeaddrinfo(res);
|
uv_freeaddrinfo(res);
|
||||||
}
|
}
|
||||||
log(debug, ~"leaving get_addr_cb");
|
debug!("leaving get_addr_cb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,15 +384,15 @@ mod test {
|
||||||
fn test_ip_ipv6_parse_and_format_ip() {
|
fn test_ip_ipv6_parse_and_format_ip() {
|
||||||
let localhost_str = ~"::1";
|
let localhost_str = ~"::1";
|
||||||
let format_result = format_addr(&v6::parse_addr(localhost_str));
|
let format_result = format_addr(&v6::parse_addr(localhost_str));
|
||||||
log(debug, fmt!("results: expected: '%s' actual: '%s'",
|
debug!("results: expected: '%s' actual: '%s'",
|
||||||
localhost_str, format_result));
|
localhost_str, format_result);
|
||||||
fail_unless!(format_result == localhost_str);
|
fail_unless!(format_result == localhost_str);
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ip_ipv4_bad_parse() {
|
fn test_ip_ipv4_bad_parse() {
|
||||||
match v4::try_parse_addr(~"b4df00d") {
|
match v4::try_parse_addr(~"b4df00d") {
|
||||||
result::Err(ref err_info) => {
|
result::Err(ref err_info) => {
|
||||||
log(debug, fmt!("got error as expected %?", err_info));
|
debug!("got error as expected %?", err_info);
|
||||||
fail_unless!(true);
|
fail_unless!(true);
|
||||||
}
|
}
|
||||||
result::Ok(ref addr) => {
|
result::Ok(ref addr) => {
|
||||||
|
@ -405,7 +405,7 @@ mod test {
|
||||||
fn test_ip_ipv6_bad_parse() {
|
fn test_ip_ipv6_bad_parse() {
|
||||||
match v6::try_parse_addr(~"::,~2234k;") {
|
match v6::try_parse_addr(~"::,~2234k;") {
|
||||||
result::Err(ref err_info) => {
|
result::Err(ref err_info) => {
|
||||||
log(debug, fmt!("got error as expected %?", err_info));
|
debug!("got error as expected %?", err_info);
|
||||||
fail_unless!(true);
|
fail_unless!(true);
|
||||||
}
|
}
|
||||||
result::Ok(ref addr) => {
|
result::Ok(ref addr) => {
|
||||||
|
@ -425,15 +425,15 @@ mod test {
|
||||||
// note really sure how to realiably test/assert
|
// note really sure how to realiably test/assert
|
||||||
// this.. mostly just wanting to see it work, atm.
|
// this.. mostly just wanting to see it work, atm.
|
||||||
let results = result::unwrap(ga_result);
|
let results = result::unwrap(ga_result);
|
||||||
log(debug, fmt!("test_get_addr: Number of results for %s: %?",
|
debug!("test_get_addr: Number of results for %s: %?",
|
||||||
localhost_name, vec::len(results)));
|
localhost_name, vec::len(results));
|
||||||
for vec::each(results) |r| {
|
for vec::each(results) |r| {
|
||||||
let ipv_prefix = match *r {
|
let ipv_prefix = match *r {
|
||||||
Ipv4(_) => ~"IPv4",
|
Ipv4(_) => ~"IPv4",
|
||||||
Ipv6(_) => ~"IPv6"
|
Ipv6(_) => ~"IPv6"
|
||||||
};
|
};
|
||||||
log(debug, fmt!("test_get_addr: result %s: '%s'",
|
debug!("test_get_addr: result %s: '%s'",
|
||||||
ipv_prefix, format_addr(r)));
|
ipv_prefix, format_addr(r));
|
||||||
}
|
}
|
||||||
// at least one result.. this is going to vary from system
|
// at least one result.. this is going to vary from system
|
||||||
// to system, based on stuff like the contents of /etc/hosts
|
// to system, based on stuff like the contents of /etc/hosts
|
||||||
|
|
|
@ -559,14 +559,14 @@ pub fn accept(new_conn: TcpNewConnection)
|
||||||
server_handle_ptr);
|
server_handle_ptr);
|
||||||
match uv::ll::tcp_init(loop_ptr, client_stream_handle_ptr) {
|
match uv::ll::tcp_init(loop_ptr, client_stream_handle_ptr) {
|
||||||
0i32 => {
|
0i32 => {
|
||||||
log(debug, ~"uv_tcp_init successful for \
|
debug!("uv_tcp_init successful for \
|
||||||
client stream");
|
client stream");
|
||||||
match uv::ll::accept(
|
match uv::ll::accept(
|
||||||
server_handle_ptr as *libc::c_void,
|
server_handle_ptr as *libc::c_void,
|
||||||
client_stream_handle_ptr as *libc::c_void) {
|
client_stream_handle_ptr as *libc::c_void) {
|
||||||
0i32 => {
|
0i32 => {
|
||||||
log(debug,
|
debug!(
|
||||||
~"successfully accepted client \
|
"successfully accepted client \
|
||||||
connection");
|
connection");
|
||||||
uv::ll::set_data_for_uv_handle(
|
uv::ll::set_data_for_uv_handle(
|
||||||
client_stream_handle_ptr,
|
client_stream_handle_ptr,
|
||||||
|
@ -575,7 +575,7 @@ pub fn accept(new_conn: TcpNewConnection)
|
||||||
result_ch.send(None);
|
result_ch.send(None);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log(debug, ~"failed to accept client conn");
|
debug!("failed to accept client conn");
|
||||||
result_ch.send(Some(
|
result_ch.send(Some(
|
||||||
uv::ll::get_last_err_data(
|
uv::ll::get_last_err_data(
|
||||||
loop_ptr).to_tcp_err()));
|
loop_ptr).to_tcp_err()));
|
||||||
|
@ -583,7 +583,7 @@ pub fn accept(new_conn: TcpNewConnection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log(debug, ~"failed to accept client stream");
|
debug!("failed to accept client stream");
|
||||||
result_ch.send(Some(
|
result_ch.send(Some(
|
||||||
uv::ll::get_last_err_data(
|
uv::ll::get_last_err_data(
|
||||||
loop_ptr).to_tcp_err()));
|
loop_ptr).to_tcp_err()));
|
||||||
|
@ -694,7 +694,7 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||||
let addr_str = ip::format_addr(&loc_ip);
|
let addr_str = ip::format_addr(&loc_ip);
|
||||||
let bind_result = match loc_ip {
|
let bind_result = match loc_ip {
|
||||||
ip::Ipv4(ref addr) => {
|
ip::Ipv4(ref addr) => {
|
||||||
log(debug, fmt!("addr: %?", addr));
|
debug!("addr: %?", addr);
|
||||||
let in_addr = uv::ll::ip4_addr(
|
let in_addr = uv::ll::ip4_addr(
|
||||||
addr_str,
|
addr_str,
|
||||||
port as int);
|
port as int);
|
||||||
|
@ -702,7 +702,7 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||||
ptr::addr_of(&in_addr))
|
ptr::addr_of(&in_addr))
|
||||||
}
|
}
|
||||||
ip::Ipv6(ref addr) => {
|
ip::Ipv6(ref addr) => {
|
||||||
log(debug, fmt!("addr: %?", addr));
|
debug!("addr: %?", addr);
|
||||||
let in_addr = uv::ll::ip6_addr(
|
let in_addr = uv::ll::ip6_addr(
|
||||||
addr_str,
|
addr_str,
|
||||||
port as int);
|
port as int);
|
||||||
|
@ -718,8 +718,8 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||||
tcp_lfc_on_connection_cb) {
|
tcp_lfc_on_connection_cb) {
|
||||||
0i32 => setup_ch.send(None),
|
0i32 => setup_ch.send(None),
|
||||||
_ => {
|
_ => {
|
||||||
log(debug,
|
debug!(
|
||||||
~"failure to uv_tcp_init");
|
"failure to uv_tcp_init");
|
||||||
let err_data =
|
let err_data =
|
||||||
uv::ll::get_last_err_data(
|
uv::ll::get_last_err_data(
|
||||||
loop_ptr);
|
loop_ptr);
|
||||||
|
@ -728,7 +728,7 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log(debug, ~"failure to uv_tcp_bind");
|
debug!("failure to uv_tcp_bind");
|
||||||
let err_data = uv::ll::get_last_err_data(
|
let err_data = uv::ll::get_last_err_data(
|
||||||
loop_ptr);
|
loop_ptr);
|
||||||
setup_ch.send(Some(err_data));
|
setup_ch.send(Some(err_data));
|
||||||
|
@ -736,7 +736,7 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log(debug, ~"failure to uv_tcp_bind");
|
debug!("failure to uv_tcp_bind");
|
||||||
let err_data = uv::ll::get_last_err_data(
|
let err_data = uv::ll::get_last_err_data(
|
||||||
loop_ptr);
|
loop_ptr);
|
||||||
setup_ch.send(Some(err_data));
|
setup_ch.send(Some(err_data));
|
||||||
|
@ -751,9 +751,9 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||||
Some(ref err_data) => {
|
Some(ref err_data) => {
|
||||||
do iotask::interact(iotask) |loop_ptr| {
|
do iotask::interact(iotask) |loop_ptr| {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("tcp::listen post-kill recv hl interact %?",
|
"tcp::listen post-kill recv hl interact %?",
|
||||||
loop_ptr));
|
loop_ptr);
|
||||||
(*server_data_ptr).active = false;
|
(*server_data_ptr).active = false;
|
||||||
uv::ll::close(server_stream_ptr, tcp_lfc_close_cb);
|
uv::ll::close(server_stream_ptr, tcp_lfc_close_cb);
|
||||||
}
|
}
|
||||||
|
@ -761,16 +761,16 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||||
stream_closed_po.recv();
|
stream_closed_po.recv();
|
||||||
match err_data.err_name {
|
match err_data.err_name {
|
||||||
~"EACCES" => {
|
~"EACCES" => {
|
||||||
log(debug, ~"Got EACCES error");
|
debug!("Got EACCES error");
|
||||||
result::Err(AccessDenied)
|
result::Err(AccessDenied)
|
||||||
}
|
}
|
||||||
~"EADDRINUSE" => {
|
~"EADDRINUSE" => {
|
||||||
log(debug, ~"Got EADDRINUSE error");
|
debug!("Got EADDRINUSE error");
|
||||||
result::Err(AddressInUse)
|
result::Err(AddressInUse)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log(debug, fmt!("Got '%s' '%s' libuv error",
|
debug!("Got '%s' '%s' libuv error",
|
||||||
err_data.err_name, err_data.err_msg));
|
err_data.err_name, err_data.err_msg);
|
||||||
result::Err(
|
result::Err(
|
||||||
GenericListenErr(err_data.err_name,
|
GenericListenErr(err_data.err_name,
|
||||||
err_data.err_msg))
|
err_data.err_msg))
|
||||||
|
@ -782,9 +782,9 @@ fn listen_common(host_ip: ip::IpAddr,
|
||||||
let kill_result = kill_po.recv();
|
let kill_result = kill_po.recv();
|
||||||
do iotask::interact(iotask) |loop_ptr| {
|
do iotask::interact(iotask) |loop_ptr| {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("tcp::listen post-kill recv hl interact %?",
|
"tcp::listen post-kill recv hl interact %?",
|
||||||
loop_ptr));
|
loop_ptr);
|
||||||
(*server_data_ptr).active = false;
|
(*server_data_ptr).active = false;
|
||||||
uv::ll::close(server_stream_ptr, tcp_lfc_close_cb);
|
uv::ll::close(server_stream_ptr, tcp_lfc_close_cb);
|
||||||
}
|
}
|
||||||
|
@ -981,9 +981,9 @@ impl io::Writer for TcpSocketBuf {
|
||||||
).to_vec());
|
).to_vec());
|
||||||
if w_result.is_err() {
|
if w_result.is_err() {
|
||||||
let err_data = w_result.get_err();
|
let err_data = w_result.get_err();
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("ERROR sock_buf as io::writer.writer err: %? %?",
|
"ERROR sock_buf as io::writer.writer err: %? %?",
|
||||||
err_data.err_name, err_data.err_msg));
|
err_data.err_name, err_data.err_msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1015,9 +1015,9 @@ fn tear_down_socket_data(socket_data: @TcpSocketData) {
|
||||||
let stream_handle_ptr = (*socket_data).stream_handle_ptr;
|
let stream_handle_ptr = (*socket_data).stream_handle_ptr;
|
||||||
do iotask::interact(&(*socket_data).iotask) |loop_ptr| {
|
do iotask::interact(&(*socket_data).iotask) |loop_ptr| {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("interact dtor for tcp_socket stream %? loop %?",
|
"interact dtor for tcp_socket stream %? loop %?",
|
||||||
stream_handle_ptr, loop_ptr));
|
stream_handle_ptr, loop_ptr);
|
||||||
uv::ll::set_data_for_uv_handle(stream_handle_ptr,
|
uv::ll::set_data_for_uv_handle(stream_handle_ptr,
|
||||||
close_data_ptr);
|
close_data_ptr);
|
||||||
uv::ll::close(stream_handle_ptr, tcp_socket_dtor_close_cb);
|
uv::ll::close(stream_handle_ptr, tcp_socket_dtor_close_cb);
|
||||||
|
@ -1028,7 +1028,7 @@ fn tear_down_socket_data(socket_data: @TcpSocketData) {
|
||||||
//log(debug, fmt!("about to free socket_data at %?", socket_data));
|
//log(debug, fmt!("about to free socket_data at %?", socket_data));
|
||||||
rustrt::rust_uv_current_kernel_free(stream_handle_ptr
|
rustrt::rust_uv_current_kernel_free(stream_handle_ptr
|
||||||
as *libc::c_void);
|
as *libc::c_void);
|
||||||
log(debug, ~"exiting dtor for tcp_socket");
|
debug!("exiting dtor for tcp_socket");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1038,7 +1038,7 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint)
|
||||||
unsafe {
|
unsafe {
|
||||||
use timer;
|
use timer;
|
||||||
|
|
||||||
log(debug, ~"starting tcp::read");
|
debug!("starting tcp::read");
|
||||||
let iotask = &(*socket_data).iotask;
|
let iotask = &(*socket_data).iotask;
|
||||||
let rs_result = read_start_common_impl(socket_data);
|
let rs_result = read_start_common_impl(socket_data);
|
||||||
if result::is_err(&rs_result) {
|
if result::is_err(&rs_result) {
|
||||||
|
@ -1046,17 +1046,17 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint)
|
||||||
result::Err(err_data)
|
result::Err(err_data)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
log(debug, ~"tcp::read before recv_timeout");
|
debug!("tcp::read before recv_timeout");
|
||||||
let read_result = if timeout_msecs > 0u {
|
let read_result = if timeout_msecs > 0u {
|
||||||
timer::recv_timeout(
|
timer::recv_timeout(
|
||||||
iotask, timeout_msecs, result::unwrap(rs_result))
|
iotask, timeout_msecs, result::unwrap(rs_result))
|
||||||
} else {
|
} else {
|
||||||
Some(result::get(&rs_result).recv())
|
Some(result::get(&rs_result).recv())
|
||||||
};
|
};
|
||||||
log(debug, ~"tcp::read after recv_timeout");
|
debug!("tcp::read after recv_timeout");
|
||||||
match read_result {
|
match read_result {
|
||||||
None => {
|
None => {
|
||||||
log(debug, ~"tcp::read: timed out..");
|
debug!("tcp::read: timed out..");
|
||||||
let err_data = TcpErrData {
|
let err_data = TcpErrData {
|
||||||
err_name: ~"TIMEOUT",
|
err_name: ~"TIMEOUT",
|
||||||
err_msg: ~"req timed out"
|
err_msg: ~"req timed out"
|
||||||
|
@ -1065,7 +1065,7 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint)
|
||||||
result::Err(err_data)
|
result::Err(err_data)
|
||||||
}
|
}
|
||||||
Some(data_result) => {
|
Some(data_result) => {
|
||||||
log(debug, ~"tcp::read got data");
|
debug!("tcp::read got data");
|
||||||
read_stop_common_impl(socket_data);
|
read_stop_common_impl(socket_data);
|
||||||
data_result
|
data_result
|
||||||
}
|
}
|
||||||
|
@ -1082,15 +1082,15 @@ fn read_stop_common_impl(socket_data: *TcpSocketData) ->
|
||||||
let (stop_po, stop_ch) = stream::<Option<TcpErrData>>();
|
let (stop_po, stop_ch) = stream::<Option<TcpErrData>>();
|
||||||
do iotask::interact(&(*socket_data).iotask) |loop_ptr| {
|
do iotask::interact(&(*socket_data).iotask) |loop_ptr| {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, ~"in interact cb for tcp::read_stop");
|
debug!("in interact cb for tcp::read_stop");
|
||||||
match uv::ll::read_stop(stream_handle_ptr
|
match uv::ll::read_stop(stream_handle_ptr
|
||||||
as *uv::ll::uv_stream_t) {
|
as *uv::ll::uv_stream_t) {
|
||||||
0i32 => {
|
0i32 => {
|
||||||
log(debug, ~"successfully called uv_read_stop");
|
debug!("successfully called uv_read_stop");
|
||||||
stop_ch.send(None);
|
stop_ch.send(None);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log(debug, ~"failure in calling uv_read_stop");
|
debug!("failure in calling uv_read_stop");
|
||||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||||
stop_ch.send(Some(err_data.to_tcp_err()));
|
stop_ch.send(Some(err_data.to_tcp_err()));
|
||||||
}
|
}
|
||||||
|
@ -1111,21 +1111,21 @@ fn read_start_common_impl(socket_data: *TcpSocketData)
|
||||||
unsafe {
|
unsafe {
|
||||||
let stream_handle_ptr = (*socket_data).stream_handle_ptr;
|
let stream_handle_ptr = (*socket_data).stream_handle_ptr;
|
||||||
let (start_po, start_ch) = stream::<Option<uv::ll::uv_err_data>>();
|
let (start_po, start_ch) = stream::<Option<uv::ll::uv_err_data>>();
|
||||||
log(debug, ~"in tcp::read_start before interact loop");
|
debug!("in tcp::read_start before interact loop");
|
||||||
do iotask::interact(&(*socket_data).iotask) |loop_ptr| {
|
do iotask::interact(&(*socket_data).iotask) |loop_ptr| {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("in tcp::read_start interact cb %?",
|
debug!("in tcp::read_start interact cb %?",
|
||||||
loop_ptr));
|
loop_ptr);
|
||||||
match uv::ll::read_start(stream_handle_ptr
|
match uv::ll::read_start(stream_handle_ptr
|
||||||
as *uv::ll::uv_stream_t,
|
as *uv::ll::uv_stream_t,
|
||||||
on_alloc_cb,
|
on_alloc_cb,
|
||||||
on_tcp_read_cb) {
|
on_tcp_read_cb) {
|
||||||
0i32 => {
|
0i32 => {
|
||||||
log(debug, ~"success doing uv_read_start");
|
debug!("success doing uv_read_start");
|
||||||
start_ch.send(None);
|
start_ch.send(None);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log(debug, ~"error attempting uv_read_start");
|
debug!("error attempting uv_read_start");
|
||||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||||
start_ch.send(Some(err_data));
|
start_ch.send(Some(err_data));
|
||||||
}
|
}
|
||||||
|
@ -1164,19 +1164,19 @@ fn write_common_impl(socket_data_ptr: *TcpSocketData,
|
||||||
let write_data_ptr = ptr::addr_of(&write_data);
|
let write_data_ptr = ptr::addr_of(&write_data);
|
||||||
do iotask::interact(&(*socket_data_ptr).iotask) |loop_ptr| {
|
do iotask::interact(&(*socket_data_ptr).iotask) |loop_ptr| {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("in interact cb for tcp::write %?",
|
debug!("in interact cb for tcp::write %?",
|
||||||
loop_ptr));
|
loop_ptr);
|
||||||
match uv::ll::write(write_req_ptr,
|
match uv::ll::write(write_req_ptr,
|
||||||
stream_handle_ptr,
|
stream_handle_ptr,
|
||||||
write_buf_vec_ptr,
|
write_buf_vec_ptr,
|
||||||
tcp_write_complete_cb) {
|
tcp_write_complete_cb) {
|
||||||
0i32 => {
|
0i32 => {
|
||||||
log(debug, ~"uv_write() invoked successfully");
|
debug!("uv_write() invoked successfully");
|
||||||
uv::ll::set_data_for_req(write_req_ptr,
|
uv::ll::set_data_for_req(write_req_ptr,
|
||||||
write_data_ptr);
|
write_data_ptr);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log(debug, ~"error invoking uv_write()");
|
debug!("error invoking uv_write()");
|
||||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||||
let result_ch = (*write_data_ptr).result_ch.clone();
|
let result_ch = (*write_data_ptr).result_ch.clone();
|
||||||
result_ch.send(TcpWriteError(err_data.to_tcp_err()));
|
result_ch.send(TcpWriteError(err_data.to_tcp_err()));
|
||||||
|
@ -1281,8 +1281,8 @@ extern fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t,
|
||||||
nread: libc::ssize_t,
|
nread: libc::ssize_t,
|
||||||
++buf: uv::ll::uv_buf_t) {
|
++buf: uv::ll::uv_buf_t) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("entering on_tcp_read_cb stream: %? nread: %?",
|
debug!("entering on_tcp_read_cb stream: %? nread: %?",
|
||||||
stream, nread));
|
stream, nread);
|
||||||
let loop_ptr = uv::ll::get_loop_for_uv_handle(stream);
|
let loop_ptr = uv::ll::get_loop_for_uv_handle(stream);
|
||||||
let socket_data_ptr = uv::ll::get_data_for_uv_handle(stream)
|
let socket_data_ptr = uv::ll::get_data_for_uv_handle(stream)
|
||||||
as *TcpSocketData;
|
as *TcpSocketData;
|
||||||
|
@ -1290,8 +1290,8 @@ extern fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t,
|
||||||
// incoming err.. probably eof
|
// incoming err.. probably eof
|
||||||
-1 => {
|
-1 => {
|
||||||
let err_data = uv::ll::get_last_err_data(loop_ptr).to_tcp_err();
|
let err_data = uv::ll::get_last_err_data(loop_ptr).to_tcp_err();
|
||||||
log(debug, fmt!("on_tcp_read_cb: incoming err.. name %? msg %?",
|
debug!("on_tcp_read_cb: incoming err.. name %? msg %?",
|
||||||
err_data.err_name, err_data.err_msg));
|
err_data.err_name, err_data.err_msg);
|
||||||
let reader_ch = &(*socket_data_ptr).reader_ch;
|
let reader_ch = &(*socket_data_ptr).reader_ch;
|
||||||
reader_ch.send(result::Err(err_data));
|
reader_ch.send(result::Err(err_data));
|
||||||
}
|
}
|
||||||
|
@ -1300,7 +1300,7 @@ extern fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t,
|
||||||
// have data
|
// have data
|
||||||
_ => {
|
_ => {
|
||||||
// we have data
|
// we have data
|
||||||
log(debug, fmt!("tcp on_read_cb nread: %d", nread as int));
|
debug!("tcp on_read_cb nread: %d", nread as int);
|
||||||
let reader_ch = &(*socket_data_ptr).reader_ch;
|
let reader_ch = &(*socket_data_ptr).reader_ch;
|
||||||
let buf_base = uv::ll::get_base_from_buf(buf);
|
let buf_base = uv::ll::get_base_from_buf(buf);
|
||||||
let new_bytes = vec::from_buf(buf_base, nread as uint);
|
let new_bytes = vec::from_buf(buf_base, nread as uint);
|
||||||
|
@ -1308,7 +1308,7 @@ extern fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uv::ll::free_base_of_buf(buf);
|
uv::ll::free_base_of_buf(buf);
|
||||||
log(debug, ~"exiting on_tcp_read_cb");
|
debug!("exiting on_tcp_read_cb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1316,12 +1316,12 @@ extern fn on_alloc_cb(handle: *libc::c_void,
|
||||||
suggested_size: size_t)
|
suggested_size: size_t)
|
||||||
-> uv::ll::uv_buf_t {
|
-> uv::ll::uv_buf_t {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, ~"tcp read on_alloc_cb!");
|
debug!("tcp read on_alloc_cb!");
|
||||||
let char_ptr = uv::ll::malloc_buf_base_of(suggested_size);
|
let char_ptr = uv::ll::malloc_buf_base_of(suggested_size);
|
||||||
log(debug, fmt!("tcp read on_alloc_cb h: %? char_ptr: %u sugsize: %u",
|
debug!("tcp read on_alloc_cb h: %? char_ptr: %u sugsize: %u",
|
||||||
handle,
|
handle,
|
||||||
char_ptr as uint,
|
char_ptr as uint,
|
||||||
suggested_size as uint));
|
suggested_size as uint);
|
||||||
uv::ll::buf_init(char_ptr, suggested_size as uint)
|
uv::ll::buf_init(char_ptr, suggested_size as uint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1336,7 +1336,7 @@ extern fn tcp_socket_dtor_close_cb(handle: *uv::ll::uv_tcp_t) {
|
||||||
as *TcpSocketCloseData;
|
as *TcpSocketCloseData;
|
||||||
let closed_ch = (*data).closed_ch.clone();
|
let closed_ch = (*data).closed_ch.clone();
|
||||||
closed_ch.send(());
|
closed_ch.send(());
|
||||||
log(debug, ~"tcp_socket_dtor_close_cb exiting..");
|
debug!("tcp_socket_dtor_close_cb exiting..");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1346,7 +1346,7 @@ extern fn tcp_write_complete_cb(write_req: *uv::ll::uv_write_t,
|
||||||
let write_data_ptr = uv::ll::get_data_for_req(write_req)
|
let write_data_ptr = uv::ll::get_data_for_req(write_req)
|
||||||
as *WriteReqData;
|
as *WriteReqData;
|
||||||
if status == 0i32 {
|
if status == 0i32 {
|
||||||
log(debug, ~"successful write complete");
|
debug!("successful write complete");
|
||||||
let result_ch = (*write_data_ptr).result_ch.clone();
|
let result_ch = (*write_data_ptr).result_ch.clone();
|
||||||
result_ch.send(TcpWriteSuccess);
|
result_ch.send(TcpWriteSuccess);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1354,7 +1354,7 @@ extern fn tcp_write_complete_cb(write_req: *uv::ll::uv_write_t,
|
||||||
write_req);
|
write_req);
|
||||||
let loop_ptr = uv::ll::get_loop_for_uv_handle(stream_handle_ptr);
|
let loop_ptr = uv::ll::get_loop_for_uv_handle(stream_handle_ptr);
|
||||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||||
log(debug, ~"failure to write");
|
debug!("failure to write");
|
||||||
let result_ch = (*write_data_ptr).result_ch.clone();
|
let result_ch = (*write_data_ptr).result_ch.clone();
|
||||||
result_ch.send(TcpWriteError(err_data.to_tcp_err()));
|
result_ch.send(TcpWriteError(err_data.to_tcp_err()));
|
||||||
}
|
}
|
||||||
|
@ -1376,13 +1376,13 @@ extern fn stream_error_close_cb(handle: *uv::ll::uv_tcp_t) {
|
||||||
*ConnectReqData;
|
*ConnectReqData;
|
||||||
let closed_signal_ch = (*data).closed_signal_ch.clone();
|
let closed_signal_ch = (*data).closed_signal_ch.clone();
|
||||||
closed_signal_ch.send(());
|
closed_signal_ch.send(());
|
||||||
log(debug, fmt!("exiting steam_error_close_cb for %?", handle));
|
debug!("exiting steam_error_close_cb for %?", handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern fn tcp_connect_close_cb(handle: *uv::ll::uv_tcp_t) {
|
extern fn tcp_connect_close_cb(handle: *uv::ll::uv_tcp_t) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("closed client tcp handle %?", handle));
|
debug!("closed client tcp handle %?", handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1392,27 +1392,27 @@ extern fn tcp_connect_on_connect_cb(connect_req_ptr: *uv::ll::uv_connect_t,
|
||||||
let conn_data_ptr = (uv::ll::get_data_for_req(connect_req_ptr)
|
let conn_data_ptr = (uv::ll::get_data_for_req(connect_req_ptr)
|
||||||
as *ConnectReqData);
|
as *ConnectReqData);
|
||||||
let result_ch = (*conn_data_ptr).result_ch.clone();
|
let result_ch = (*conn_data_ptr).result_ch.clone();
|
||||||
log(debug, fmt!("tcp_connect result_ch %?", result_ch));
|
debug!("tcp_connect result_ch %?", result_ch);
|
||||||
let tcp_stream_ptr =
|
let tcp_stream_ptr =
|
||||||
uv::ll::get_stream_handle_from_connect_req(connect_req_ptr);
|
uv::ll::get_stream_handle_from_connect_req(connect_req_ptr);
|
||||||
match status {
|
match status {
|
||||||
0i32 => {
|
0i32 => {
|
||||||
log(debug, ~"successful tcp connection!");
|
debug!("successful tcp connection!");
|
||||||
result_ch.send(ConnSuccess);
|
result_ch.send(ConnSuccess);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
log(debug, ~"error in tcp_connect_on_connect_cb");
|
debug!("error in tcp_connect_on_connect_cb");
|
||||||
let loop_ptr = uv::ll::get_loop_for_uv_handle(tcp_stream_ptr);
|
let loop_ptr = uv::ll::get_loop_for_uv_handle(tcp_stream_ptr);
|
||||||
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
let err_data = uv::ll::get_last_err_data(loop_ptr);
|
||||||
log(debug, fmt!("err_data %? %?", err_data.err_name,
|
debug!("err_data %? %?", err_data.err_name,
|
||||||
err_data.err_msg));
|
err_data.err_msg);
|
||||||
result_ch.send(ConnFailure(err_data));
|
result_ch.send(ConnFailure(err_data));
|
||||||
uv::ll::set_data_for_uv_handle(tcp_stream_ptr,
|
uv::ll::set_data_for_uv_handle(tcp_stream_ptr,
|
||||||
conn_data_ptr);
|
conn_data_ptr);
|
||||||
uv::ll::close(tcp_stream_ptr, stream_error_close_cb);
|
uv::ll::close(tcp_stream_ptr, stream_error_close_cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log(debug, ~"leaving tcp_connect_on_connect_cb");
|
debug!("leaving tcp_connect_on_connect_cb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1758,10 +1758,10 @@ pub mod test {
|
||||||
};
|
};
|
||||||
|
|
||||||
let actual_req = server_result_po.recv();
|
let actual_req = server_result_po.recv();
|
||||||
log(debug, fmt!("REQ: expected: '%s' actual: '%s'",
|
debug!("REQ: expected: '%s' actual: '%s'",
|
||||||
expected_req, actual_req));
|
expected_req, actual_req);
|
||||||
log(debug, fmt!("RESP: expected: '%s' actual: '%s'",
|
debug!("RESP: expected: '%s' actual: '%s'",
|
||||||
expected_resp, actual_resp));
|
expected_resp, actual_resp);
|
||||||
fail_unless!(str::contains(actual_req, expected_req));
|
fail_unless!(str::contains(actual_req, expected_req));
|
||||||
fail_unless!(str::contains(actual_resp, expected_resp));
|
fail_unless!(str::contains(actual_resp, expected_resp));
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ fn map_slices<A:Copy + Owned,B:Copy + Owned>(
|
||||||
|
|
||||||
let len = xs.len();
|
let len = xs.len();
|
||||||
if len < min_granularity {
|
if len < min_granularity {
|
||||||
log(info, ~"small slice");
|
info!("small slice");
|
||||||
// This is a small vector, fall back on the normal map.
|
// This is a small vector, fall back on the normal map.
|
||||||
~[f()(0u, xs)]
|
~[f()(0u, xs)]
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ fn map_slices<A:Copy + Owned,B:Copy + Owned>(
|
||||||
|
|
||||||
let mut futures = ~[];
|
let mut futures = ~[];
|
||||||
let mut base = 0u;
|
let mut base = 0u;
|
||||||
log(info, ~"spawning tasks");
|
info!("spawning tasks");
|
||||||
while base < len {
|
while base < len {
|
||||||
let end = uint::min(len, base + items_per_task);
|
let end = uint::min(len, base + items_per_task);
|
||||||
do vec::as_imm_buf(xs) |p, _len| {
|
do vec::as_imm_buf(xs) |p, _len| {
|
||||||
|
@ -63,11 +63,11 @@ fn map_slices<A:Copy + Owned,B:Copy + Owned>(
|
||||||
let len = end - base;
|
let len = end - base;
|
||||||
let slice = (ptr::offset(p, base),
|
let slice = (ptr::offset(p, base),
|
||||||
len * sys::size_of::<A>());
|
len * sys::size_of::<A>());
|
||||||
log(info, fmt!("pre-slice: %?", (base, slice)));
|
info!("pre-slice: %?", (base, slice));
|
||||||
let slice : &[A] =
|
let slice : &[A] =
|
||||||
cast::reinterpret_cast(&slice);
|
cast::reinterpret_cast(&slice);
|
||||||
log(info, fmt!("slice: %?",
|
info!("slice: %?",
|
||||||
(base, vec::len(slice), end - base)));
|
(base, vec::len(slice), end - base));
|
||||||
fail_unless!((vec::len(slice) == end - base));
|
fail_unless!((vec::len(slice) == end - base));
|
||||||
f(base, slice)
|
f(base, slice)
|
||||||
}
|
}
|
||||||
|
@ -76,9 +76,9 @@ fn map_slices<A:Copy + Owned,B:Copy + Owned>(
|
||||||
};
|
};
|
||||||
base += items_per_task;
|
base += items_per_task;
|
||||||
}
|
}
|
||||||
log(info, ~"tasks spawned");
|
info!("tasks spawned");
|
||||||
|
|
||||||
log(info, fmt!("num_tasks: %?", (num_tasks, futures.len())));
|
info!("num_tasks: %?", (num_tasks, futures.len()));
|
||||||
fail_unless!((num_tasks == futures.len()));
|
fail_unless!((num_tasks == futures.len()));
|
||||||
|
|
||||||
let r = do futures.map() |ys| {
|
let r = do futures.map() |ys| {
|
||||||
|
@ -114,7 +114,7 @@ pub fn mapi<A:Copy + Owned,B:Copy + Owned>(
|
||||||
result
|
result
|
||||||
});
|
});
|
||||||
let r = vec::concat(slices);
|
let r = vec::concat(slices);
|
||||||
log(info, (r.len(), xs.len()));
|
info!("%?", (r.len(), xs.len()));
|
||||||
fail_unless!((r.len() == xs.len()));
|
fail_unless!((r.len() == xs.len()));
|
||||||
r
|
r
|
||||||
}
|
}
|
||||||
|
|
|
@ -721,7 +721,7 @@ mod test_qsort3 {
|
||||||
quick_sort3::<int>(v1);
|
quick_sort3::<int>(v1);
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < len {
|
while i < len {
|
||||||
log(debug, v2[i]);
|
debug!(v2[i]);
|
||||||
fail_unless!((v2[i] == v1[i]));
|
fail_unless!((v2[i] == v1[i]));
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
@ -768,7 +768,7 @@ mod test_qsort {
|
||||||
quick_sort::<int>(v1, leual);
|
quick_sort::<int>(v1, leual);
|
||||||
let mut i = 0u;
|
let mut i = 0u;
|
||||||
while i < len {
|
while i < len {
|
||||||
log(debug, v2[i]);
|
debug!(v2[i]);
|
||||||
fail_unless!((v2[i] == v1[i]));
|
fail_unless!((v2[i] == v1[i]));
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
@ -834,7 +834,7 @@ mod tests {
|
||||||
let v3 = merge_sort::<int>(v1, f);
|
let v3 = merge_sort::<int>(v1, f);
|
||||||
let mut i = 0u;
|
let mut i = 0u;
|
||||||
while i < len {
|
while i < len {
|
||||||
log(debug, v3[i]);
|
debug!(v3[i]);
|
||||||
fail_unless!((v3[i] == v2[i]));
|
fail_unless!((v3[i] == v2[i]));
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
@ -918,7 +918,7 @@ mod test_tim_sort {
|
||||||
tim_sort::<int>(v1);
|
tim_sort::<int>(v1);
|
||||||
let mut i = 0u;
|
let mut i = 0u;
|
||||||
while i < len {
|
while i < len {
|
||||||
log(debug, v2[i]);
|
debug!(v2[i]);
|
||||||
fail_unless!((v2[i] == v1[i]));
|
fail_unless!((v2[i] == v1[i]));
|
||||||
i += 1u;
|
i += 1u;
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,8 +142,8 @@ pub fn recv_timeout<T:Copy + Owned>(iotask: &IoTask,
|
||||||
extern fn delayed_send_cb(handle: *uv::ll::uv_timer_t,
|
extern fn delayed_send_cb(handle: *uv::ll::uv_timer_t,
|
||||||
status: libc::c_int) {
|
status: libc::c_int) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug,
|
debug!(
|
||||||
fmt!("delayed_send_cb handle %? status %?", handle, status));
|
"delayed_send_cb handle %? status %?", handle, status);
|
||||||
// Faking a borrowed pointer to our ~SharedChan
|
// Faking a borrowed pointer to our ~SharedChan
|
||||||
let timer_done_ch_ptr: &*c_void = &uv::ll::get_data_for_uv_handle(
|
let timer_done_ch_ptr: &*c_void = &uv::ll::get_data_for_uv_handle(
|
||||||
handle);
|
handle);
|
||||||
|
@ -163,7 +163,7 @@ extern fn delayed_send_cb(handle: *uv::ll::uv_timer_t,
|
||||||
|
|
||||||
extern fn delayed_send_close_cb(handle: *uv::ll::uv_timer_t) {
|
extern fn delayed_send_close_cb(handle: *uv::ll::uv_timer_t) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("delayed_send_close_cb handle %?", handle));
|
debug!("delayed_send_close_cb handle %?", handle);
|
||||||
let timer_done_ch_ptr = uv::ll::get_data_for_uv_handle(handle);
|
let timer_done_ch_ptr = uv::ll::get_data_for_uv_handle(handle);
|
||||||
let timer_done_ch = transmute::<*c_void, ~SharedChan<()>>(
|
let timer_done_ch = transmute::<*c_void, ~SharedChan<()>>(
|
||||||
timer_done_ch_ptr);
|
timer_done_ch_ptr);
|
||||||
|
|
|
@ -136,26 +136,25 @@ mod test {
|
||||||
timer_ptr as *libc::c_void);
|
timer_ptr as *libc::c_void);
|
||||||
let exit_ch = transmute::<*c_void, ~Chan<bool>>(exit_ch_ptr);
|
let exit_ch = transmute::<*c_void, ~Chan<bool>>(exit_ch_ptr);
|
||||||
exit_ch.send(true);
|
exit_ch.send(true);
|
||||||
log(debug,
|
debug!("EXIT_CH_PTR simple_timer_close_cb exit_ch_ptr: %?",
|
||||||
fmt!("EXIT_CH_PTR simple_timer_close_cb exit_ch_ptr: %?",
|
exit_ch_ptr);
|
||||||
exit_ch_ptr));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extern fn simple_timer_cb(timer_ptr: *ll::uv_timer_t,
|
extern fn simple_timer_cb(timer_ptr: *ll::uv_timer_t,
|
||||||
_status: libc::c_int) {
|
_status: libc::c_int) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, ~"in simple timer cb");
|
debug!(~"in simple timer cb");
|
||||||
ll::timer_stop(timer_ptr);
|
ll::timer_stop(timer_ptr);
|
||||||
let hl_loop = &get_gl();
|
let hl_loop = &get_gl();
|
||||||
do iotask::interact(hl_loop) |_loop_ptr| {
|
do iotask::interact(hl_loop) |_loop_ptr| {
|
||||||
log(debug, ~"closing timer");
|
debug!(~"closing timer");
|
||||||
unsafe {
|
unsafe {
|
||||||
ll::close(timer_ptr, simple_timer_close_cb);
|
ll::close(timer_ptr, simple_timer_close_cb);
|
||||||
}
|
}
|
||||||
log(debug, ~"about to deref exit_ch_ptr");
|
debug!(~"about to deref exit_ch_ptr");
|
||||||
log(debug, ~"after msg sent on deref'd exit_ch");
|
debug!(~"after msg sent on deref'd exit_ch");
|
||||||
};
|
};
|
||||||
log(debug, ~"exiting simple timer cb");
|
debug!(~"exiting simple timer cb");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,13 +162,13 @@ mod test {
|
||||||
unsafe {
|
unsafe {
|
||||||
let (exit_po, exit_ch) = stream::<bool>();
|
let (exit_po, exit_ch) = stream::<bool>();
|
||||||
let exit_ch_ptr: *libc::c_void = transmute(~exit_ch);
|
let exit_ch_ptr: *libc::c_void = transmute(~exit_ch);
|
||||||
log(debug, fmt!("EXIT_CH_PTR newly created exit_ch_ptr: %?",
|
debug!("EXIT_CH_PTR newly created exit_ch_ptr: %?",
|
||||||
exit_ch_ptr));
|
exit_ch_ptr);
|
||||||
let timer_handle = ll::timer_t();
|
let timer_handle = ll::timer_t();
|
||||||
let timer_ptr = ptr::addr_of(&timer_handle);
|
let timer_ptr = ptr::addr_of(&timer_handle);
|
||||||
do iotask::interact(iotask) |loop_ptr| {
|
do iotask::interact(iotask) |loop_ptr| {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, ~"user code inside interact loop!!!");
|
debug!(~"user code inside interact loop!!!");
|
||||||
let init_status = ll::timer_init(loop_ptr, timer_ptr);
|
let init_status = ll::timer_init(loop_ptr, timer_ptr);
|
||||||
if(init_status == 0i32) {
|
if(init_status == 0i32) {
|
||||||
ll::set_data_for_uv_handle(
|
ll::set_data_for_uv_handle(
|
||||||
|
@ -188,7 +187,7 @@ mod test {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
exit_po.recv();
|
exit_po.recv();
|
||||||
log(debug,
|
debug!(
|
||||||
~"global_loop timer test: msg recv on exit_po, done..");
|
~"global_loop timer test: msg recv on exit_po, done..");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,7 +224,7 @@ mod test {
|
||||||
for iter::repeat(cycles) {
|
for iter::repeat(cycles) {
|
||||||
exit_po.recv();
|
exit_po.recv();
|
||||||
};
|
};
|
||||||
log(debug, ~"test_stress_gl_uv_global_loop_high_level_global_timer"+
|
debug!(~"test_stress_gl_uv_global_loop_high_level_global_timer"+
|
||||||
~" exiting sucessfully!");
|
~" exiting sucessfully!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,10 +132,10 @@ fn run_loop(iotask_ch: &Chan<IoTask>) {
|
||||||
};
|
};
|
||||||
iotask_ch.send(iotask);
|
iotask_ch.send(iotask);
|
||||||
|
|
||||||
log(debug, ~"about to run uv loop");
|
debug!("about to run uv loop");
|
||||||
// enter the loop... this blocks until the loop is done..
|
// enter the loop... this blocks until the loop is done..
|
||||||
ll::run(loop_ptr);
|
ll::run(loop_ptr);
|
||||||
log(debug, ~"uv loop ended");
|
debug!("uv loop ended");
|
||||||
ll::loop_delete(loop_ptr);
|
ll::loop_delete(loop_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,8 +158,8 @@ fn send_msg(iotask: &IoTask,
|
||||||
extern fn wake_up_cb(async_handle: *ll::uv_async_t,
|
extern fn wake_up_cb(async_handle: *ll::uv_async_t,
|
||||||
status: int) {
|
status: int) {
|
||||||
|
|
||||||
log(debug, fmt!("wake_up_cb extern.. handle: %? status: %?",
|
debug!("wake_up_cb extern.. handle: %? status: %?",
|
||||||
async_handle, status));
|
async_handle, status);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let loop_ptr = ll::get_loop_for_uv_handle(async_handle);
|
let loop_ptr = ll::get_loop_for_uv_handle(async_handle);
|
||||||
|
@ -178,13 +178,13 @@ extern fn wake_up_cb(async_handle: *ll::uv_async_t,
|
||||||
|
|
||||||
fn begin_teardown(data: *IoTaskLoopData) {
|
fn begin_teardown(data: *IoTaskLoopData) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, ~"iotask begin_teardown() called, close async_handle");
|
debug!("iotask begin_teardown() called, close async_handle");
|
||||||
let async_handle = (*data).async_handle;
|
let async_handle = (*data).async_handle;
|
||||||
ll::close(async_handle as *c_void, tear_down_close_cb);
|
ll::close(async_handle as *c_void, tear_down_close_cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extern fn tear_down_walk_cb(handle: *libc::c_void, arg: *libc::c_void) {
|
extern fn tear_down_walk_cb(handle: *libc::c_void, arg: *libc::c_void) {
|
||||||
log(debug, ~"IN TEARDOWN WALK CB");
|
debug!("IN TEARDOWN WALK CB");
|
||||||
// pretty much, if we still have an active handle and it is *not*
|
// pretty much, if we still have an active handle and it is *not*
|
||||||
// the async handle that facilities global loop communication, we
|
// the async handle that facilities global loop communication, we
|
||||||
// want to barf out and fail
|
// want to barf out and fail
|
||||||
|
@ -194,7 +194,7 @@ extern fn tear_down_walk_cb(handle: *libc::c_void, arg: *libc::c_void) {
|
||||||
extern fn tear_down_close_cb(handle: *ll::uv_async_t) {
|
extern fn tear_down_close_cb(handle: *ll::uv_async_t) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let loop_ptr = ll::get_loop_for_uv_handle(handle);
|
let loop_ptr = ll::get_loop_for_uv_handle(handle);
|
||||||
log(debug, ~"in tear_down_close_cb");
|
debug!("in tear_down_close_cb");
|
||||||
ll::walk(loop_ptr, tear_down_walk_cb, handle as *libc::c_void);
|
ll::walk(loop_ptr, tear_down_walk_cb, handle as *libc::c_void);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ extern fn tear_down_close_cb(handle: *ll::uv_async_t) {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern fn async_close_cb(handle: *ll::uv_async_t) {
|
extern fn async_close_cb(handle: *ll::uv_async_t) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("async_close_cb handle %?", handle));
|
debug!("async_close_cb handle %?", handle);
|
||||||
let exit_ch = &(*(ll::get_data_for_uv_handle(handle)
|
let exit_ch = &(*(ll::get_data_for_uv_handle(handle)
|
||||||
as *AhData)).exit_ch;
|
as *AhData)).exit_ch;
|
||||||
let exit_ch = exit_ch.clone();
|
let exit_ch = exit_ch.clone();
|
||||||
|
@ -213,8 +213,7 @@ extern fn async_close_cb(handle: *ll::uv_async_t) {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int) {
|
extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug,
|
debug!("async_handle_cb handle %? status %?",handle,status);
|
||||||
fmt!("async_handle_cb handle %? status %?",handle,status));
|
|
||||||
ll::close(handle, async_close_cb);
|
ll::close(handle, async_close_cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -269,15 +268,15 @@ unsafe fn spawn_test_loop(exit_ch: ~Chan<()>) -> IoTask {
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern fn lifetime_handle_close(handle: *libc::c_void) {
|
extern fn lifetime_handle_close(handle: *libc::c_void) {
|
||||||
unsafe {
|
unsafe {
|
||||||
log(debug, fmt!("lifetime_handle_close ptr %?", handle));
|
debug!("lifetime_handle_close ptr %?", handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
extern fn lifetime_async_callback(handle: *libc::c_void,
|
extern fn lifetime_async_callback(handle: *libc::c_void,
|
||||||
status: libc::c_int) {
|
status: libc::c_int) {
|
||||||
log(debug, fmt!("lifetime_handle_close ptr %? status %?",
|
debug!("lifetime_handle_close ptr %? status %?",
|
||||||
handle, status));
|
handle, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -311,9 +310,9 @@ fn test_uv_iotask_async() {
|
||||||
debug!("waiting");
|
debug!("waiting");
|
||||||
work_exit_po.recv();
|
work_exit_po.recv();
|
||||||
};
|
};
|
||||||
log(debug, ~"sending teardown_loop msg..");
|
debug!(~"sending teardown_loop msg..");
|
||||||
exit(iotask);
|
exit(iotask);
|
||||||
exit_po.recv();
|
exit_po.recv();
|
||||||
log(debug, ~"after recv on exit_po.. exiting..");
|
debug!(~"after recv on exit_po.. exiting..");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,7 @@ pub fn expand_syntax_ext(cx: ext_ctxt, sp: span, tts: &[ast::token_tree])
|
||||||
expr_to_str(cx, args[0],
|
expr_to_str(cx, args[0],
|
||||||
~"first argument to fmt! must be a string literal.");
|
~"first argument to fmt! must be a string literal.");
|
||||||
let fmtspan = args[0].span;
|
let fmtspan = args[0].span;
|
||||||
debug!("Format string:");
|
debug!("Format string: %s", fmt);
|
||||||
log(debug, fmt);
|
|
||||||
fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: &str) -> ! {
|
fn parse_fmt_err_(cx: ext_ctxt, sp: span, msg: &str) -> ! {
|
||||||
cx.span_fatal(sp, msg);
|
cx.span_fatal(sp, msg);
|
||||||
}
|
}
|
||||||
|
@ -223,7 +222,7 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
|
||||||
}
|
}
|
||||||
fn log_conv(c: Conv) {
|
fn log_conv(c: Conv) {
|
||||||
match c.param {
|
match c.param {
|
||||||
Some(p) => { log(debug, ~"param: " + p.to_str()); }
|
Some(p) => { debug!("param: %s", p.to_str()); }
|
||||||
_ => debug!("param: none")
|
_ => debug!("param: none")
|
||||||
}
|
}
|
||||||
for c.flags.each |f| {
|
for c.flags.each |f| {
|
||||||
|
@ -236,18 +235,18 @@ fn pieces_to_expr(cx: ext_ctxt, sp: span,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
match c.width {
|
match c.width {
|
||||||
CountIs(i) => log(
|
CountIs(i) =>
|
||||||
debug, ~"width: count is " + i.to_str()),
|
debug!("width: count is %s", i.to_str()),
|
||||||
CountIsParam(i) => log(
|
CountIsParam(i) =>
|
||||||
debug, ~"width: count is param " + i.to_str()),
|
debug!("width: count is param %s", i.to_str()),
|
||||||
CountIsNextParam => debug!("width: count is next param"),
|
CountIsNextParam => debug!("width: count is next param"),
|
||||||
CountImplied => debug!("width: count is implied")
|
CountImplied => debug!("width: count is implied")
|
||||||
}
|
}
|
||||||
match c.precision {
|
match c.precision {
|
||||||
CountIs(i) => log(
|
CountIs(i) =>
|
||||||
debug, ~"prec: count is " + i.to_str()),
|
debug!("prec: count is %s", i.to_str()),
|
||||||
CountIsParam(i) => log(
|
CountIsParam(i) =>
|
||||||
debug, ~"prec: count is param " + i.to_str()),
|
debug!("prec: count is param %s", i.to_str()),
|
||||||
CountIsNextParam => debug!("prec: count is next param"),
|
CountIsNextParam => debug!("prec: count is next param"),
|
||||||
CountImplied => debug!("prec: count is implied")
|
CountImplied => debug!("prec: count is implied")
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ fn read_line_comments(rdr: @mut StringReader, code_to_the_left: bool,
|
||||||
let mut lines: ~[~str] = ~[];
|
let mut lines: ~[~str] = ~[];
|
||||||
while rdr.curr == '/' && nextch(rdr) == '/' {
|
while rdr.curr == '/' && nextch(rdr) == '/' {
|
||||||
let line = read_one_line_comment(rdr);
|
let line = read_one_line_comment(rdr);
|
||||||
log(debug, line);
|
debug!("%s", line);
|
||||||
if is_doc_comment(line) { // doc-comments are not put in comments
|
if is_doc_comment(line) { // doc-comments are not put in comments
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ fn trim_whitespace_prefix_and_push_line(lines: &mut ~[~str],
|
||||||
s1 = str::slice(s, col, len);
|
s1 = str::slice(s, col, len);
|
||||||
} else { s1 = ~""; }
|
} else { s1 = ~""; }
|
||||||
} else { s1 = /*bad*/ copy s; }
|
} else { s1 = /*bad*/ copy s; }
|
||||||
log(debug, ~"pushing line: " + s1);
|
debug!("pushing line: %s", s1);
|
||||||
lines.push(s1);
|
lines.push(s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -472,7 +472,7 @@ pub impl Printer {
|
||||||
fn print(&mut self, x: token, L: int) {
|
fn print(&mut self, x: token, L: int) {
|
||||||
debug!("print %s %d (remaining line space=%d)", tok_str(x), L,
|
debug!("print %s %d (remaining line space=%d)", tok_str(x), L,
|
||||||
self.space);
|
self.space);
|
||||||
log(debug, buf_str(copy self.token,
|
debug!("%s", buf_str(copy self.token,
|
||||||
copy self.size,
|
copy self.size,
|
||||||
self.left,
|
self.left,
|
||||||
self.right,
|
self.right,
|
||||||
|
|
|
@ -22,6 +22,6 @@ fn main() {
|
||||||
|
|
||||||
for uint::range(0u, n) |i| {
|
for uint::range(0u, n) |i| {
|
||||||
let x = uint::to_str(i);
|
let x = uint::to_str(i);
|
||||||
log(debug, x);
|
debug!(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while vec::any(colors, is_gray) {
|
while vec::any(colors, is_gray) {
|
||||||
// Do the BFS.
|
// Do the BFS.
|
||||||
log(info, fmt!("PBFS iteration %?", i));
|
info!("PBFS iteration %?", i);
|
||||||
i += 1;
|
i += 1;
|
||||||
colors = do colors.mapi() |i, c| {
|
colors = do colors.mapi() |i, c| {
|
||||||
let c : color = *c;
|
let c : color = *c;
|
||||||
|
@ -257,7 +257,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while par::any(colors, is_gray_factory) {
|
while par::any(colors, is_gray_factory) {
|
||||||
// Do the BFS.
|
// Do the BFS.
|
||||||
log(info, fmt!("PBFS iteration %?", i));
|
info!("PBFS iteration %?", i);
|
||||||
i += 1;
|
i += 1;
|
||||||
let old_len = colors.len();
|
let old_len = colors.len();
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ fn validate(edges: ~[(node_id, node_id)],
|
||||||
// parent chains back to the root. While we do this, we also
|
// parent chains back to the root. While we do this, we also
|
||||||
// compute the levels for each node.
|
// compute the levels for each node.
|
||||||
|
|
||||||
log(info, ~"Verifying tree structure...");
|
info!(~"Verifying tree structure...");
|
||||||
|
|
||||||
let mut status = true;
|
let mut status = true;
|
||||||
let level = do tree.map() |parent| {
|
let level = do tree.map() |parent| {
|
||||||
|
@ -352,7 +352,7 @@ fn validate(edges: ~[(node_id, node_id)],
|
||||||
// 2. Each tree edge connects vertices whose BFS levels differ by
|
// 2. Each tree edge connects vertices whose BFS levels differ by
|
||||||
// exactly one.
|
// exactly one.
|
||||||
|
|
||||||
log(info, ~"Verifying tree edges...");
|
info!(~"Verifying tree edges...");
|
||||||
|
|
||||||
let status = do tree.alli() |k, parent| {
|
let status = do tree.alli() |k, parent| {
|
||||||
if *parent != root && *parent != -1i64 {
|
if *parent != root && *parent != -1i64 {
|
||||||
|
@ -368,7 +368,7 @@ fn validate(edges: ~[(node_id, node_id)],
|
||||||
// 3. Every edge in the input list has vertices with levels that
|
// 3. Every edge in the input list has vertices with levels that
|
||||||
// differ by at most one or that both are not in the BFS tree.
|
// differ by at most one or that both are not in the BFS tree.
|
||||||
|
|
||||||
log(info, ~"Verifying graph edges...");
|
info!(~"Verifying graph edges...");
|
||||||
|
|
||||||
let status = do edges.all() |e| {
|
let status = do edges.all() |e| {
|
||||||
let (u, v) = *e;
|
let (u, v) = *e;
|
||||||
|
@ -385,7 +385,7 @@ fn validate(edges: ~[(node_id, node_id)],
|
||||||
// 5. A node and its parent are joined by an edge of the original
|
// 5. A node and its parent are joined by an edge of the original
|
||||||
// graph.
|
// graph.
|
||||||
|
|
||||||
log(info, ~"Verifying tree and graph edges...");
|
info!(~"Verifying tree and graph edges...");
|
||||||
|
|
||||||
let status = do par::alli(tree) {
|
let status = do par::alli(tree) {
|
||||||
let edges = copy edges;
|
let edges = copy edges;
|
||||||
|
|
|
@ -16,6 +16,6 @@ fn my_fail() -> ! { fail!(); }
|
||||||
fn main() {
|
fn main() {
|
||||||
match true { false => { my_fail(); } true => { } }
|
match true { false => { my_fail(); } true => { } }
|
||||||
|
|
||||||
log(debug, x); //~ ERROR unresolved name: `x`.
|
debug!(x); //~ ERROR unresolved name: `x`.
|
||||||
let x: int;
|
let x: int;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
// Check that bogus field access is non-fatal
|
// Check that bogus field access is non-fatal
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = 0;
|
let x = 0;
|
||||||
log(debug, x.foo); //~ ERROR attempted access of field
|
debug!(x.foo); //~ ERROR attempted access of field
|
||||||
log(debug, x.bar); //~ ERROR attempted access of field
|
debug!(x.bar); //~ ERROR attempted access of field
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,11 @@ fn main() {
|
||||||
let a: clam = clam{x: @1, y: @2};
|
let a: clam = clam{x: @1, y: @2};
|
||||||
let b: clam = clam{x: @10, y: @20};
|
let b: clam = clam{x: @10, y: @20};
|
||||||
let z: int = a.x + b.y;
|
let z: int = a.x + b.y;
|
||||||
log(debug, z);
|
debug!(z);
|
||||||
fail_unless!((z == 21));
|
fail_unless!((z == 21));
|
||||||
let forty: fish = fish{a: @40};
|
let forty: fish = fish{a: @40};
|
||||||
let two: fish = fish{a: @2};
|
let two: fish = fish{a: @2};
|
||||||
let answer: int = forty.a + two.a;
|
let answer: int = forty.a + two.a;
|
||||||
log(debug, answer);
|
debug!(answer);
|
||||||
fail_unless!((answer == 42));
|
fail_unless!((answer == 42));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,4 @@
|
||||||
// error-pattern:expected `~str` but found `int`
|
// error-pattern:expected `~str` but found `int`
|
||||||
|
|
||||||
const i: str = 10i;
|
const i: str = 10i;
|
||||||
fn main() { log(debug, i); }
|
fn main() { debug!(i); }
|
||||||
|
|
|
@ -18,6 +18,6 @@ fn compute1() -> float {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = compute1();
|
let x = compute1();
|
||||||
log(debug, x);
|
debug!(x);
|
||||||
fail_unless!((x == -4f));
|
fail_unless!((x == -4f));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,6 @@ fn coerce(b: &fn()) -> extern fn() {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let i = 8;
|
let i = 8;
|
||||||
let f = coerce(|| log(error, i) );
|
let f = coerce(|| error!(i) );
|
||||||
f();
|
f();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@ fn main() {
|
||||||
let x: int = 3;
|
let x: int = 3;
|
||||||
let y: &mut int = &mut x; //~ ERROR illegal borrow
|
let y: &mut int = &mut x; //~ ERROR illegal borrow
|
||||||
*y = 5;
|
*y = 5;
|
||||||
log (debug, *y);
|
debug!(*y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,5 +26,5 @@ fn main() {
|
||||||
let x = foo(10);
|
let x = foo(10);
|
||||||
let _y = copy x;
|
let _y = copy x;
|
||||||
//~^ ERROR copying a value of non-copyable type `foo`
|
//~^ ERROR copying a value of non-copyable type `foo`
|
||||||
log(error, x);
|
error!(x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
// error-pattern: dead
|
// error-pattern: dead
|
||||||
|
|
||||||
fn f(caller: str) { log(debug, caller); }
|
fn f(caller: str) { debug!(caller); }
|
||||||
|
|
||||||
fn main() { return f("main"); debug!("Paul is dead"); }
|
fn main() { return f("main"); debug!("Paul is dead"); }
|
||||||
|
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let a = if true { true };
|
let a = if true { true };
|
||||||
log(debug, a);
|
debug!(a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,5 +10,5 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let z = ();
|
let z = ();
|
||||||
log(debug, z[0]); //~ ERROR cannot index a value of type `()`
|
debug!(z[0]); //~ ERROR cannot index a value of type `()`
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
log(error, x); //~ ERROR unresolved name: `x`.
|
error!(x); //~ ERROR unresolved name: `x`.
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
for vec::each(fail!()) |i| {
|
for vec::each(fail!()) |i| {
|
||||||
log (debug, i * 2);
|
debug!(i * 2);
|
||||||
//~^ ERROR the type of this value must be known
|
//~^ ERROR the type of this value must be known
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@ struct cat {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let kitty : cat = cat { x: () };
|
let kitty : cat = cat { x: () };
|
||||||
log (error, *kitty);
|
error!(*kitty);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@ struct cat {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let nyan = cat { foo: () };
|
let nyan = cat { foo: () };
|
||||||
log (error, *nyan);
|
error!(*nyan);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
enum test { thing = 3u } //~ ERROR mismatched types
|
enum test { thing = 3u } //~ ERROR mismatched types
|
||||||
//~^ ERROR expected signed integer constant
|
//~^ ERROR expected signed integer constant
|
||||||
fn main() {
|
fn main() {
|
||||||
log(error, thing as int);
|
error!(thing as int);
|
||||||
fail_unless!((thing as int == 3));
|
fail_unless!((thing as int == 3));
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@ fn main()
|
||||||
{
|
{
|
||||||
|
|
||||||
let _z = match g(1, 2) {
|
let _z = match g(1, 2) {
|
||||||
g(x, x) => { log(debug, x + x); }
|
g(x, x) => { debug!(x + x); }
|
||||||
//~^ ERROR Identifier x is bound more than once in the same pattern
|
//~^ ERROR Identifier x is bound more than once in the same pattern
|
||||||
};
|
};
|
||||||
|
|
||||||
let _z = match i(l(1, 2), m(3, 4)) {
|
let _z = match i(l(1, 2), m(3, 4)) {
|
||||||
i(l(x, _), m(_, x)) //~ ERROR Identifier x is bound more than once in the same pattern
|
i(l(x, _), m(_, x)) //~ ERROR Identifier x is bound more than once in the same pattern
|
||||||
=> { log(error, x + x); }
|
=> { error!(x + x); }
|
||||||
};
|
};
|
||||||
|
|
||||||
let _z = match (1, 2) {
|
let _z = match (1, 2) {
|
||||||
|
|
|
@ -13,5 +13,5 @@ fn main() {
|
||||||
|
|
||||||
const y: int = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant
|
const y: int = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant
|
||||||
|
|
||||||
log(error, y);
|
error!(y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@ fn main() {
|
||||||
Bar = foo //~ ERROR attempt to use a non-constant value in a constant
|
Bar = foo //~ ERROR attempt to use a non-constant value in a constant
|
||||||
}
|
}
|
||||||
|
|
||||||
log(error, Bar);
|
error!(Bar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,10 @@ fn f2(x: &fn()) { x(); }
|
||||||
fn main() {
|
fn main() {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let ctr: @fn() -> int = || { f2(|| i = i + 1 ); i };
|
let ctr: @fn() -> int = || { f2(|| i = i + 1 ); i };
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, i);
|
error!(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,10 +13,10 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
let ctr: @fn() -> int = || { i = i + 1; i };
|
let ctr: @fn() -> int = || { i = i + 1; i };
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, ctr());
|
error!(ctr());
|
||||||
log(error, i);
|
error!(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let i: int;
|
let i: int;
|
||||||
|
|
||||||
log(debug, false && { i = 5; true });
|
debug!(false && { i = 5; true });
|
||||||
log(debug, i); //~ ERROR use of possibly uninitialized variable: `i`
|
debug!(i); //~ ERROR use of possibly uninitialized variable: `i`
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
// Tests that a function with a ! annotation always actually fails
|
// Tests that a function with a ! annotation always actually fails
|
||||||
// error-pattern: some control paths may return
|
// error-pattern: some control paths may return
|
||||||
|
|
||||||
fn bad_bang(i: uint) -> ! { log(debug, 3); }
|
fn bad_bang(i: uint) -> ! { debug!(3); }
|
||||||
|
|
||||||
fn main() { bad_bang(5u); }
|
fn main() { bad_bang(5u); }
|
||||||
|
|
|
@ -12,6 +12,6 @@ fn force(f: &fn()) { f(); }
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: int;
|
let x: int;
|
||||||
force(|| {
|
force(|| {
|
||||||
log(debug, x); //~ ERROR capture of possibly uninitialized variable: `x`
|
debug!(x); //~ ERROR capture of possibly uninitialized variable: `x`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ fn foo() -> int {
|
||||||
x = 0; //~ WARNING unreachable statement
|
x = 0; //~ WARNING unreachable statement
|
||||||
}
|
}
|
||||||
|
|
||||||
log(debug, x); //~ ERROR use of possibly uninitialized variable: `x`
|
debug!(x); //~ ERROR use of possibly uninitialized variable: `x`
|
||||||
|
|
||||||
return 17;
|
return 17;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { log(debug, foo()); }
|
fn main() { debug!(foo()); }
|
||||||
|
|
|
@ -16,9 +16,9 @@ fn foo() -> int {
|
||||||
x = 0; //~ WARNING unreachable statement
|
x = 0; //~ WARNING unreachable statement
|
||||||
}
|
}
|
||||||
|
|
||||||
log(debug, x); //~ ERROR use of possibly uninitialized variable: `x`
|
debug!(x); //~ ERROR use of possibly uninitialized variable: `x`
|
||||||
|
|
||||||
return 17;
|
return 17;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { log(debug, foo()); }
|
fn main() { debug!(foo()); }
|
||||||
|
|
|
@ -9,4 +9,4 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn force(f: &fn() -> int) -> int { f() }
|
fn force(f: &fn() -> int) -> int { f() }
|
||||||
fn main() { log(debug, force(|| {})); } //~ ERROR mismatched types
|
fn main() { debug!(force(|| {})); } //~ ERROR mismatched types
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn foo(x: int) { log(debug, x); }
|
fn foo(x: int) { debug!(x); }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: int; if 1 > 2 { x = 10; }
|
let x: int; if 1 > 2 { x = 10; }
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn foo(x: int) { log(debug, x); }
|
fn foo(x: int) { debug!(x); }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: int;
|
let x: int;
|
||||||
|
|
|
@ -13,5 +13,5 @@ fn main() {
|
||||||
let i: int;
|
let i: int;
|
||||||
i //~ ERROR use of possibly uninitialized variable: `i`
|
i //~ ERROR use of possibly uninitialized variable: `i`
|
||||||
};
|
};
|
||||||
log(error, f());
|
error!(f());
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ fn main() {
|
||||||
let y: ~int = ~42;
|
let y: ~int = ~42;
|
||||||
let mut x: ~int;
|
let mut x: ~int;
|
||||||
loop {
|
loop {
|
||||||
log(debug, y);
|
debug!(y);
|
||||||
loop {
|
loop {
|
||||||
loop {
|
loop {
|
||||||
loop {
|
loop {
|
||||||
|
|
|
@ -13,7 +13,7 @@ fn main() {
|
||||||
let y: ~int = ~42;
|
let y: ~int = ~42;
|
||||||
let mut x: ~int;
|
let mut x: ~int;
|
||||||
loop {
|
loop {
|
||||||
log(debug, y);
|
debug!(y);
|
||||||
// tjc: not sure why it prints the same error twice
|
// tjc: not sure why it prints the same error twice
|
||||||
while true { while true { while true { x = y; copy x; } } }
|
while true { while true { while true { x = y; copy x; } } }
|
||||||
//~^ ERROR use of moved value: `y`
|
//~^ ERROR use of moved value: `y`
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let i: int;
|
let i: int;
|
||||||
|
|
||||||
log(debug, false || { i = 5; true });
|
debug!(false || { i = 5; true });
|
||||||
log(debug, i); //~ ERROR use of possibly uninitialized variable: `i`
|
debug!(i); //~ ERROR use of possibly uninitialized variable: `i`
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn foo(x: int) { log(debug, x); }
|
fn foo(x: int) { debug!(x); }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x: int;
|
let x: int;
|
||||||
|
|
|
@ -11,6 +11,6 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = ~5;
|
let x = ~5;
|
||||||
let y = x;
|
let y = x;
|
||||||
log(debug, *x); //~ ERROR use of moved value: `x`
|
debug!(*x); //~ ERROR use of moved value: `x`
|
||||||
copy y;
|
copy y;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
fn send<T:Owned>(ch: _chan<T>, -data: T) {
|
fn send<T:Owned>(ch: _chan<T>, -data: T) {
|
||||||
log(debug, ch);
|
debug!(ch);
|
||||||
log(debug, data);
|
debug!(data);
|
||||||
fail!();
|
fail!();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ struct _chan<T>(int);
|
||||||
// message after the send deinitializes it
|
// message after the send deinitializes it
|
||||||
fn test00_start(ch: _chan<~int>, message: ~int, _count: ~int) {
|
fn test00_start(ch: _chan<~int>, message: ~int, _count: ~int) {
|
||||||
send(ch, message);
|
send(ch, message);
|
||||||
log(debug, message); //~ ERROR use of moved value: `message`
|
debug!(message); //~ ERROR use of moved value: `message`
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { fail!(); }
|
fn main() { fail!(); }
|
||||||
|
|
|
@ -24,5 +24,5 @@ fn main() {
|
||||||
|
|
||||||
fail_unless!((*arc::get(&arc_v))[2] == 3);
|
fail_unless!((*arc::get(&arc_v))[2] == 3);
|
||||||
|
|
||||||
log(info, arc_v);
|
info!(arc_v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,5 +22,5 @@ fn main() {
|
||||||
|
|
||||||
fail_unless!((*arc::get(&arc_v))[2] == 3); //~ ERROR use of moved value: `arc_v`
|
fail_unless!((*arc::get(&arc_v))[2] == 3); //~ ERROR use of moved value: `arc_v`
|
||||||
|
|
||||||
log(info, arc_v);
|
info!(arc_v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,6 @@ fn main() {
|
||||||
|
|
||||||
do task::spawn {
|
do task::spawn {
|
||||||
let y = x.take(); //~ ERROR value has non-owned type
|
let y = x.take(); //~ ERROR value has non-owned type
|
||||||
log(error, y);
|
error!(y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,5 @@ fn foo(i:int) -> foo {
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = foo(10);
|
let x = foo(10);
|
||||||
let _y = copy x; //~ ERROR copying a value of non-copyable type
|
let _y = copy x; //~ ERROR copying a value of non-copyable type
|
||||||
log(error, x);
|
error!(x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,5 @@ struct foo {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
log(debug, foo{ x: 1 } as int);
|
debug!(foo{ x: 1 } as int);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,4 +10,4 @@
|
||||||
|
|
||||||
// error-pattern:literal out of range
|
// error-pattern:literal out of range
|
||||||
|
|
||||||
fn main() { log(debug, 300u8); }
|
fn main() { debug!(300u8); }
|
||||||
|
|
|
@ -18,7 +18,7 @@ enum bar { t1((), Option<~[int]>), t2, }
|
||||||
fn foo(t: bar) {
|
fn foo(t: bar) {
|
||||||
match t {
|
match t {
|
||||||
t1(_, Some::<int>(x)) => {
|
t1(_, Some::<int>(x)) => {
|
||||||
log(debug, x);
|
debug!(x);
|
||||||
}
|
}
|
||||||
_ => { fail!(); }
|
_ => { fail!(); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ fn main() {
|
||||||
// Can't do this copy
|
// Can't do this copy
|
||||||
let x = ~~~A {y: r(i)};
|
let x = ~~~A {y: r(i)};
|
||||||
let _z = copy x; //~ ERROR copying a value of non-copyable type
|
let _z = copy x; //~ ERROR copying a value of non-copyable type
|
||||||
log(debug, x);
|
debug!(x);
|
||||||
}
|
}
|
||||||
log(error, *i);
|
error!(*i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,5 +14,5 @@ fn test(f: @fn(uint) -> uint) -> uint {
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let f: ~fn(x: uint) -> uint = |x| 4u;
|
let f: ~fn(x: uint) -> uint = |x| 4u;
|
||||||
log(debug, test(f)); //~ ERROR expected @ closure, found ~ closure
|
debug!(test(f)); //~ ERROR expected @ closure, found ~ closure
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,5 +19,5 @@ impl Drop for r {
|
||||||
fn main() {
|
fn main() {
|
||||||
let i = ~r { b: true };
|
let i = ~r { b: true };
|
||||||
let _j = copy i; //~ ERROR copying a value of non-copyable type
|
let _j = copy i; //~ ERROR copying a value of non-copyable type
|
||||||
log(debug, i);
|
debug!(i);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,6 @@ fn main() {
|
||||||
f(copy r1, copy r2);
|
f(copy r1, copy r2);
|
||||||
//~^ ERROR copying a value of non-copyable type
|
//~^ ERROR copying a value of non-copyable type
|
||||||
//~^^ ERROR copying a value of non-copyable type
|
//~^^ ERROR copying a value of non-copyable type
|
||||||
log(debug, (r2, *i1));
|
debug!((r2, *i1));
|
||||||
log(debug, (r1, *i2));
|
debug!((r1, *i2));
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
loop{}
|
loop{}
|
||||||
// red herring to make sure compilation fails
|
// red herring to make sure compilation fails
|
||||||
log(error, 42 == 'c');
|
error!(42 == 'c');
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@
|
||||||
// error-pattern:unsupported cast
|
// error-pattern:unsupported cast
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
log(debug, 1.0 as *libc::FILE); // Can't cast float to foreign.
|
debug!(1.0 as *libc::FILE); // Can't cast float to foreign.
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
fn f() {
|
fn f() {
|
||||||
let v = ~[1i];
|
let v = ~[1i];
|
||||||
log(debug, v.some_field_name); //type error
|
debug!(v.some_field_name); //type error
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -25,5 +25,5 @@ fn main() {
|
||||||
let i = ~[r(0)];
|
let i = ~[r(0)];
|
||||||
let j = ~[r(1)];
|
let j = ~[r(1)];
|
||||||
let k = i + j;
|
let k = i + j;
|
||||||
log(debug, j);
|
debug!(j);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,4 @@ fn cmp() -> int {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() { log(error, cmp()); }
|
fn main() { error!(cmp()); }
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// error-pattern:quux
|
// error-pattern:quux
|
||||||
fn my_err(s: ~str) -> ! { log(error, s); fail!(~"quux"); }
|
fn my_err(s: ~str) -> ! { error!(s); fail!(~"quux"); }
|
||||||
fn main() { 3u == my_err(~"bye"); }
|
fn main() { 3u == my_err(~"bye"); }
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// error-pattern:quux
|
// error-pattern:quux
|
||||||
fn my_err(s: ~str) -> ! { log(error, s); fail!(~"quux"); }
|
fn my_err(s: ~str) -> ! { error!(s); fail!(~"quux"); }
|
||||||
fn main() { 3u == my_err(~"bye"); }
|
fn main() { 3u == my_err(~"bye"); }
|
||||||
|
|
|
@ -9,6 +9,6 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// error-pattern:woe
|
// error-pattern:woe
|
||||||
fn f(a: int) { log(debug, a); }
|
fn f(a: int) { debug!(a); }
|
||||||
|
|
||||||
fn main() { f(fail!(~"woe")); }
|
fn main() { f(fail!(~"woe")); }
|
||||||
|
|
|
@ -17,7 +17,7 @@ pure fn even(x: uint) -> bool {
|
||||||
|
|
||||||
fn foo(x: uint) {
|
fn foo(x: uint) {
|
||||||
if even(x) {
|
if even(x) {
|
||||||
log(debug, x);
|
debug!(x);
|
||||||
} else {
|
} else {
|
||||||
fail!(~"Number is odd");
|
fail!(~"Number is odd");
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// error-pattern:quux
|
// error-pattern:quux
|
||||||
fn my_err(s: ~str) -> ! { log(error, s); fail!(~"quux"); }
|
fn my_err(s: ~str) -> ! { error!(s); fail!(~"quux"); }
|
||||||
fn main() { if my_err(~"bye") { } }
|
fn main() { if my_err(~"bye") { } }
|
||||||
|
|
|
@ -10,5 +10,5 @@
|
||||||
|
|
||||||
// error-pattern:get called on error result: ~"kitty"
|
// error-pattern:get called on error result: ~"kitty"
|
||||||
fn main() {
|
fn main() {
|
||||||
log(error, result::get(&result::Err::<int,~str>(~"kitty")));
|
error!(result::get(&result::Err::<int,~str>(~"kitty")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// error-pattern:whatever
|
// error-pattern:whatever
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
log(error, ~"whatever");
|
error!(~"whatever");
|
||||||
// Setting the exit status only works when the scheduler terminates
|
// Setting the exit status only works when the scheduler terminates
|
||||||
// normally. In this case we're going to fail, so instead of of
|
// normally. In this case we're going to fail, so instead of of
|
||||||
// returning 50 the process will return the typical rt failure code.
|
// returning 50 the process will return the typical rt failure code.
|
||||||
|
|
|
@ -30,7 +30,7 @@ fn r(x:int) -> r {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
log(error, ~"whatever");
|
error!(~"whatever");
|
||||||
do task::spawn {
|
do task::spawn {
|
||||||
let i = r(5);
|
let i = r(5);
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
// error-pattern:whatever
|
// error-pattern:whatever
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
log(error, ~"whatever");
|
error!(~"whatever");
|
||||||
// 101 is the code the runtime uses on task failure and the value
|
// 101 is the code the runtime uses on task failure and the value
|
||||||
// compiletest expects run-fail tests to return.
|
// compiletest expects run-fail tests to return.
|
||||||
os::set_exit_status(101);
|
os::set_exit_status(101);
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
let v = vec::from_fn(1024u, {|n| n});
|
let v = vec::from_fn(1024u, {|n| n});
|
||||||
// this should trip a bounds check
|
// this should trip a bounds check
|
||||||
log(error, v[-1i8]);
|
error!(v[-1i8]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
// Test that the task fails after hiting the recursion limit
|
// Test that the task fails after hiting the recursion limit
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
log(debug, ~"don't optimize me out");
|
debug!(~"don't optimize me out");
|
||||||
main();
|
main();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ fn failfn() {
|
||||||
fn main() {
|
fn main() {
|
||||||
let y = ~0;
|
let y = ~0;
|
||||||
let x: @~fn() = @(|| {
|
let x: @~fn() = @(|| {
|
||||||
log(error, copy y);
|
error!(copy y);
|
||||||
});
|
});
|
||||||
failfn();
|
failfn();
|
||||||
log(error, x);
|
error!(x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ fn failfn() {
|
||||||
fn main() {
|
fn main() {
|
||||||
let y = ~0;
|
let y = ~0;
|
||||||
let x: @@fn() = @|| {
|
let x: @@fn() = @|| {
|
||||||
log(error, copy y);
|
error!(copy y);
|
||||||
};
|
};
|
||||||
failfn();
|
failfn();
|
||||||
log(error, x);
|
error!(x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,6 @@ fn main() {
|
||||||
cast::forget(i1);
|
cast::forget(i1);
|
||||||
let x = @r(i1p);
|
let x = @r(i1p);
|
||||||
failfn();
|
failfn();
|
||||||
log(error, x);
|
error!(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,5 +17,5 @@ fn failfn() {
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = @~"hi";
|
let x = @~"hi";
|
||||||
failfn();
|
failfn();
|
||||||
log(error, x);
|
error!(x);
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue