Skip to content

Commit d5098c2

Browse files
committed
---
yaml --- r: 5339 b: refs/heads/master c: 72317de h: refs/heads/master i: 5337: 3c6f423 5335: dd14c64 v: v3
1 parent 0f1b9a2 commit d5098c2

File tree

2 files changed

+68
-48
lines changed

2 files changed

+68
-48
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 25394950ae562d6d70249745638edbbd14884d2c
2+
refs/heads/master: 72317dee0ddd80ef224eb3a3cf42861dad156cc9

trunk/src/fuzzer/fuzzer.rs

+67-47
Original file line numberDiff line numberDiff line change
@@ -39,40 +39,39 @@ fn find_rust_files(&files: [str], path: str) {
3939

4040
fn safe_to_steal_expr(e: @ast::expr) -> bool {
4141
alt e.node {
42+
/*
43+
// For compiling (rather than pretty-printing)
44+
// combination of https://github.com/graydon/rust/issues/924 with unwind hang?
45+
ast::expr_ret(option::none.) { false }
46+
*/
4247

43-
// https://github.com/graydon/rust/issues/890
44-
ast::expr_lit(lit) {
45-
alt lit.node {
46-
ast::lit_str(_) { true }
47-
ast::lit_char(_) { true }
48-
ast::lit_int(_) { false }
49-
ast::lit_uint(_) { true }
50-
ast::lit_mach_int(_, _) { false }
51-
ast::lit_float(_) { false }
52-
ast::lit_mach_float(_, _) { false }
53-
ast::lit_nil. { true }
54-
ast::lit_bool(_) { true }
55-
}
56-
}
48+
// If the fuzzer moves a block-ending-in-semicolon into callee position,
49+
// the pretty-printer can't preserve this even by parenthesizing!!
50+
// See email to marijn.
51+
ast::expr_if(_, _, _) { false }
52+
ast::expr_block(_) { false }
53+
ast::expr_alt(_, _) { false }
54+
ast::expr_for(_, _, _) { false }
55+
ast::expr_for_each(_, _, _) { false }
56+
ast::expr_while(_, _) { false }
5757

58-
// https://github.com/graydon/rust/issues/890
58+
// https://github.com/graydon/rust/issues/929
5959
ast::expr_cast(_, _) { false }
6060
ast::expr_assert(_) { false }
6161
ast::expr_binary(_, _, _) { false }
6262
ast::expr_assign(_, _) { false }
6363
ast::expr_assign_op(_, _, _) { false }
6464

65-
// https://github.com/graydon/rust/issues/764
6665
ast::expr_fail(option::none.) { false }
6766
ast::expr_ret(option::none.) { false }
6867
ast::expr_put(option::none.) { false }
6968

70-
// These prefix-operator keywords are not being parenthesized when in callee positions.
71-
// https://github.com/graydon/rust/issues/891
72-
ast::expr_ret(_) { false }
73-
ast::expr_put(_) { false }
69+
// https://github.com/graydon/rust/issues/927
70+
//ast::expr_assert(_) { false }
7471
ast::expr_check(_, _) { false }
75-
ast::expr_log(_, _) { false }
72+
73+
// https://github.com/graydon/rust/issues/928
74+
//ast::expr_cast(_, _) { false }
7675

7776
_ { true }
7877
}
@@ -138,7 +137,12 @@ fn replace_expr_in_crate(crate: ast::crate, i: uint, newexpr: ast::expr) ->
138137
*j_ += 1u;
139138
if i_ + 1u == *j_ && safe_to_replace_expr(original) {
140139
newexpr_
141-
} else { fold::noop_fold_expr(original, fld) }
140+
} else {
141+
alt(original) {
142+
ast::expr_fail(_) { original /* Don't replace inside fail: https://github.com/graydon/rust/issues/930 */ }
143+
_ { fold::noop_fold_expr(original, fld) }
144+
}
145+
}
142146
}
143147
let afp =
144148
{fold_expr: bind fold_expr_rep(j, i, newexpr.node, _, _)
@@ -253,50 +257,65 @@ fn check_whole_compiler(code: str, suggested_filename: str) {
253257
}
254258

255259
fn check_whole_compiler_inner(filename: str) -> compile_result {
260+
/*
256261
let p = std::run::program_output(
257262
"/Users/jruderman/code/rust/build/stage1/rustc",
258263
["-c", filename]);
264+
*/
265+
266+
let p = std::run::program_output("bash", ["-c", "DYLD_LIBRARY_PATH=/Users/jruderman/code/rust/build/stage0/lib:/Users/jruderman/code/rust/build/rustllvm/ /Users/jruderman/code/rust/build/stage1/rustc -c " + filename]);
259267

260268
//log_err #fmt("Status: %d", p.status);
261269
if p.err != "" {
262270
if contains(p.err, "May only branch on boolean predicates") {
263271
known_bug("https://github.com/graydon/rust/issues/892")
264272
} else if contains(p.err, "(S->getType()->isPointerTy() && \"Invalid cast\")") {
265273
known_bug("https://github.com/graydon/rust/issues/895")
266-
} else if contains(p.err, "Initializer type must match GlobalVariable type") {
267-
known_bug("https://github.com/graydon/rust/issues/899")
268274
} else if contains(p.err, "(castIsValid(op, S, Ty) && \"Invalid cast!\"), function Create") {
269275
known_bug("https://github.com/graydon/rust/issues/901")
270276
} else {
271277
log_err "Stderr: " + p.err;
272278
failed("Unfamiliar error message")
273279
}
274-
} else if p.status == 256 {
275-
if contains(p.out, "Out of stack space, sorry") {
276-
known_bug("Recursive types - https://github.com/graydon/rust/issues/742")
277-
} else {
278-
log_err "Stdout: " + p.out;
279-
failed("Unfamiliar sudden exit")
280-
}
281-
} else if p.status == 6 {
282-
if contains(p.out, "get_id_ident: can't find item in ext_map") {
283-
known_bug("https://github.com/graydon/rust/issues/876")
284-
} else if contains(p.out, "Assertion !cx.terminated failed") {
285-
known_bug("https://github.com/graydon/rust/issues/893 or https://github.com/graydon/rust/issues/894")
286-
} else if !contains(p.out, "error:") {
287-
log_err "Stdout: " + p.out;
288-
failed("Rejected the input program without a span-error explanation")
289-
} else {
290-
passed("Rejected the input program cleanly")
291-
}
292-
} else if p.status == 11 {
293-
failed("Crashed!?")
294280
} else if p.status == 0 {
295281
passed("Accepted the input program")
282+
} else if contains(p.out, "Out of stack space, sorry") {
283+
known_bug("Recursive types - https://github.com/graydon/rust/issues/742")
284+
} else if contains(p.out, "Assertion !cx.terminated failed") {
285+
known_bug("https://github.com/graydon/rust/issues/893 or https://github.com/graydon/rust/issues/894")
286+
// } else if contains(p.out, "upcall fail 'non-exhaustive match failure', ../src/comp/middle/trans.rs") {
287+
} else if contains(p.out, "trans_rec expected a rec but found _|_") {
288+
known_bug("https://github.com/graydon/rust/issues/924")
289+
} else if contains(p.out, "Assertion failed: (alloc->magic == MAGIC)") {
290+
known_bug("https://github.com/graydon/rust/issues/934")
291+
} else if contains(p.out, "Assertion failed: (S->getType()->isPointerTy() && \"Invalid cast\")") {
292+
known_bug("https://github.com/graydon/rust/issues/935")
293+
} else if contains(p.out, "Ptr must be a pointer to Val type") {
294+
known_bug("https://github.com/graydon/rust/issues/897")
295+
} else if contains(p.out, "Assertion") && contains(p.out, "failed") {
296+
log_err "Stdout: " + p.out;
297+
failed("Looks like an llvm assertion failure")
298+
299+
} else if contains(p.out, "internal compiler error fail called with unsupported type _|_") {
300+
known_bug("https://github.com/graydon/rust/issues/930")
301+
} else if contains(p.out, "internal compiler error Translating unsupported cast") {
302+
known_bug("https://github.com/graydon/rust/issues/932")
303+
} else if contains(p.out, "internal compiler error sequence_element_type called on non-sequence value") {
304+
known_bug("https://github.com/graydon/rust/issues/931")
305+
} else if contains(p.out, "internal compiler error bit_num: asked for pred constraint, found an init constraint") {
306+
known_bug("https://github.com/graydon/rust/issues/933")
307+
} else if contains(p.out, "internal compiler error unimplemented") {
308+
known_bug("Something unimplemented")
309+
} else if contains(p.out, "internal compiler error") {
310+
log_err "Stdout: " + p.out;
311+
failed("internal compiler error")
312+
313+
} else if contains(p.out, "error:") {
314+
passed("Rejected the input program cleanly")
296315
} else {
297316
log_err p.status;
298317
log_err "!Stdout: " + p.out;
299-
failed("Unfamiliar status code")
318+
failed("What happened?")
300319
}
301320
}
302321

@@ -317,7 +336,7 @@ fn content_is_dangerous_to_modify(code: str) -> bool {
317336
let dangerous_patterns =
318337
["#macro", // not safe to steal things inside of it, because they have a special syntax
319338
"#", // strange representation of the arguments to #fmt, for example
320-
"tag", // typeck hang: https://github.com/graydon/rust/issues/900
339+
"tag", // typeck hang: https://github.com/graydon/rust/issues/742 (from dup #900)
321340
" be "]; // don't want to replace its child with a non-call: "Non-call expression in tail call"
322341

323342
for p: str in dangerous_patterns { if contains(code, p) { ret true; } }
@@ -337,7 +356,7 @@ fn content_is_confusing(code: str) -> bool {
337356
}
338357

339358
fn file_is_confusing(filename: str) -> bool {
340-
let confusing_files = [];
359+
let confusing_files = ["expr-alt.rs"]; // pretty-printing "(a = b) = c" vs "a = b = c" and wrapping
341360

342361
for f in confusing_files { if contains(filename, f) { ret true; } }
343362

@@ -418,6 +437,7 @@ fn main(args: [str]) {
418437
find_rust_files(files, root);
419438
check_convergence(files);
420439
check_variants(files);
440+
421441
log_err "Fuzzer done";
422442
}
423443

0 commit comments

Comments
 (0)