Skip to content

Commit 6fc5c4a

Browse files
committed
Separate binary and library path on android target
1 parent 60e0cf2 commit 6fc5c4a

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

mk/install.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ endef
120120
$(foreach target,$(CFG_TARGET), \
121121
$(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
122122
$(eval $(call INSTALL_RUNTIME_TARGET_N,$(taget),$(CFG_BUILD))) \
123-
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,arm-linux-$(target))) \
123+
$(eval $(call INSTALL_RUNTIME_TARGET_CLEANUP_N,$(target))) \
124124
))
125125

126126
install-runtime-target: \

mk/tests.mk

+9-8
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,14 @@ $(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)
115114
endef
116115

117116
$(foreach target,$(CFG_TARGET), \
118117
$(if $(or $(findstring $(target),"arm-linux-androideabi"),$(findstring $(target),"aarch64-linux-android")), \
119118
$(if $(findstring adb,$(CFG_ADB)), \
120119
$(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
121120
$(info check: android device attached) \
122-
$(eval $(call DEF_ADB_DEVICE_STATUS, true, $(target))), \
121+
$(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
123122
$(info check: android device not attached) \
124123
$(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
125124
), \
@@ -136,12 +135,14 @@ $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
136135
$(shell $(CFG_ADB) remount 1>/dev/null) \
137136
$(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
138137
$(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \
139-
$(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/tmp) \
140138
$(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
141-
$(foreach crate,$(TARGET_CRATES), \
142-
$(shell $(CFG_ADB) push $(TLIB2_T_$(CFG_ANDROID_TARGET_TRIPLE)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(CFG_ANDROID_TARGET_TRIPLE),$(crate)) \
143-
$(CFG_ADB_TEST_DIR))) \
144-
)
139+
$(foreach target,$(CFG_TARGET), \
140+
$(if $(or $(findstring $(target),"arm-linux-androideabi"),$(findstring $(target),"aarch64-linux-android")), \
141+
$(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/$(target)) \
142+
$(foreach crate,$(TARGET_CRATES), \
143+
$(shell $(CFG_ADB) push $(TLIB2_T_$(target)_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_$(target),$(crate)) \
144+
$(CFG_ADB_TEST_DIR)/$(target))), \
145+
)))
145146
else
146147
CFG_ADB_TEST_DIR=
147148
endif
@@ -428,7 +429,7 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
428429
$(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
429430
@$$(call E, run: $$< via adb)
430431
$$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
431-
$$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=. \
432+
$$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=./$(2) \
432433
./$$(notdir $$<) \
433434
--logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
434435
$$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \

src/compiletest/runtest.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,11 @@ fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) {
431431
Some("".to_string()))
432432
.expect(format!("failed to exec `{:?}`", config.adb_path).as_slice());
433433

434-
let adb_arg = format!("export LD_LIBRARY_PATH={}; \
434+
let adb_arg = format!("export LD_LIBRARY_PATH={}:{}/{}; \
435435
gdbserver{} :5039 {}/{}",
436436
config.adb_test_dir.clone(),
437+
config.adb_test_dir.clone(),
438+
config.target.clone(),
437439
if config.target.as_slice() == "aarch64-linux-android"
438440
{"64"} else {""},
439441
config.adb_test_dir.clone(),
@@ -1518,6 +1520,7 @@ fn _arm_exec_compiled_test(config: &Config,
15181520
}
15191521
runargs.push(format!("{}/adb_run_wrapper.sh", config.adb_test_dir));
15201522
runargs.push(format!("{}", config.adb_test_dir));
1523+
runargs.push(format!("{}", config.target));
15211524
runargs.push(format!("{}", prog_short));
15221525

15231526
for tv in args.args.iter() {
@@ -1612,7 +1615,7 @@ fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) {
16121615
file.as_str()
16131616
.unwrap()
16141617
.to_string(),
1615-
config.adb_test_dir.to_string()
1618+
config.adb_test_dir.to_string(),
16161619
],
16171620
vec!(("".to_string(),
16181621
"".to_string())),

src/etc/adb_run_wrapper.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
#
1111
# ignore-tidy-linelength
1212
#
13-
# usage : adb_run_wrapper [test dir - where test executables exist] [test executable]
13+
# usage : adb_run_wrapper [test dir - where test executables exist] [lib dir - where libraries exists] [test executable]
1414
#
1515

1616
TEST_PATH=$1
1717
BIN_PATH=/system/bin
1818
if [ -d "$TEST_PATH" ]
1919
then
20+
shift
21+
LIB_PATH=$1
2022
shift
2123
RUN=$1
2224

@@ -25,7 +27,7 @@ then
2527
shift
2628

2729
cd $TEST_PATH
28-
TEST_EXEC_ENV=22 LD_LIBRARY_PATH=$TEST_PATH PATH=$BIN_PATH:$TEST_PATH $TEST_PATH/$RUN $@ 1>$TEST_PATH/$RUN.stdout 2>$TEST_PATH/$RUN.stderr
30+
TEST_EXEC_ENV=22 LD_LIBRARY_PATH=$TEST_PATH:$LIB_PATH PATH=$BIN_PATH:$TEST_PATH $TEST_PATH/$RUN $@ 1>$TEST_PATH/$RUN.stdout 2>$TEST_PATH/$RUN.stderr
2931
L_RET=$?
3032

3133
echo $L_RET > $TEST_PATH/$RUN.exitcode

0 commit comments

Comments
 (0)