@@ -38,7 +38,7 @@ pub enum test_mode { tm_converge, tm_run, }
38
38
pub struct Context { mode: test_mode } // + rng
39
39
40
40
pub fn write_file(filename: &Path, content: &str) {
41
- result::get(&io::file_writer(filename, ~ [io::Create, io::Truncate]))
41
+ result::get(&io::file_writer(filename, [io::Create, io::Truncate]))
42
42
.write_str(content);
43
43
}
44
44
@@ -47,12 +47,12 @@ pub fn contains(haystack: &str, needle: &str) -> bool {
47
47
}
48
48
49
49
pub fn find_rust_files(files: &mut ~[Path], path: &Path) {
50
- if path.filetype() == Some(~".rs") && !contains(path.to_str(), ~ "utf8") {
50
+ if path.filetype() == Some(~".rs") && !contains(path.to_str(), "utf8") {
51
51
// ignoring "utf8" tests because something is broken
52
52
files.push(path.clone());
53
53
} else if os::path_is_dir(path)
54
- && !contains(path.to_str(), ~ "compile-fail")
55
- && !contains(path.to_str(), ~ "build") {
54
+ && !contains(path.to_str(), "compile-fail")
55
+ && !contains(path.to_str(), "build") {
56
56
for os::list_dir_path(path).each |p| {
57
57
find_rust_files(&mut *files, *p);
58
58
}
@@ -406,34 +406,34 @@ pub fn check_whole_compiler(code: &str,
406
406
407
407
pub fn removeIfExists(filename: &Path) {
408
408
// So sketchy!
409
- assert!(!contains(filename.to_str(), ~ " "));
410
- run::program_output(~ "bash", ~ [~"-c", ~"rm " + filename.to_str()]);
409
+ assert!(!contains(filename.to_str(), " "));
410
+ run::program_output("bash", [~"-c", ~"rm " + filename.to_str()]);
411
411
}
412
412
413
413
pub fn removeDirIfExists(filename: &Path) {
414
414
// So sketchy!
415
- assert!(!contains(filename.to_str(), ~ " "));
416
- run::program_output(~ "bash", ~ [~"-c", ~"rm -r " + filename.to_str()]);
415
+ assert!(!contains(filename.to_str(), " "));
416
+ run::program_output("bash", [~"-c", ~"rm -r " + filename.to_str()]);
417
417
}
418
418
419
419
pub fn check_running(exe_filename: &Path) -> happiness {
420
420
let p = run::program_output(
421
- ~ "/Users/jruderman/scripts/timed_run_rust_program.py",
422
- ~ [exe_filename.to_str()]);
421
+ "/Users/jruderman/scripts/timed_run_rust_program.py",
422
+ [exe_filename.to_str()]);
423
423
let comb = p.out + ~"\n" + p.err;
424
424
if str::len(comb) > 1u {
425
425
error!("comb comb comb: %?", comb);
426
426
}
427
427
428
- if contains(comb, ~ "Assertion failed:") {
428
+ if contains(comb, "Assertion failed:") {
429
429
failed(~"C++ assertion failure")
430
- } else if contains(comb, ~ "leaked memory in rust main loop") {
430
+ } else if contains(comb, "leaked memory in rust main loop") {
431
431
// might also use exit code 134
432
432
//failed("Leaked")
433
433
known_bug(~"https://github.com/mozilla/rust/issues/910")
434
- } else if contains(comb, ~ "src/rt/") {
434
+ } else if contains(comb, "src/rt/") {
435
435
failed(~"Mentioned src/rt/")
436
- } else if contains(comb, ~ "malloc") {
436
+ } else if contains(comb, "malloc") {
437
437
failed(~"Mentioned malloc")
438
438
} else {
439
439
match p.status {
@@ -457,26 +457,26 @@ pub fn check_running(exe_filename: &Path) -> happiness {
457
457
458
458
pub fn check_compiling(filename: &Path) -> happiness {
459
459
let p = run::program_output(
460
- ~ "/Users/jruderman/code/rust/build/x86_64-apple-darwin/\
460
+ "/Users/jruderman/code/rust/build/x86_64-apple-darwin/\
461
461
stage1/bin/rustc",
462
- ~ [filename.to_str()]);
462
+ [filename.to_str()]);
463
463
464
464
//error!("Status: %d", p.status);
465
465
if p.status == 0 {
466
466
passed
467
467
} else if p.err != ~"" {
468
- if contains(p.err, ~ "error:") {
468
+ if contains(p.err, "error:") {
469
469
cleanly_rejected(~"rejected with span_error")
470
470
} else {
471
471
error!("Stderr: %?", p.err);
472
472
failed(~"Unfamiliar error message")
473
473
}
474
- } else if contains(p.out, ~ "Assertion") && contains(p.out, ~ "failed") {
474
+ } else if contains(p.out, "Assertion") && contains(p.out, "failed") {
475
475
error!("Stdout: %?", p.out);
476
476
failed(~"Looks like an llvm assertion failure")
477
- } else if contains(p.out, ~ "internal compiler error unimplemented") {
477
+ } else if contains(p.out, "internal compiler error unimplemented") {
478
478
known_bug(~"Something unimplemented")
479
- } else if contains(p.out, ~ "internal compiler error") {
479
+ } else if contains(p.out, "internal compiler error") {
480
480
error!("Stdout: %?", p.out);
481
481
failed(~"internal compiler error")
482
482
@@ -603,8 +603,8 @@ pub fn check_roundtrip_convergence(code: @~str, maxIters: uint) {
603
603
error!("Did not converge after %u iterations!", i);
604
604
write_file(&Path("round-trip-a.rs"), *oldv);
605
605
write_file(&Path("round-trip-b.rs"), *newv);
606
- run::run_program(~ "diff",
607
- ~ [~"-w", ~"-u", ~"round-trip-a.rs",
606
+ run::run_program("diff",
607
+ [~"-w", ~"-u", ~"round-trip-a.rs",
608
608
~"round-trip-b.rs"]);
609
609
fail!("Mismatch");
610
610
}
@@ -635,7 +635,7 @@ pub fn check_variants(files: &[Path], cx: Context) {
635
635
}
636
636
637
637
let s = @result::get(&io::read_whole_file_str(file));
638
- if contains(*s, ~ "#") {
638
+ if contains(*s, "#") {
639
639
loop; // Macros are confusing
640
640
}
641
641
if cx.mode == tm_converge && content_might_not_converge(*s) {
0 commit comments