Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
///
Expand All @@ -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.
Expand Down
8 changes: 3 additions & 5 deletions src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,9 @@ fn parse_config(args: Vec<String>) -> Config {

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);
Expand Down
12 changes: 8 additions & 4 deletions src/tools/compiletest/src/runtest/debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,16 @@ impl TestCx<'_> {
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:?}"));

Expand All @@ -167,9 +171,9 @@ impl TestCx<'_> {
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()
);

Expand Down
Loading