Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debuginfo: Ignore optimized enum tests for GDB versions that can't handle them. #39039

Merged
merged 3 commits into from
Jan 19, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/test/debuginfo/borrowed-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// min-lldb-version: 310
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-struct-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// min-lldb-version: 310
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/generic-tuple-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// min-lldb-version: 310
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/packed-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// min-lldb-version: 310
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/recursive-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// ignore-lldb
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/struct-in-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// min-lldb-version: 310
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/struct-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// min-lldb-version: 310
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/tuple-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// min-lldb-version: 310
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/union-smoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// min-lldb-version: 310
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
1 change: 1 addition & 0 deletions src/test/debuginfo/unique-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// ignore-tidy-linelength
// min-lldb-version: 310
// ignore-gdb-version: 7.11.90 - 7.12

// compile-flags:-g

Expand Down
41 changes: 35 additions & 6 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,24 @@ impl EarlyProps {
return false;
}

if parse_name_directive(line, "ignore-gdb") {
if !line.contains("ignore-gdb-version") &&
parse_name_directive(line, "ignore-gdb") {
return true;
}

if let Some(actual_version) = config.gdb_version {
if line.contains("min-gdb-version") {
let min_version = line.trim()
.split(' ')
.last()
.expect("Malformed GDB version directive");
let min_version = extract_gdb_version_range(line);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the name is misleading because it is both the min and max version? Rather, than renaming, using a destructuring let rather than tuple indexing would probably be more readable.


if min_version.0 != min_version.1 {
panic!("Expected single GDB version")
}
// Ignore if actual version is smaller the minimum required
// version
actual_version < extract_gdb_version(min_version).unwrap()
actual_version < min_version.0
} else if line.contains("ignore-gdb-version") {
let version_range = extract_gdb_version_range(line);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I'd prefer to destructure here.

actual_version >= version_range.0 && actual_version <= version_range.1
} else {
false
}
Expand All @@ -94,6 +99,30 @@ impl EarlyProps {
}
}

fn extract_gdb_version_range(line: &str) -> (u32, u32) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment explaining the return type please?

const ERROR_MESSAGE: &'static str = "Malformed GDB version directive";

let range_components = line.split(' ')
.flat_map(|word| word.split('-'))
.filter(|word| word.len() > 0)
.skip_while(|word| extract_gdb_version(word).is_none())
.collect::<Vec<&str>>();

match range_components.len() {
0 => panic!(ERROR_MESSAGE),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be removed

1 => {
let v = extract_gdb_version(range_components[0]).unwrap();
(v, v)
}
2 => {
let v_min = extract_gdb_version(range_components[0]).unwrap();
let v_max = extract_gdb_version(range_components[1]).expect(ERROR_MESSAGE);
(v_min, v_max)
}
_ => panic!(ERROR_MESSAGE),
}
}

fn ignore_lldb(config: &Config, line: &str) -> bool {
if config.mode != common::DebugInfoLldb {
return false;
Expand Down
3 changes: 0 additions & 3 deletions src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ fn extract_gdb_version(full_version_line: &str) -> Option<u32> {
return Some(((major * 1000) + minor) * 1000 + patch);
}

println!("Could not extract GDB version from line '{}'", full_version_line);
None
}

Expand Down Expand Up @@ -624,8 +623,6 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> {
}).collect::<String>();
if !vers.is_empty() { return Some(vers) }
}
println!("Could not extract LLDB version from line '{}'",
full_version_line);
}
}
None
Expand Down