File tree Expand file tree Collapse file tree 3 files changed +13
-11
lines changed
src/tools/compiletest/src Expand file tree Collapse file tree 3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -575,7 +575,7 @@ pub struct Config {
575575 ///
576576 /// FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for
577577 /// `arm-linux-androideabi` target.
578- pub adb_path : Utf8PathBuf ,
578+ pub adb_path : Option < Utf8PathBuf > ,
579579
580580 /// Extra parameter to run test suite on `arm-linux-androideabi`.
581581 ///
@@ -584,7 +584,7 @@ pub struct Config {
584584 ///
585585 /// FIXME: take a look at this; this is piggy-backing off of gdb code paths but only for
586586 /// `arm-linux-androideabi` target.
587- pub adb_test_dir : Utf8PathBuf ,
587+ pub adb_test_dir : Option < Utf8PathBuf > ,
588588
589589 /// Status whether android device available or not. When unavailable, this will cause tests to
590590 /// panic when the test binary is attempted to be run.
Original file line number Diff line number Diff line change @@ -260,11 +260,9 @@ fn parse_config(args: Vec<String>) -> Config {
260260
261261 let android_cross_path = matches. opt_str ( "android-cross-path" ) . map ( Utf8PathBuf :: from) ;
262262
263- // FIXME: `adb_path` should be an `Option<Utf8PathBuf>`...
264- let adb_path = matches. opt_str ( "adb-path" ) . map ( Utf8PathBuf :: from) . unwrap_or_default ( ) ;
265- // FIXME: `adb_test_dir` should be an `Option<Utf8PathBuf>`...
266- let adb_test_dir = matches. opt_str ( "adb-test-dir" ) . map ( Utf8PathBuf :: from) . unwrap_or_default ( ) ;
267- let adb_device_status = target. contains ( "android" ) && !adb_test_dir. as_str ( ) . is_empty ( ) ;
263+ let adb_path = matches. opt_str ( "adb-path" ) . map ( Utf8PathBuf :: from) ;
264+ let adb_test_dir = matches. opt_str ( "adb-test-dir" ) . map ( Utf8PathBuf :: from) ;
265+ let adb_device_status = target. contains ( "android" ) && adb_test_dir. is_some ( ) ;
268266
269267 // FIXME: `cdb_version` is *derived* from cdb, but it's *not* technically a config!
270268 let cdb = debuggers:: discover_cdb ( matches. opt_str ( "cdb" ) , & target) ;
Original file line number Diff line number Diff line change @@ -150,12 +150,16 @@ impl TestCx<'_> {
150150 debug ! ( "script_str = {}" , script_str) ;
151151 self . dump_output_file ( & script_str, "debugger.script" ) ;
152152
153- let adb_path = & self . config . adb_path ;
153+ // Note: when `--android-cross-path` is specified, we expect both `adb_path` and
154+ // `adb_test_dir` to be available.
155+ let adb_path = self . config . adb_path . as_ref ( ) . expect ( "`adb_path` must be specified" ) ;
156+ let adb_test_dir =
157+ self . config . adb_test_dir . as_ref ( ) . expect ( "`adb_test_dir` must be specified" ) ;
154158
155159 Command :: new ( adb_path)
156160 . arg ( "push" )
157161 . arg ( & exe_file)
158- . arg ( & self . config . adb_test_dir )
162+ . arg ( adb_test_dir)
159163 . status ( )
160164 . unwrap_or_else ( |e| panic ! ( "failed to exec `{adb_path:?}`: {e:?}" ) ) ;
161165
@@ -167,9 +171,9 @@ impl TestCx<'_> {
167171 let adb_arg = format ! (
168172 "export LD_LIBRARY_PATH={}; \
169173 gdbserver{} :5039 {}/{}",
170- self . config . adb_test_dir. clone ( ) ,
174+ adb_test_dir,
171175 if self . config. target. contains( "aarch64" ) { "64" } else { "" } ,
172- self . config . adb_test_dir. clone ( ) ,
176+ adb_test_dir,
173177 exe_file. file_name( ) . unwrap( )
174178 ) ;
175179
You can’t perform that action at this time.
0 commit comments