Fix warnings in src/test/bench tests. Nobody will ever care.

This commit is contained in:
Ben Blum 2013-07-17 15:31:20 -04:00
parent 7ad7911222
commit 4bcda7148d
26 changed files with 60 additions and 78 deletions

View File

@ -30,7 +30,7 @@ macro_rules! bench (
fn main() {
let argv = os::args();
let tests = argv.slice(1, argv.len());
let _tests = argv.slice(1, argv.len());
bench!(shift_push);
bench!(read_line);
@ -44,7 +44,7 @@ fn main() {
fn maybe_run_test(argv: &[~str], name: ~str, test: &fn()) {
let mut run_test = false;
if os::getenv(~"RUST_BENCH").is_some() {
if os::getenv("RUST_BENCH").is_some() {
run_test = true
} else if argv.len() > 0 {
run_test = argv.iter().any(|x| x == &~"all") || argv.iter().any(|x| x == &name)

View File

@ -13,7 +13,7 @@ use std::uint;
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"10000000"]
} else if args.len() <= 1u {
~[~"", ~"100000"]

View File

@ -410,7 +410,7 @@ fn validate(edges: ~[(node_id, node_id)],
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"15", ~"48"]
} else if args.len() <= 1 {
~[~"", ~"10", ~"16"]
@ -447,7 +447,7 @@ fn main() {
let graph_arc = arc::ARC(graph.clone());
do gen_search_keys(graph, num_keys).map() |root| {
io::stdout().write_line(~"");
io::stdout().write_line("");
io::stdout().write_line(fmt!("Search key: %?", root));
if do_sequential {
@ -511,7 +511,7 @@ fn main() {
}
};
io::stdout().write_line(~"");
io::stdout().write_line("");
io::stdout().write_line(
fmt!("Total sequential: %? \t Total Parallel: %? \t Speedup: %?x",
total_seq, total_par, total_seq / total_par));

View File

@ -22,15 +22,12 @@ extern mod extra;
use std::comm::{Port, Chan, SharedChan};
use std::comm;
use std::io::{Writer, WriterUtil};
use std::io;
use std::os;
use std::task;
use std::ptr;
use std::uint;
use std::vec;
fn move_out<T>(x: T) {}
fn move_out<T>(_x: T) {}
enum request {
get_count,
@ -38,7 +35,7 @@ enum request {
stop
}
fn server(requests: &Port<request>, responses: &comm::Chan<uint>) {
fn server(requests: &Port<request>, responses: &Chan<uint>) {
let mut count = 0u;
let mut done = false;
while !done {
@ -102,7 +99,7 @@ fn run(args: &[~str]) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"1000000", ~"10000"]
} else if args.len() <= 1u {
~[~"", ~"10000", ~"4"]

View File

@ -16,16 +16,13 @@
extern mod extra;
use std::comm::{Port, PortSet, Chan, stream};
use std::io::{Writer, WriterUtil};
use std::comm::{PortSet, Chan, stream};
use std::io;
use std::os;
use std::ptr;
use std::task;
use std::uint;
use std::vec;
fn move_out<T>(x: T) {}
fn move_out<T>(_x: T) {}
enum request {
get_count,
@ -98,7 +95,7 @@ fn run(args: &[~str]) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"1000000", ~"8"]
} else if args.len() <= 1u {
~[~"", ~"10000", ~"4"]

View File

@ -24,7 +24,6 @@ use std::cell::Cell;
use std::io;
use std::os;
use std::uint;
use std::vec;
// A poor man's pipe.
type pipe = arc::MutexARC<~[uint]>;
@ -60,8 +59,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
// Send/Receive lots of messages.
for uint::range(0u, count) |j| {
//error!("task %?, iter %?", i, j);
let mut num_chan2 = num_chan.take_unwrap();
let mut num_port2 = num_port.take_unwrap();
let num_chan2 = num_chan.take_unwrap();
let num_port2 = num_port.take_unwrap();
send(&num_chan2, i * j);
num_chan = Some(num_chan2);
let _n = recv(&num_port2);
@ -72,7 +71,7 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"100", ~"10000"]
} else if args.len() <= 1u {
~[~"", ~"10", ~"100"]
@ -84,7 +83,7 @@ fn main() {
let msg_per_task = uint::from_str(args[2]).get();
let (num_chan, num_port) = init();
let mut num_chan = Cell::new(num_chan);
let num_chan = Cell::new(num_chan);
let start = time::precise_time_s();

View File

@ -24,7 +24,6 @@ use std::cell::Cell;
use std::io;
use std::os;
use std::pipes::recv;
use std::ptr;
use std::uint;
use std::util;
@ -58,7 +57,7 @@ fn thread_ring(i: uint,
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"100", ~"10000"]
} else if args.len() <= 1u {
~[~"", ~"100", ~"1000"]
@ -70,7 +69,7 @@ fn main() {
let msg_per_task = uint::from_str(args[2]).get();
let (num_port, num_chan) = ring::init();
let mut num_chan = Cell::new(num_chan);
let num_chan = Cell::new(num_chan);
let start = time::precise_time_s();

View File

@ -24,7 +24,6 @@ use std::cell::Cell;
use std::io;
use std::os;
use std::uint;
use std::vec;
// A poor man's pipe.
type pipe = arc::RWARC<~[uint]>;
@ -56,8 +55,8 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
// Send/Receive lots of messages.
for uint::range(0u, count) |j| {
//error!("task %?, iter %?", i, j);
let mut num_chan2 = num_chan.take_unwrap();
let mut num_port2 = num_port.take_unwrap();
let num_chan2 = num_chan.take_unwrap();
let num_port2 = num_port.take_unwrap();
send(&num_chan2, i * j);
num_chan = Some(num_chan2);
let _n = recv(&num_port2);
@ -68,7 +67,7 @@ fn thread_ring(i: uint, count: uint, num_chan: pipe, num_port: pipe) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"100", ~"10000"]
} else if args.len() <= 1u {
~[~"", ~"10", ~"100"]
@ -80,7 +79,7 @@ fn main() {
let msg_per_task = uint::from_str(args[2]).get();
let (num_chan, num_port) = init();
let mut num_chan = Cell::new(num_chan);
let num_chan = Cell::new(num_chan);
let start = time::precise_time_s();

View File

@ -190,7 +190,7 @@ fn timeit(f: &fn()) -> float {
}
fn main() {
let count = if os::getenv(~"RUST_BENCH").is_some() {
let count = if os::getenv("RUST_BENCH").is_some() {
250000
} else {
100

View File

@ -28,7 +28,7 @@ fn ack(m: int, n: int) -> int {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"12"]
} else if args.len() <= 1u {
~[~"", ~"8"]

View File

@ -40,7 +40,7 @@ fn main() {
use std::os;
use std::int;
let args = std::os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"17"]
} else if args.len() <= 1u {
~[~"", ~"8"]

View File

@ -12,7 +12,6 @@
extern mod extra;
use extra::sort;
use std::cell::Cell;
use std::comm::*;
use std::io;
@ -20,7 +19,6 @@ use std::option;
use std::os;
use std::task;
use std::uint;
use std::vec;
fn print_complements() {
let all = [Blue, Red, Yellow];
@ -206,7 +204,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"200000"]
} else if args.len() <= 1u {
~[~"", ~"600"]
@ -217,10 +215,10 @@ fn main() {
let nn = uint::from_str(args[1]).get();
print_complements();
io::println(~"");
io::println("");
rendezvous(nn, ~[Blue, Red, Yellow]);
io::println(~"");
io::println("");
rendezvous(nn,
~[Blue, Red, Yellow, Red, Yellow, Blue, Red, Yellow, Red, Blue]);

View File

@ -2,7 +2,6 @@ use std::cast::transmute;
use std::from_str::FromStr;
use std::libc::{FILE, STDOUT_FILENO, c_int, fdopen, fputc, fputs, fwrite, size_t};
use std::os;
use std::str;
use std::uint::{min, range};
use std::vec::bytes::copy_memory;
use std::vec;

View File

@ -24,7 +24,7 @@ fn fib(n: int) -> int {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"40"]
} else if args.len() <= 1u {
~[~"", ~"30"]

View File

@ -121,8 +121,8 @@ fn windows_with_carry(bb: &[u8], nn: uint,
}
fn make_sequence_processor(sz: uint,
from_parent: &comm::Port<~[u8]>,
to_parent: &comm::Chan<~str>) {
from_parent: &Port<~[u8]>,
to_parent: &Chan<~str>) {
let mut freqs: HashMap<~[u8], uint> = HashMap::new();
let mut carry: ~[u8] = ~[];
let mut total: uint = 0u;
@ -143,11 +143,11 @@ fn make_sequence_processor(sz: uint,
let buffer = match sz {
1u => { sort_and_fmt(&freqs, total) }
2u => { sort_and_fmt(&freqs, total) }
3u => { fmt!("%u\t%s", find(&freqs, ~"GGT"), ~"GGT") }
4u => { fmt!("%u\t%s", find(&freqs, ~"GGTA"), ~"GGTA") }
6u => { fmt!("%u\t%s", find(&freqs, ~"GGTATT"), ~"GGTATT") }
12u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATT"), ~"GGTATTTTAATT") }
18u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATTTATAGT"), ~"GGTATTTTAATTTATAGT") }
3u => { fmt!("%u\t%s", find(&freqs, ~"GGT"), "GGT") }
4u => { fmt!("%u\t%s", find(&freqs, ~"GGTA"), "GGTA") }
6u => { fmt!("%u\t%s", find(&freqs, ~"GGTATT"), "GGTATT") }
12u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATT"), "GGTATTTTAATT") }
18u => { fmt!("%u\t%s", find(&freqs, ~"GGTATTTTAATTTATAGT"), "GGTATTTTAATTTATAGT") }
_ => { ~"" }
};
@ -156,8 +156,7 @@ fn make_sequence_processor(sz: uint,
// given a FASTA file on stdin, process sequence THREE
fn main() {
let args = os::args();
let rdr = if os::getenv(~"RUST_BENCH").is_some() {
let rdr = if os::getenv("RUST_BENCH").is_some() {
// FIXME: Using this compile-time env variable is a crummy way to
// get to this massive data set, but include_bin! chokes on it (#2598)
let path = Path(env!("CFG_SRC_DIR"))
@ -203,7 +202,7 @@ fn main() {
// start processing if this is the one
('>', false) => {
match line.slice_from(1).find_str(~"THREE") {
match line.slice_from(1).find_str("THREE") {
option::Some(_) => { proc_mode = true; }
option::None => { }
}
@ -217,7 +216,7 @@ fn main() {
let line_bytes = line.as_bytes();
for sizes.iter().enumerate().advance |(ii, _sz)| {
let mut lb = line_bytes.to_owned();
let lb = line_bytes.to_owned();
to_child[ii].send(lb);
}
}

View File

@ -1,7 +1,6 @@
use std::from_str::FromStr;
use std::os;
use std::uint::range;
use std::vec;
static PI: f64 = 3.141592653589793;
static SOLAR_MASS: f64 = 4.0 * PI * PI;

View File

@ -28,7 +28,6 @@ use std::io::WriterUtil;
use std::io;
use std::os;
use std::result::{Ok, Err};
use std::str;
use std::task;
use std::u64;
use std::uint;
@ -59,13 +58,13 @@ struct Config {
}
fn parse_opts(argv: ~[~str]) -> Config {
let opts = ~[getopts::optflag(~"stress")];
let opts = ~[getopts::optflag("stress")];
let opt_args = argv.slice(1, argv.len());
match getopts::getopts(opt_args, opts) {
Ok(ref m) => {
return Config {stress: getopts::opt_present(m, ~"stress")}
return Config {stress: getopts::opt_present(m, "stress")}
}
Err(_) => { fail!(); }
}
@ -97,7 +96,7 @@ fn stress(num_tasks: int) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"20"]
} else if args.len() <= 1u {
~[~"", ~"8"]

View File

@ -5,7 +5,6 @@ use std::cast::transmute;
use std::libc::{STDOUT_FILENO, c_int, fdopen, fgets, fopen, fputc, fwrite};
use std::libc::{size_t};
use std::ptr::null;
use std::vec::raw::set_len;
static LINE_LEN: u32 = 80;

View File

@ -15,7 +15,7 @@ use std::os;
fn start(n_tasks: int, token: int) {
let (p, ch1) = stream();
let mut p = p;
let mut ch1 = ch1;
let ch1 = ch1;
ch1.send(token);
// XXX could not get this to work with a range closure
let mut i = 2;
@ -55,7 +55,7 @@ fn roundtrip(id: int, n_tasks: int, p: &Port<int>, ch: &Chan<int>) {
}
fn main() {
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"2000000", ~"503"]
}
else {

View File

@ -32,7 +32,7 @@ fn check_sequential(min: uint, max: uint, map: &SmallIntMap<uint>) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"100000", ~"100"]
} else if args.len() <= 1u {
~[~"", ~"10000", ~"50"]

View File

@ -15,7 +15,6 @@ extern mod extra;
use std::io::{ReaderUtil, WriterUtil};
use std::io;
use std::os;
use std::str;
use std::u8;
use std::uint;
use std::unstable::intrinsics::cttz16;
@ -50,7 +49,7 @@ impl Sudoku {
}
pub fn from_vec(vec: &[[u8, ..9], ..9]) -> Sudoku {
let mut g = do vec::from_fn(9u) |i| {
let g = do vec::from_fn(9u) |i| {
do vec::from_fn(9u) |j| { vec[i][j] }
};
return Sudoku::new(g)
@ -161,17 +160,17 @@ impl Sudoku {
// Stores available colors as simple bitfield, bit 0 is always unset
struct Colors(u16);
static heads: u16 = (1u16 << 10) - 1; /* bits 9..0 */
static HEADS: u16 = (1u16 << 10) - 1; /* bits 9..0 */
impl Colors {
fn new(start_color: u8) -> Colors {
// Sets bits 9..start_color
let tails = !0u16 << start_color;
return Colors(heads & tails);
return Colors(HEADS & tails);
}
fn next(&self) -> u8 {
let val = **self & heads;
let val = **self & HEADS;
if (0u16 == val) {
return 0u8;
} else {
@ -190,7 +189,7 @@ impl Colors {
}
}
static default_sudoku: [[u8, ..9], ..9] = [
static DEFAULT_SUDOKU: [[u8, ..9], ..9] = [
/* 0 1 2 3 4 5 6 7 8 */
/* 0 */ [0u8, 4u8, 0u8, 6u8, 0u8, 0u8, 0u8, 3u8, 2u8],
/* 1 */ [0u8, 0u8, 8u8, 0u8, 2u8, 0u8, 0u8, 0u8, 0u8],
@ -204,7 +203,7 @@ static default_sudoku: [[u8, ..9], ..9] = [
];
#[cfg(test)]
static default_solution: [[u8, ..9], ..9] = [
static DEFAULT_SOLUTION: [[u8, ..9], ..9] = [
/* 0 1 2 3 4 5 6 7 8 */
/* 0 */ [1u8, 4u8, 9u8, 6u8, 7u8, 5u8, 8u8, 3u8, 2u8],
/* 1 */ [5u8, 3u8, 8u8, 1u8, 2u8, 9u8, 7u8, 4u8, 6u8],
@ -258,10 +257,10 @@ fn colors_remove_works() {
}
#[test]
fn check_default_sudoku_solution() {
fn check_DEFAULT_SUDOKU_solution() {
// GIVEN
let mut sudoku = Sudoku::from_vec(&default_sudoku);
let solution = Sudoku::from_vec(&default_solution);
let mut sudoku = Sudoku::from_vec(&DEFAULT_SUDOKU);
let solution = Sudoku::from_vec(&DEFAULT_SOLUTION);
// WHEN
sudoku.solve();
@ -274,7 +273,7 @@ fn main() {
let args = os::args();
let use_default = args.len() == 1u;
let mut sudoku = if use_default {
Sudoku::from_vec(&default_sudoku)
Sudoku::from_vec(&DEFAULT_SUDOKU)
} else {
Sudoku::read(io::stdin())
};

View File

@ -22,7 +22,7 @@ enum UniqueList {
}
fn main() {
let (repeat, depth) = if os::getenv(~"RUST_BENCH").is_some() {
let (repeat, depth) = if os::getenv("RUST_BENCH").is_some() {
(50, 1000)
} else {
(10, 10)

View File

@ -43,7 +43,7 @@ fn child_generation(gens_left: uint, c: comm::Chan<()>) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"100000"]
} else if args.len() <= 1 {
~[~"", ~"100"]

View File

@ -63,7 +63,7 @@ fn spawn_supervised_blocking(myname: &str, f: ~fn()) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"100000"]
} else if args.len() <= 1u {
~[~"", ~"100"]

View File

@ -12,7 +12,6 @@
// xfail-test OOM on linux-32 without opts
use std::comm::*;
use std::os;
use std::task;
use std::uint;
@ -49,7 +48,7 @@ fn calc(children: uint, parent_wait_chan: &Chan<Chan<Chan<int>>>) {
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"30"]
} else if args.len() <= 1u {
~[~"", ~"10"]

View File

@ -24,7 +24,7 @@ fn g() { }
fn main() {
let args = os::args();
let args = if os::getenv(~"RUST_BENCH").is_some() {
let args = if os::getenv("RUST_BENCH").is_some() {
~[~"", ~"400"]
} else if args.len() <= 1u {
~[~"", ~"10"]