Skip to content

Commit 5cbdf1d

Browse files
committed
Make aarch64-linux-android check with real target
1 parent 134e00b commit 5cbdf1d

File tree

5 files changed

+29
-26
lines changed

5 files changed

+29
-26
lines changed

mk/install.mk

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ CFG_ADB_DEVICE_STATUS=$(1)
6565
endef
6666

6767
$(foreach target,$(CFG_TARGET), \
68-
$(if $(findstring $(target),"arm-linux-androideabi"), \
68+
$(if $(or $(findstring $(target),"arm-linux-androideabi"),$(findstring $(target),"aarch64-linux-android")), \
6969
$(if $(findstring adb,$(CFG_ADB)), \
7070
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[:blank:]]+device')), \
7171
$(info install: install-runtime-target for $(target) enabled \
@@ -117,8 +117,11 @@ install-runtime-target-$(1)-cleanup:
117117
$$(call ADB_SHELL,rm,$$(CFG_RUNTIME_PUSH_DIR)/$$(call CFG_LIB_GLOB_$(1),$$(crate)));)
118118
endef
119119

120-
$(eval $(call INSTALL_RUNTIME_TARGET_N,arm-linux-androideabi,$(CFG_BUILD)))
121-
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-androideabi))
120+
$(foreach target,$(CFG_TARGET), \
121+
$(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
122+
$(eval $(call INSTALL_RUNTIME_TARGET_N,$(taget),$(CFG_BUILD))) \
123+
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-$(target))) \
124+
))
122125

123126
install-runtime-target: \
124127
install-runtime-target-arm-linux-androideabi-cleanup \

mk/tests.mk

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,15 @@ $(foreach target,$(CFG_TARGET), \
111111
# for arm-linux-androidabi
112112
define DEF_ADB_DEVICE_STATUS
113113
CFG_ADB_DEVICE_STATUS=$(1)
114+
CFG_ANDROID_TARGET_TRIPLE=$(2)
114115
endef
115116

116117
$(foreach target,$(CFG_TARGET), \
117-
$(if $(findstring $(target),"arm-linux-androideabi"), \
118+
$(if $(or $(findstring $(target),"arm-linux-androideabi"),$(findstring $(target),"aarch64-linux-android")), \
118119
$(if $(findstring adb,$(CFG_ADB)), \
119120
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
120121
$(info check: android device attached) \
121-
$(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
122+
$(eval $(call DEF_ADB_DEVICE_STATUS, true, $(target))), \
122123
$(info check: android device not attached) \
123124
$(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
124125
), \
@@ -138,7 +139,7 @@ $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
138139
$(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/tmp) \
139140
$(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
140141
$(foreach crate,$(TARGET_CRATES), \
141-
$(shell $(CFG_ADB) push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_arm-linux-androideabi,$(crate)) \
142+
$(shell $(CFG_ADB) push $(TLIB2_T_$(CFG_ANDROID_TARGET_TRIPLE)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(CFG_ANDROID_TARGET_TRIPLE),$(crate)) \
142143
$(CFG_ADB_TEST_DIR))) \
143144
)
144145
else
@@ -393,7 +394,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
393394
&& touch $$@
394395
endef
395396

396-
define DEF_TEST_CRATE_RULES_arm-linux-androideabi
397+
define DEF_TEST_CRATE_RULES_android
397398
check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
398399

399400
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
@@ -434,9 +435,9 @@ $(foreach host,$(CFG_HOST), \
434435
$(foreach crate, $(TEST_CRATES), \
435436
$(if $(findstring $(target),$(CFG_BUILD)), \
436437
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
437-
$(if $(findstring $(target),"arm-linux-androideabi"), \
438+
$(if $(or $(findstring $(target),"arm-linux-androideabi"), $(findstring $(target),"aarch64-linux-android")), \
438439
$(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
439-
$(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \
440+
$(eval $(call DEF_TEST_CRATE_RULES_android,$(stage),$(target),$(host),$(crate))), \
440441
$(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
441442
), \
442443
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \

src/compiletest/compiletest.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,8 @@ pub fn parse_config(args: Vec<String> ) -> Config {
158158
adb_path: opt_str2(matches.opt_str("adb-path")),
159159
adb_test_dir: opt_str2(matches.opt_str("adb-test-dir")),
160160
adb_device_status:
161-
"arm-linux-androideabi" ==
162-
opt_str2(matches.opt_str("target")) &&
163-
"(none)" !=
164-
opt_str2(matches.opt_str("adb-test-dir")) &&
161+
opt_str2(matches.opt_str("target")).contains("android") &&
162+
"(none)" != opt_str2(matches.opt_str("adb-test-dir")) &&
165163
!opt_str2(matches.opt_str("adb-test-dir")).is_empty(),
166164
lldb_python_dir: matches.opt_str("lldb-python-dir"),
167165
verbose: matches.opt_present("verbose"),
@@ -216,17 +214,17 @@ pub fn opt_str2(maybestr: Option<String>) -> String {
216214
}
217215

218216
pub fn run_tests(config: &Config) {
219-
if config.target == "arm-linux-androideabi" {
217+
if config.target.contains("android") {
220218
match config.mode {
221219
DebugInfoGdb => {
222-
println!("arm-linux-androideabi debug-info \
223-
test uses tcp 5039 port. please reserve it");
220+
println!("{} debug-info test uses tcp 5039 port.\
221+
please reserve it", config.target);
224222
}
225223
_ =>{}
226224
}
227225

228-
//arm-linux-androideabi debug-info test uses remote debugger
229-
//so, we test 1 task at once.
226+
// android debug-info test uses remote debugger
227+
// so, we test 1 task at once.
230228
// also trying to isolate problems with adb_run_wrapper.sh ilooping
231229
env::set_var("RUST_TEST_TASKS","1");
232230
}

src/compiletest/runtest.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use test::MetricMap;
4242
pub fn run(config: Config, testfile: String) {
4343
match &*config.target {
4444

45-
"arm-linux-androideabi" => {
45+
"arm-linux-androideabi" | "aarch64-linux-android" => {
4646
if !config.adb_device_status {
4747
panic!("android device not available");
4848
}
@@ -382,7 +382,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
382382

383383
let debugger_run_result;
384384
match &*config.target {
385-
"arm-linux-androideabi" => {
385+
"arm-linux-androideabi" | "aarch64-linux-android" => {
386386

387387
cmds = cmds.replace("run", "continue").to_string();
388388

@@ -470,7 +470,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
470470
format!("-command={}", debugger_script.as_str().unwrap()));
471471

472472
let mut gdb_path = tool_path;
473-
gdb_path.push_str("/bin/arm-linux-androideabi-gdb");
473+
gdb_path.push_str(&format!("/bin/{}-gdb", config.target));
474474
let procsrv::Result {
475475
out,
476476
err,
@@ -484,7 +484,7 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
484484
.expect(&format!("failed to exec `{:?}`", gdb_path));
485485
let cmdline = {
486486
let cmdline = make_cmdline("",
487-
"arm-linux-androideabi-gdb",
487+
&format!("{}-gdb", config.target),
488488
&debugger_opts);
489489
logv(config, format!("executing {}", cmdline));
490490
cmdline
@@ -1135,7 +1135,7 @@ fn exec_compiled_test(config: &Config, props: &TestProps,
11351135

11361136
match &*config.target {
11371137

1138-
"arm-linux-androideabi" => {
1138+
"arm-linux-androideabi" | "aarch64-linux-android" => {
11391139
_arm_exec_compiled_test(config, props, testfile, env)
11401140
}
11411141

@@ -1200,7 +1200,7 @@ fn compose_and_run_compiler(
12001200
}
12011201

12021202
match &*config.target {
1203-
"arm-linux-androideabi" => {
1203+
"arm-linux-androideabi" | "aarch64-linux-android" => {
12041204
_arm_push_aux_shared_library(config, testfile);
12051205
}
12061206
_ => {}

src/librustc_back/target/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,13 @@ impl Target {
345345
mips_unknown_linux_gnu,
346346
mipsel_unknown_linux_gnu,
347347
powerpc_unknown_linux_gnu,
348-
arm_linux_androideabi,
349348
arm_unknown_linux_gnueabi,
350349
arm_unknown_linux_gnueabihf,
351350
aarch64_unknown_linux_gnu,
352351

352+
arm_linux_androideabi,
353+
aarch64_linux_android,
354+
353355
x86_64_unknown_freebsd,
354356

355357
i686_unknown_dragonfly,
@@ -363,7 +365,6 @@ impl Target {
363365
i386_apple_ios,
364366
x86_64_apple_ios,
365367
aarch64_apple_ios,
366-
aarch64_linux_android,
367368
armv7_apple_ios,
368369
armv7s_apple_ios,
369370

0 commit comments

Comments
 (0)