Skip to content

Commit 6367afa

Browse files
committed
Support for test/debuginfo on android
1 parent d1e9a76 commit 6367afa

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
@@ -384,15 +384,21 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
384384
match &*config.target {
385385
"arm-linux-androideabi" | "aarch64-linux-android" => {
386386

387-
cmds = cmds.replace("run", "continue").to_string();
387+
cmds = cmds.replace("run", "continue");
388388

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

427433
let adb_arg = format!("export LD_LIBRARY_PATH={}; \
428-
gdbserver :5039 {}/{}",
434+
gdbserver{} :5039 {}/{}",
429435
config.adb_test_dir.clone(),
436+
if config.target.contains("aarch64")
437+
{"64"} else {""},
430438
config.adb_test_dir.clone(),
431439
str::from_utf8(
432440
exe_file.filename()
@@ -496,7 +504,9 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
496504
stderr: err,
497505
cmdline: cmdline
498506
};
499-
process.signal_kill().unwrap();
507+
if process.signal_kill().is_err() {
508+
println!("Adb process is already finished.");
509+
}
500510
}
501511

502512
_=> {

0 commit comments

Comments
 (0)