Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
50 changes: 44 additions & 6 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,29 @@ 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 (start_ver, end_ver) = extract_gdb_version_range(line);

if start_ver != end_ver {
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 < start_ver
} else if line.contains("ignore-gdb-version") {
let (min_version, max_version) = extract_gdb_version_range(line);

if max_version < min_version {
panic!("Malformed GDB version range: max < min")
}

actual_version >= min_version && actual_version <= max_version
} else {
false
}
Expand All @@ -94,6 +104,34 @@ impl EarlyProps {
}
}

// Takes a directive of the form "ignore-gdb-version <version1> [- <version2>]",
// returns the numeric representation of <version1> and <version2> as
// tuple: (<version1> as u32, <version2> as u32)
// If the <version2> part is omitted, the second component of the tuple
// is the same as <version1>.
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() {
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