Skip to content

Makecheck debuginfo arm linux androideabi #10261

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

Merged
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
13 changes: 13 additions & 0 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,19 @@ pub fn mode_str(mode: mode) -> ~str {
}

pub fn run_tests(config: &config) {
if config.target == ~"arm-linux-androideabi" {
match config.mode{
mode_debug_info => {
println("arm-linux-androideabi debug-info \
test uses tcp 5039 port. please reserve it");
//arm-linux-androideabi debug-info test uses remote debugger
//so, we test 1 task at once
os::setenv("RUST_TEST_TASKS","1");
}
_ =>{}
}
}

let opts = test_opts(config);
let tests = make_tests(config);
// sadly osx needs some file descriptor limits raised for running tests in
Expand Down
23 changes: 23 additions & 0 deletions src/compiletest/procsrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,26 @@ pub fn run(lib_path: &str,
err: str::from_utf8(output.error)
}
}

pub fn run_background(lib_path: &str,
prog: &str,
args: &[~str],
env: ~[(~str, ~str)],
input: Option<~str>) -> run::Process {

let env = env + target_env(lib_path, prog);
let mut process = run::Process::new(prog, args, run::ProcessOptions {
env: Some(env),
dir: None,
in_fd: None,
out_fd: None,
err_fd: None
});

for input in input.iter() {
process.input().write(input.as_bytes());
}

return process;
}

134 changes: 112 additions & 22 deletions src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ use std::rt::io::File;
use std::os;
use std::str;
use std::vec;
use std::rt::io::net::tcp;
use std::rt::io::net::ip::{Ipv4Addr, SocketAddr};
use std::task;
use std::rt::io::timer;

use extra::test::MetricMap;

Expand Down Expand Up @@ -245,6 +249,7 @@ actual:\n\
}

fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {

// do not optimize debuginfo tests
let mut config = match config.rustcflags {
Some(ref flags) => config {
Expand All @@ -254,39 +259,125 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
None => (*config).clone()
};
let config = &mut config;
let cmds = props.debugger_cmds.connect("\n");
let check_lines = &props.check_lines;
let mut cmds = props.debugger_cmds.connect("\n");

// compile test file (it shoud have 'compile-flags:-g' in the header)
let mut ProcRes = compile_test(config, props, testfile);
if ProcRes.status != 0 {
fatal_ProcRes(~"compilation failed!", &ProcRes);
}

// write debugger script
let script_str = [~"set charset UTF-8",
cmds,
~"quit\n"].connect("\n");
debug!("script_str = {}", script_str);
dump_output_file(config, testfile, script_str, "debugger.script");

// run debugger script with gdb
#[cfg(windows)]
fn debugger() -> ~str { ~"gdb.exe" }
#[cfg(unix)]
fn debugger() -> ~str { ~"gdb" }
let debugger_script = make_out_name(config, testfile, "debugger.script");
let exe_file = make_exe_name(config, testfile);
// FIXME (#9639): This needs to handle non-utf8 paths
let debugger_opts = ~[~"-quiet", ~"-batch", ~"-nx",
~"-command=" + debugger_script.as_str().unwrap().to_owned(),
exe_file.as_str().unwrap().to_owned()];
let ProcArgs = ProcArgs {prog: debugger(), args: debugger_opts};
ProcRes = compose_and_run(config, testfile, ProcArgs, ~[], "", None);

let mut ProcArgs;
match config.target {
~"arm-linux-androideabi" => {
if (config.adb_device_status) {

cmds = cmds.replace("run","continue");

// write debugger script
let script_str = [~"set charset UTF-8",
format!("file {}",exe_file.as_str().unwrap().to_owned()),
~"target remote :5039",
cmds,
~"quit"].connect("\n");
debug!("script_str = {}", script_str);
dump_output_file(config, testfile, script_str, "debugger.script");


procsrv::run("", config.adb_path.clone(),
[~"push", exe_file.as_str().unwrap().to_owned(), config.adb_test_dir.clone()],
~[(~"",~"")], Some(~""));

procsrv::run("", config.adb_path,
[~"forward", ~"tcp:5039", ~"tcp:5039"],
~[(~"",~"")], Some(~""));

let adb_arg = format!("export LD_LIBRARY_PATH={}; gdbserver :5039 {}/{}",
config.adb_test_dir.clone(), config.adb_test_dir.clone(),
str::from_utf8(exe_file.filename().unwrap())).clone();

let mut process = procsrv::run_background("", config.adb_path.clone(),
[~"shell",adb_arg.clone()],~[(~"",~"")], Some(~""));
loop {
//waiting 1 second for gdbserver start
timer::sleep(1000);
let result = do task::try {
tcp::TcpStream::connect(
SocketAddr { ip: Ipv4Addr(127, 0, 0, 1), port: 5039 });
};
if result.is_err() {
continue;
}
break;
}

let args = split_maybe_args(&config.rustcflags);
let mut tool_path:~str = ~"";
for arg in args.iter() {
if arg.contains("--android-cross-path=") {
tool_path = arg.replace("--android-cross-path=","");
break;
}
}

if tool_path.equals(&~"") {
fatal(~"cannot found android cross path");
}

let debugger_script = make_out_name(config, testfile, "debugger.script");
// FIXME (#9639): This needs to handle non-utf8 paths
let debugger_opts = ~[~"-quiet", ~"-batch", ~"-nx",
"-command=" + debugger_script.as_str().unwrap().to_owned()];

let procsrv::Result{ out, err, status }=
procsrv::run("",
tool_path.append("/bin/arm-linux-androideabi-gdb"),
debugger_opts, ~[(~"",~"")], None);
let cmdline = {
let cmdline = make_cmdline("", "arm-linux-androideabi-gdb", debugger_opts);
logv(config, format!("executing {}", cmdline));
cmdline
};

ProcRes = ProcRes {status: status,
stdout: out,
stderr: err,
cmdline: cmdline};
process.force_destroy();
}
}

_=> {
// write debugger script
let script_str = [~"set charset UTF-8",
cmds,
~"quit\n"].connect("\n");
debug!("script_str = {}", script_str);
dump_output_file(config, testfile, script_str, "debugger.script");

// run debugger script with gdb
#[cfg(windows)]
fn debugger() -> ~str { ~"gdb.exe" }
#[cfg(unix)]
fn debugger() -> ~str { ~"gdb" }

let debugger_script = make_out_name(config, testfile, "debugger.script");

// FIXME (#9639): This needs to handle non-utf8 paths
let debugger_opts = ~[~"-quiet", ~"-batch", ~"-nx",
"-command=" + debugger_script.as_str().unwrap().to_owned(),
exe_file.as_str().unwrap().to_owned()];
ProcArgs = ProcArgs {prog: debugger(), args: debugger_opts};
ProcRes = compose_and_run(config, testfile, ProcArgs, ~[], "", None);
}
}

if ProcRes.status != 0 {
fatal(~"gdb failed to execute");
}

let num_check_lines = check_lines.len();
if num_check_lines > 0 {
// Allow check lines to leave parts unspecified (e.g., uninitialized
Expand Down Expand Up @@ -834,7 +925,6 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
for tv in args.args.iter() {
runargs.push(tv.to_owned());
}

procsrv::run("", config.adb_path, runargs, ~[(~"",~"")], Some(~""));

// get exitcode of result
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/basic-types-metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/basic-types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// about UTF-32 character encoding and will print a rust char as only
// its numerical value.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/borrowed-basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// Gdb doesn't know about UTF-32 character encoding and will print a rust char as only
// its numerical value.

Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/borrowed-c-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/borrowed-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/boxed-vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

#[feature(managed_boxes)];

// compile-flags:-Z extra-debug-info
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/by-value-non-immediate-argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/by-value-self-argument-in-trait-impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

#[feature(managed_boxes)];

// compile-flags:-Z extra-debug-info
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/c-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/closure-in-generic-function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/destructured-fn-argument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

#[feature(managed_boxes)];

// compile-flags:-Z extra-debug-info
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/evec-in-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:set print pretty off
// debugger:rbreak zzz
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/generic-function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/generic-functions-nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/generic-method-on-generic-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/generic-struct-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:set print union on
// debugger:rbreak zzz
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/generic-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
// debugger:run
Expand Down
2 changes: 2 additions & 0 deletions src/test/debug-info/generic-tuple-style-enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:set print union on
// debugger:rbreak zzz
Expand Down
1 change: 1 addition & 0 deletions src/test/debug-info/lexical-scope-in-for-loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

// xfail-win32
// xfail-android

// compile-flags:-Z extra-debug-info
// debugger:rbreak zzz
Expand Down
Loading