Skip to content

Commit 604adcb

Browse files
committed
Support for test/debuginfo on android
1 parent dfe8930 commit 604adcb

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

src/compiletest/runtest.rs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -385,15 +385,21 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
385385
match config.target.as_slice() {
386386
"arm-linux-androideabi" | "aarch64-linux-android" => {
387387

388-
cmds = cmds.replace("run", "continue").to_string();
388+
cmds = cmds.replace("run", "continue");
389389

390390
// write debugger script
391-
let script_str = ["set charset UTF-8".to_string(),
392-
format!("file {}", exe_file.as_str().unwrap()
393-
.to_string()),
394-
"target remote :5039".to_string(),
395-
cmds,
396-
"quit".to_string()].connect("\n");
391+
let mut script_str = String::with_capacity(2048);
392+
script_str.push_str("set charset UTF-8\n");
393+
script_str.push_str(format!("file {}\n", exe_file.as_str().unwrap()).as_slice());
394+
script_str.push_str("target remote :5039\n");
395+
for line in breakpoint_lines.iter() {
396+
script_str.push_str(&format!("break {:?}:{}\n",
397+
testfile.filename_display(),
398+
*line)[]);
399+
}
400+
script_str.push_str(cmds.as_slice());
401+
script_str.push_str("quit\n");
402+
397403
debug!("script_str = {}", script_str);
398404
dump_output_file(config,
399405
testfile,
@@ -426,8 +432,10 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
426432
.expect(format!("failed to exec `{:?}`", config.adb_path).as_slice());
427433

428434
let adb_arg = format!("export LD_LIBRARY_PATH={}; \
429-
gdbserver :5039 {}/{}",
435+
gdbserver{} :5039 {}/{}",
430436
config.adb_test_dir.clone(),
437+
if config.target.as_slice() == "aarch64-linux-android"
438+
{"64"} else {""},
431439
config.adb_test_dir.clone(),
432440
str::from_utf8(
433441
exe_file.filename()
@@ -497,7 +505,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
497505
stderr: err,
498506
cmdline: cmdline
499507
};
500-
process.signal_kill().unwrap();
508+
if process.signal_kill().is_err() {
509+
println!("Adb process is already finished.");
510+
}
501511
}
502512

503513
_=> {

0 commit comments

Comments
 (0)