Skip to content

Commit 34ed5f5

Browse files
committed
Unbreak the debuginfo tests.
The variant used in debug-info/method-on-enum.rs had its layout changed by the smaller discriminant, so that the `u32` no longer overlaps both of the `u16`s, and thus the debugger is printing partially uninitialized data when it prints the wrong variant. Thus, the test runner is modified to accept wildcards (using a string that should be unlikely to occur literally), to allow for this.
1 parent 52fb0fc commit 34ed5f5

File tree

2 files changed

+33
-10
lines changed

2 files changed

+33
-10
lines changed

src/compiletest/runtest.rs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
273273
};
274274
let config = &mut config;
275275
let cmds = props.debugger_cmds.connect("\n");
276-
let check_lines = props.check_lines.clone();
276+
let check_lines = &props.check_lines;
277277

278278
// compile test file (it shoud have 'compile-flags:-g' in the header)
279279
let mut ProcRes = compile_test(config, props, testfile);
@@ -305,11 +305,34 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
305305

306306
let num_check_lines = check_lines.len();
307307
if num_check_lines > 0 {
308+
// Allow check lines to leave parts unspecified (e.g., uninitialized
309+
// bits in the wrong case of an enum) with the notation "[...]".
310+
let check_fragments: ~[~[&str]] = check_lines.map(|s| s.split_str_iter("[...]").collect());
308311
// check if each line in props.check_lines appears in the
309312
// output (in order)
310313
let mut i = 0u;
311314
for line in ProcRes.stdout.line_iter() {
312-
if check_lines[i].trim() == line.trim() {
315+
let mut rest = line.trim();
316+
let mut first = true;
317+
let mut failed = false;
318+
for &frag in check_fragments[i].iter() {
319+
let found = if first {
320+
if rest.starts_with(frag) { Some(0) } else { None }
321+
} else {
322+
rest.find_str(frag)
323+
};
324+
match found {
325+
None => {
326+
failed = true;
327+
break;
328+
}
329+
Some(i) => {
330+
rest = rest.slice_from(i + frag.len());
331+
}
332+
}
333+
first = false;
334+
}
335+
if !failed && rest.len() == 0 {
313336
i += 1u;
314337
}
315338
if i == num_check_lines {

src/test/debug-info/method-on-enum.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// STACK BY REF
1616
// debugger:finish
1717
// debugger:print *self
18-
// check:$1 = {{Variant2, x = 1799, y = 1799}, {Variant2, 117901063}}
18+
// check:$1 = {{Variant2, [...]}, {Variant2, 117901063}}
1919
// debugger:print arg1
2020
// check:$2 = -1
2121
// debugger:print arg2
@@ -25,7 +25,7 @@
2525
// STACK BY VAL
2626
// debugger:finish
2727
// d ebugger:print self -- ignored for now because of issue #8512
28-
// c heck:$X = {{Variant2, x = 1799, y = 1799}, {Variant2, 117901063}}
28+
// c heck:$X = {{Variant2, [...]}, {Variant2, 117901063}}
2929
// debugger:print arg1
3030
// check:$4 = -3
3131
// debugger:print arg2
@@ -35,7 +35,7 @@
3535
// OWNED BY REF
3636
// debugger:finish
3737
// debugger:print *self
38-
// check:$6 = {{Variant1, x = 1799, y = 1799}, {Variant1, 117901063}}
38+
// check:$6 = {{Variant1, x = 1799, y = 1799}, {Variant1, [...]}}
3939
// debugger:print arg1
4040
// check:$7 = -5
4141
// debugger:print arg2
@@ -45,7 +45,7 @@
4545
// OWNED BY VAL
4646
// debugger:finish
4747
// d ebugger:print self -- ignored for now because of issue #8512
48-
// c heck:$X = {{Variant1, x = 1799, y = 1799}, {Variant1, 117901063}}
48+
// c heck:$X = {{Variant1, x = 1799, y = 1799}, {Variant1, [...]}}
4949
// debugger:print arg1
5050
// check:$9 = -7
5151
// debugger:print arg2
@@ -55,7 +55,7 @@
5555
// OWNED MOVED
5656
// debugger:finish
5757
// debugger:print *self
58-
// check:$11 = {{Variant1, x = 1799, y = 1799}, {Variant1, 117901063}}
58+
// check:$11 = {{Variant1, x = 1799, y = 1799}, {Variant1, [...]}}
5959
// debugger:print arg1
6060
// check:$12 = -9
6161
// debugger:print arg2
@@ -65,7 +65,7 @@
6565
// MANAGED BY REF
6666
// debugger:finish
6767
// debugger:print *self
68-
// check:$14 = {{Variant2, x = 1799, y = 1799}, {Variant2, 117901063}}
68+
// check:$14 = {{Variant2, [...]}, {Variant2, 117901063}}
6969
// debugger:print arg1
7070
// check:$15 = -11
7171
// debugger:print arg2
@@ -75,7 +75,7 @@
7575
// MANAGED BY VAL
7676
// debugger:finish
7777
// d ebugger:print self -- ignored for now because of issue #8512
78-
// c heck:$X = {{Variant2, x = 1799, y = 1799}, {Variant2, 117901063}}
78+
// c heck:$X = {{Variant2, [...]}, {Variant2, 117901063}}
7979
// debugger:print arg1
8080
// check:$17 = -13
8181
// debugger:print arg2
@@ -85,7 +85,7 @@
8585
// MANAGED SELF
8686
// debugger:finish
8787
// debugger:print self->val
88-
// check:$19 = {{Variant2, x = 1799, y = 1799}, {Variant2, 117901063}}
88+
// check:$19 = {{Variant2, [...]}, {Variant2, 117901063}}
8989
// debugger:print arg1
9090
// check:$20 = -15
9191
// debugger:print arg2

0 commit comments

Comments
 (0)