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

Run debuginfo tests against rust-enabled lldb, when possible #54764

Merged
merged 1 commit into from
Oct 10, 2018
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
6 changes: 0 additions & 6 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,6 @@ pub struct Build {
initial_rustc: PathBuf,
initial_cargo: PathBuf,

// Probed tools at runtime
lldb_version: Option<String>,
lldb_python_dir: Option<String>,

// Runtime state filled in later on
// C/C++ compilers and archiver for all targets
cc: HashMap<Interned<String>, cc::Tool>,
Expand Down Expand Up @@ -416,8 +412,6 @@ impl Build {
ar: HashMap::new(),
ranlib: HashMap::new(),
crates: HashMap::new(),
lldb_version: None,
lldb_python_dir: None,
is_sudo,
ci_env: CiEnv::current(),
delayed_failures: RefCell::new(Vec::new()),
Expand Down
13 changes: 0 additions & 13 deletions src/bootstrap/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,19 +236,6 @@ $ pacman -R cmake && pacman -S mingw-w64-x86_64-cmake
}
}

let run = |cmd: &mut Command| {
cmd.output().map(|output| {
String::from_utf8_lossy(&output.stdout)
.lines().next().unwrap_or_else(|| {
panic!("{:?} failed {:?}", cmd, output)
}).to_string()
})
};
build.lldb_version = run(Command::new("lldb").arg("--version")).ok();
if build.lldb_version.is_some() {
build.lldb_python_dir = run(Command::new("lldb").arg("-P")).ok();
}

if let Some(ref s) = build.config.ccache {
cmd_finder.must_have(s);
}
Expand Down
31 changes: 27 additions & 4 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1082,11 +1082,34 @@ impl Step for Compiletest {
if let Some(ref gdb) = builder.config.gdb {
cmd.arg("--gdb").arg(gdb);
}
if let Some(ref vers) = builder.lldb_version {

let run = |cmd: &mut Command| {
cmd.output().map(|output| {
String::from_utf8_lossy(&output.stdout)
.lines().next().unwrap_or_else(|| {
panic!("{:?} failed {:?}", cmd, output)
}).to_string()
})
};
let lldb_exe = if builder.config.lldb_enabled && !target.contains("emscripten") {
// Test against the lldb that was just built.
builder.llvm_out(target)
.join("bin")
.join("lldb")
} else {
PathBuf::from("lldb")
};
let lldb_version = Command::new(&lldb_exe)
.arg("--version")
.output()
.map(|output| { String::from_utf8_lossy(&output.stdout).to_string() })
.ok();
if let Some(ref vers) = lldb_version {
cmd.arg("--lldb-version").arg(vers);
}
if let Some(ref dir) = builder.lldb_python_dir {
cmd.arg("--lldb-python-dir").arg(dir);
let lldb_python_dir = run(Command::new(&lldb_exe).arg("-P")).ok();
if let Some(ref dir) = lldb_python_dir {
cmd.arg("--lldb-python-dir").arg(dir);
}
}

// Get paths from cmd args
Expand Down
27 changes: 18 additions & 9 deletions src/test/debuginfo/associated-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,33 +51,42 @@
// lldb-command:run

// lldb-command:print arg
// lldb-check:[...]$0 = Struct<i32> { b: -1, b1: 0 }
// lldbg-check:[...]$0 = Struct<i32> { b: -1, b1: 0 }
// lldbr-check:(associated_types::Struct<i32>) arg = Struct<i32> { b: -1, b1: 0 }
// lldb-command:continue

// lldb-command:print inferred
// lldb-check:[...]$1 = 1
// lldbg-check:[...]$1 = 1
// lldbr-check:(i64) inferred = 1
// lldb-command:print explicitly
// lldb-check:[...]$2 = 1
// lldbg-check:[...]$2 = 1
// lldbr-check:(i64) explicitly = 1
// lldb-command:continue

// lldb-command:print arg
// lldb-check:[...]$3 = 2
// lldbg-check:[...]$3 = 2
// lldbr-check:(i64) arg = 2
// lldb-command:continue

// lldb-command:print arg
// lldb-check:[...]$4 = (4, 5)
// lldbg-check:[...]$4 = (4, 5)
// lldbr-check:((i32, i64)) arg = { = 4 = 5 }
// lldb-command:continue

// lldb-command:print a
// lldb-check:[...]$5 = 6
// lldbg-check:[...]$5 = 6
// lldbr-check:(i32) a = 6
// lldb-command:print b
// lldb-check:[...]$6 = 7
// lldbg-check:[...]$6 = 7
// lldbr-check:(i64) b = 7
// lldb-command:continue

// lldb-command:print a
// lldb-check:[...]$7 = 8
// lldbg-check:[...]$7 = 8
// lldbr-check:(i64) a = 8
// lldb-command:print b
// lldb-check:[...]$8 = 9
// lldbg-check:[...]$8 = 9
// lldbr-check:(i32) b = 9
// lldb-command:continue

#![allow(unused_variables)]
Expand Down
45 changes: 29 additions & 16 deletions src/test/debuginfo/basic-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,36 +56,49 @@

// lldb-command:run
// lldb-command:print b
// lldb-check:[...]$0 = false
// lldbg-check:[...]$0 = false
// lldbr-check:(bool) b = false
// lldb-command:print i
// lldb-check:[...]$1 = -1
// lldbg-check:[...]$1 = -1
// lldbr-check:(isize) i = -1

// NOTE: LLDB does not support 32bit chars
// d ebugger:print (usize)(c)
// c heck:$3 = 97
// NOTE: only rust-enabled lldb supports 32bit chars
// lldbr-command:print c
// lldbr-check:(char) c = 'a'

// lldb-command:print i8
// lldb-check:[...]$2 = 'D'
// lldbg-check:[...]$2 = 'D'
// lldbr-check:(i8) i8 = 68
// lldb-command:print i16
// lldb-check:[...]$3 = -16
// lldbg-check:[...]$3 = -16
// lldbr-check:(i16) i16 = -16
// lldb-command:print i32
// lldb-check:[...]$4 = -32
// lldbg-check:[...]$4 = -32
// lldbr-check:(i32) i32 = -32
// lldb-command:print i64
// lldb-check:[...]$5 = -64
// lldbg-check:[...]$5 = -64
// lldbr-check:(i64) i64 = -64
// lldb-command:print u
// lldb-check:[...]$6 = 1
// lldbg-check:[...]$6 = 1
// lldbr-check:(usize) u = 1
// lldb-command:print u8
// lldb-check:[...]$7 = 'd'
// lldbg-check:[...]$7 = 'd'
// lldbr-check:(u8) u8 = 100
// lldb-command:print u16
// lldb-check:[...]$8 = 16
// lldbg-check:[...]$8 = 16
// lldbr-check:(u16) u16 = 16
// lldb-command:print u32
// lldb-check:[...]$9 = 32
// lldbg-check:[...]$9 = 32
// lldbr-check:(u32) u32 = 32
// lldb-command:print u64
// lldb-check:[...]$10 = 64
// lldbg-check:[...]$10 = 64
// lldbr-check:(u64) u64 = 64
// lldb-command:print f32
// lldb-check:[...]$11 = 2.5
// lldbg-check:[...]$11 = 2.5
// lldbr-check:(f32) f32 = 2.5
// lldb-command:print f64
// lldb-check:[...]$12 = 3.5
// lldbg-check:[...]$12 = 3.5
// lldbr-check:(f64) f64 = 3.5

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
Expand Down
45 changes: 29 additions & 16 deletions src/test/debuginfo/borrowed-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,47 +68,60 @@

// lldb-command:run
// lldb-command:print *bool_ref
// lldb-check:[...]$0 = true
// lldbg-check:[...]$0 = true
// lldbr-check:(bool) *bool_ref = true

// lldb-command:print *int_ref
// lldb-check:[...]$1 = -1
// lldbg-check:[...]$1 = -1
// lldbr-check:(isize) *int_ref = -1

// NOTE: lldb doesn't support 32bit chars at the moment
// d ebugger:print *char_ref
// c heck:[...]$x = 97
// NOTE: only rust-enabled lldb supports 32bit chars
// lldbr-command:print *char_ref
// lldbr-check:(char) *char_ref = 'a'

// lldb-command:print *i8_ref
// lldb-check:[...]$2 = 'D'
// lldbg-check:[...]$2 = 'D'
// lldbr-check:(i8) *i8_ref = 68

// lldb-command:print *i16_ref
// lldb-check:[...]$3 = -16
// lldbg-check:[...]$3 = -16
// lldbr-check:(i16) *i16_ref = -16

// lldb-command:print *i32_ref
// lldb-check:[...]$4 = -32
// lldbg-check:[...]$4 = -32
// lldbr-check:(i32) *i32_ref = -32

// lldb-command:print *i64_ref
// lldb-check:[...]$5 = -64
// lldbg-check:[...]$5 = -64
// lldbr-check:(i64) *i64_ref = -64

// lldb-command:print *uint_ref
// lldb-check:[...]$6 = 1
// lldbg-check:[...]$6 = 1
// lldbr-check:(usize) *uint_ref = 1

// lldb-command:print *u8_ref
// lldb-check:[...]$7 = 'd'
// lldbg-check:[...]$7 = 'd'
// lldbr-check:(u8) *u8_ref = 100

// lldb-command:print *u16_ref
// lldb-check:[...]$8 = 16
// lldbg-check:[...]$8 = 16
// lldbr-check:(u16) *u16_ref = 16

// lldb-command:print *u32_ref
// lldb-check:[...]$9 = 32
// lldbg-check:[...]$9 = 32
// lldbr-check:(u32) *u32_ref = 32

// lldb-command:print *u64_ref
// lldb-check:[...]$10 = 64
// lldbg-check:[...]$10 = 64
// lldbr-check:(u64) *u64_ref = 64

// lldb-command:print *f32_ref
// lldb-check:[...]$11 = 2.5
// lldbg-check:[...]$11 = 2.5
// lldbr-check:(f32) *f32_ref = 2.5

// lldb-command:print *f64_ref
// lldb-check:[...]$12 = 3.5
// lldbg-check:[...]$12 = 3.5
// lldbr-check:(f64) *f64_ref = 3.5

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
Expand Down
9 changes: 6 additions & 3 deletions src/test/debuginfo/borrowed-c-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@
// lldb-command:run

// lldb-command:print *the_a_ref
// lldb-check:[...]$0 = TheA
// lldbg-check:[...]$0 = TheA
// lldbr-check:(borrowed_c_style_enum::ABC) *the_a_ref = borrowed_c_style_enum::ABC::TheA

// lldb-command:print *the_b_ref
// lldb-check:[...]$1 = TheB
// lldbg-check:[...]$1 = TheB
// lldbr-check:(borrowed_c_style_enum::ABC) *the_b_ref = borrowed_c_style_enum::ABC::TheB

// lldb-command:print *the_c_ref
// lldb-check:[...]$2 = TheC
// lldbg-check:[...]$2 = TheC
// lldbr-check:(borrowed_c_style_enum::ABC) *the_c_ref = borrowed_c_style_enum::ABC::TheC

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
Expand Down
9 changes: 6 additions & 3 deletions src/test/debuginfo/borrowed-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@
// lldb-command:run

// lldb-command:print *the_a_ref
// lldb-check:[...]$0 = TheA { x: 0, y: 8970181431921507452 }
// lldbg-check:[...]$0 = TheA { x: 0, y: 8970181431921507452 }
// lldbr-check:(borrowed_enum::ABC::TheA) *the_a_ref = TheA { borrowed_enum::ABC::TheA: 0, borrowed_enum::ABC::TheB: 8970181431921507452 }
// lldb-command:print *the_b_ref
// lldb-check:[...]$1 = TheB(0, 286331153, 286331153)
// lldbg-check:[...]$1 = TheB(0, 286331153, 286331153)
// lldbr-check:(borrowed_enum::ABC::TheB) *the_b_ref = { = 0 = 286331153 = 286331153 }
// lldb-command:print *univariant_ref
// lldb-check:[...]$2 = TheOnlyCase(4820353753753434)
// lldbg-check:[...]$2 = TheOnlyCase(4820353753753434)
// lldbr-check:(borrowed_enum::Univariant) *univariant_ref = { borrowed_enum::TheOnlyCase = { = 4820353753753434 } }

#![allow(unused_variables)]
#![feature(omit_gdb_pretty_printer_section)]
Expand Down
21 changes: 14 additions & 7 deletions src/test/debuginfo/borrowed-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,32 @@
// lldb-command:run

// lldb-command:print *stack_val_ref
// lldb-check:[...]$0 = SomeStruct { x: 10, y: 23.5 }
// lldbg-check:[...]$0 = SomeStruct { x: 10, y: 23.5 }
// lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = SomeStruct { x: 10, y: 23.5 }

// lldb-command:print *stack_val_interior_ref_1
// lldb-check:[...]$1 = 10
// lldbg-check:[...]$1 = 10
// lldbr-check:(isize) *stack_val_interior_ref_1 = 10

// lldb-command:print *stack_val_interior_ref_2
// lldb-check:[...]$2 = 23.5
// lldbg-check:[...]$2 = 23.5
// lldbr-check:(f64) *stack_val_interior_ref_2 = 23.5

// lldb-command:print *ref_to_unnamed
// lldb-check:[...]$3 = SomeStruct { x: 11, y: 24.5 }
// lldbg-check:[...]$3 = SomeStruct { x: 11, y: 24.5 }
// lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = SomeStruct { x: 11, y: 24.5 }

// lldb-command:print *unique_val_ref
// lldb-check:[...]$4 = SomeStruct { x: 13, y: 26.5 }
// lldbg-check:[...]$4 = SomeStruct { x: 13, y: 26.5 }
// lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = SomeStruct { x: 13, y: 26.5 }

// lldb-command:print *unique_val_interior_ref_1
// lldb-check:[...]$5 = 13
// lldbg-check:[...]$5 = 13
// lldbr-check:(isize) *unique_val_interior_ref_1 = 13

// lldb-command:print *unique_val_interior_ref_2
// lldb-check:[...]$6 = 26.5
// lldbg-check:[...]$6 = 26.5
// lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5

#![allow(unused_variables)]
#![feature(box_syntax)]
Expand Down
9 changes: 6 additions & 3 deletions src/test/debuginfo/borrowed-tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@
// lldb-command:run

// lldb-command:print *stack_val_ref
// lldb-check:[...]$0 = (-14, -19)
// lldbg-check:[...]$0 = (-14, -19)
// lldbr-check:((i16, f32)) *stack_val_ref = { = -14 = -19 }

// lldb-command:print *ref_to_unnamed
// lldb-check:[...]$1 = (-15, -20)
// lldbg-check:[...]$1 = (-15, -20)
// lldbr-check:((i16, f32)) *ref_to_unnamed = { = -15 = -20 }

// lldb-command:print *unique_val_ref
// lldb-check:[...]$2 = (-17, -22)
// lldbg-check:[...]$2 = (-17, -22)
// lldbr-check:((i16, f32)) *unique_val_ref = { = -17 = -22 }


#![allow(unused_variables)]
Expand Down
Loading