mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Rollup merge of #149826 - jieyouxu:compiletest-adb, r=Zalathar
compiletest: tidy up `adb_path`/`adb_test_dir` handling Be more faithful that they aren't always available. try-job: arm-android
This commit is contained in:
@@ -575,7 +575,7 @@ pub struct Config {
|
||||
///
|
||||
/// FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for
|
||||
/// `arm-linux-androideabi` target.
|
||||
pub adb_path: Utf8PathBuf,
|
||||
pub adb_path: Option<Utf8PathBuf>,
|
||||
|
||||
/// Extra parameter to run test suite on `arm-linux-androideabi`.
|
||||
///
|
||||
@@ -584,7 +584,7 @@ pub struct Config {
|
||||
///
|
||||
/// FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for
|
||||
/// `arm-linux-androideabi` target.
|
||||
pub adb_test_dir: Utf8PathBuf,
|
||||
pub adb_test_dir: Option<Utf8PathBuf>,
|
||||
|
||||
/// Status whether android device available or not. When unavailable, this will cause tests to
|
||||
/// panic when the test binary is attempted to be run.
|
||||
|
||||
@@ -260,11 +260,9 @@ fn opt_path(m: &getopts::Matches, nm: &str) -> Utf8PathBuf {
|
||||
|
||||
let android_cross_path = matches.opt_str("android-cross-path").map(Utf8PathBuf::from);
|
||||
|
||||
// FIXME: `adb_path` should be an `Option<Utf8PathBuf>`...
|
||||
let adb_path = matches.opt_str("adb-path").map(Utf8PathBuf::from).unwrap_or_default();
|
||||
// FIXME: `adb_test_dir` should be an `Option<Utf8PathBuf>`...
|
||||
let adb_test_dir = matches.opt_str("adb-test-dir").map(Utf8PathBuf::from).unwrap_or_default();
|
||||
let adb_device_status = target.contains("android") && !adb_test_dir.as_str().is_empty();
|
||||
let adb_path = matches.opt_str("adb-path").map(Utf8PathBuf::from);
|
||||
let adb_test_dir = matches.opt_str("adb-test-dir").map(Utf8PathBuf::from);
|
||||
let adb_device_status = target.contains("android") && adb_test_dir.is_some();
|
||||
|
||||
// FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config!
|
||||
let cdb = debuggers::discover_cdb(matches.opt_str("cdb"), &target);
|
||||
|
||||
@@ -150,12 +150,16 @@ fn run_debuginfo_gdb_test(&self) {
|
||||
debug!("script_str = {}", script_str);
|
||||
self.dump_output_file(&script_str, "debugger.script");
|
||||
|
||||
let adb_path = &self.config.adb_path;
|
||||
// Note: when `--android-cross-path` is specified, we expect both `adb_path` and
|
||||
// `adb_test_dir` to be available.
|
||||
let adb_path = self.config.adb_path.as_ref().expect("`adb_path` must be specified");
|
||||
let adb_test_dir =
|
||||
self.config.adb_test_dir.as_ref().expect("`adb_test_dir` must be specified");
|
||||
|
||||
Command::new(adb_path)
|
||||
.arg("push")
|
||||
.arg(&exe_file)
|
||||
.arg(&self.config.adb_test_dir)
|
||||
.arg(adb_test_dir)
|
||||
.status()
|
||||
.unwrap_or_else(|e| panic!("failed to exec `{adb_path:?}`: {e:?}"));
|
||||
|
||||
@@ -167,9 +171,9 @@ fn run_debuginfo_gdb_test(&self) {
|
||||
let adb_arg = format!(
|
||||
"export LD_LIBRARY_PATH={}; \
|
||||
gdbserver{} :5039 {}/{}",
|
||||
self.config.adb_test_dir.clone(),
|
||||
adb_test_dir,
|
||||
if self.config.target.contains("aarch64") { "64" } else { "" },
|
||||
self.config.adb_test_dir.clone(),
|
||||
adb_test_dir,
|
||||
exe_file.file_name().unwrap()
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user