test: Fix tests.

This commit is contained in:
Patrick Walton 2013-04-26 14:04:39 -07:00
parent f30f54e9d0
commit 876483dcf4
31 changed files with 114 additions and 190 deletions

View file

@ -225,7 +225,7 @@ fn bfs2(graph: graph, key: node_id) -> bfs_result {
}
/// A parallel version of the bfs function.
fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
fn pbfs(graph: &arc::ARC<graph>, key: node_id) -> bfs_result {
// This works by doing functional updates of a color vector.
enum color {
@ -236,7 +236,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
black(node_id)
};
let graph_vec = arc::get(&graph); // FIXME #3387 requires this temp
let graph_vec = arc::get(graph); // FIXME #3387 requires this temp
let mut colors = do vec::from_fn(graph_vec.len()) |i| {
if i as node_id == key {
gray(key)
@ -271,7 +271,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
let color_vec = arc::get(&color); // FIXME #3387 requires this temp
colors = do par::mapi(*color_vec) {
let colors = arc::clone(&color);
let graph = arc::clone(&graph);
let graph = arc::clone(graph);
let result: ~fn(+x: uint, +y: &color) -> color = |i, c| {
let colors = arc::get(&colors);
let graph = arc::get(&graph);
@ -496,7 +496,7 @@ fn main() {
}
let start = time::precise_time_s();
let bfs_tree = pbfs(graph_arc, *root);
let bfs_tree = pbfs(&graph_arc, *root);
let stop = time::precise_time_s();
total_par += stop - start;

View file

@ -34,7 +34,7 @@ enum request {
stop
}
fn server(requests: Port<request>, responses: comm::Chan<uint>) {
fn server(requests: &Port<request>, responses: &comm::Chan<uint>) {
let mut count = 0u;
let mut done = false;
while !done {
@ -76,7 +76,7 @@ fn run(args: &[~str]) {
};
}
do task::spawn || {
server(from_parent, to_parent);
server(&from_parent, &to_parent);
}
for vec::each(worker_results) |r| {

View file

@ -30,7 +30,7 @@ enum request {
stop
}
fn server(requests: PortSet<request>, responses: Chan<uint>) {
fn server(requests: &PortSet<request>, responses: &Chan<uint>) {
let mut count = 0;
let mut done = false;
while !done {
@ -73,7 +73,7 @@ fn run(args: &[~str]) {
};
}
do task::spawn || {
server(from_parent, to_parent);
server(&from_parent, &to_parent);
}
for vec::each(worker_results) |r| {

View file

@ -104,8 +104,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: &comm::Port<~[u8]>,
to_parent: &comm::Chan<~str>) {
let mut freqs: HashMap<~[u8], uint> = HashMap::new();
let mut carry: ~[u8] = ~[];
let mut total: uint = 0u;
@ -140,7 +140,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"))
@ -168,7 +168,7 @@ fn main() {
let (from_parent, to_child) = comm::stream();
do task::spawn_with(from_parent) |from_parent| {
make_sequence_processor(sz, from_parent, to_parent_);
make_sequence_processor(sz, &from_parent, &to_parent_);
};
to_child

View file

@ -30,7 +30,7 @@ use core::result;
use core::result::{Ok, Err};
fn fib(n: int) -> int {
fn pfib(c: Chan<int>, n: int) {
fn pfib(c: &Chan<int>, n: int) {
if n == 0 {
c.send(0);
} else if n <= 2 {
@ -38,15 +38,15 @@ fn fib(n: int) -> int {
} else {
let p = PortSet::new();
let ch = p.chan();
task::spawn(|| pfib(ch, n - 1) );
task::spawn(|| pfib(&ch, n - 1) );
let ch = p.chan();
task::spawn(|| pfib(ch, n - 2) );
task::spawn(|| pfib(&ch, n - 2) );
c.send(p.recv() + p.recv());
}
}
let (p, ch) = stream();
let _t = task::spawn(|| pfib(ch, n) );
let _t = task::spawn(|| pfib(&ch, n) );
p.recv()
}