92
92
$(foreach target,$(CFG_TARGET_TRIPLES), \
93
93
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
94
94
95
+ # Target platform specific variables
96
+ # for arm-linux-androidabi
97
+ define DEF_ADB_DEVICE_STATUS
98
+ CFG_ADB_DEVICE_STATUS=$(1 )
99
+ endef
100
+
101
+ $(foreach target,$(CFG_TARGET_TRIPLES), \
102
+ $(if $(findstring $(target),"arm-linux-androideabi"), \
103
+ $(if $(findstring adb,$(CFG_ADB)), \
104
+ $(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[_A-Za-z0-9-]+[[ :blank:]]+device')), \
105
+ $(info check : $(target ) test enabled \
106
+ $(info check : android device attached) \
107
+ $(eval $(call DEF_ADB_DEVICE_STATUS, true))), \
108
+ $(info check : $(target ) test disabled \
109
+ $(info check : android device not attached) \
110
+ $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
111
+ ), \
112
+ $(info check : $(target ) test disabled \
113
+ $(info check : adb not found) \
114
+ $(eval $(call DEF_ADB_DEVICE_STATUS, false))) \
115
+ ), \
116
+ ) \
117
+ )
118
+
119
+ ifeq ($(CFG_ADB_DEVICE_STATUS ) ,true)
120
+ CFG_ADB_TEST_DIR =/data/tmp
121
+
122
+ $(info check : android device test dir $(CFG_ADB_TEST_DIR ) ready \
123
+ $(shell adb remount 1>/dev/null) \
124
+ $(shell adb shell mkdir $(CFG_ADB_TEST_DIR) 1>/dev/null) \
125
+ $(shell adb push $(CFG_ANDROID_CROSS_PATH)/arm-linux-androideabi/lib/armv7-a/libgnustl_shared.so \
126
+ $(CFG_ADB_TEST_DIR) 1>/dev/null) \
127
+ )
128
+ else
129
+ CFG_ADB_TEST_DIR =
130
+ endif
131
+
95
132
96
133
# #####################################################################
97
134
# Main test targets
@@ -319,11 +356,53 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
319
356
&& touch $$@
320
357
endef
321
358
359
+ define DEF_TEST_CRATE_RULES_arm-linux-androideabi
360
+ check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) -exec: $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) )
361
+
362
+ $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
363
+ $(3 ) /test/$(4 ) test.stage$(1 ) -$(2 )$$(X_$(2 ) )
364
+ @$$(call E, run: $$< via adb)
365
+ @$(CFG_ADB ) push $$< $(CFG_ADB_TEST_DIR )
366
+ @$(CFG_ADB ) shell LD_LIBRARY_PATH=$(CFG_ADB_TEST_DIR ) \
367
+ $(CFG_ADB_TEST_DIR ) /`echo $$< | sed 's/.*\///'` \
368
+ --logfile $(CFG_ADB_TEST_DIR ) /check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .log > \
369
+ tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp
370
+ @cat tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp
371
+ @touch tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .log
372
+ @$(CFG_ADB ) pull $(CFG_ADB_TEST_DIR ) /check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .log tmp/
373
+ @$(CFG_ADB ) shell rm $(CFG_ADB_TEST_DIR ) /check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .log
374
+ @if grep -q "result: ok" tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp; \
375
+ then \
376
+ rm tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp; \
377
+ touch $$@ ; \
378
+ else \
379
+ rm tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp; \
380
+ exit 101; \
381
+ fi
382
+ endef
383
+
384
+ define DEF_TEST_CRATE_RULES_null
385
+ check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) -exec: $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) )
386
+
387
+ $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
388
+ $(3 ) /test/$(4 ) test.stage$(1 ) -$(2 )$$(X_$(2 ) )
389
+ @$$(call E, run: skipped $$< )
390
+ @touch $$@
391
+ endef
392
+
322
393
$(foreach host,$(CFG_HOST_TRIPLES), \
323
394
$(foreach target,$(CFG_TARGET_TRIPLES), \
324
395
$(foreach stage,$(STAGES), \
325
396
$(foreach crate, $(TEST_CRATES), \
326
- $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate)))))))
397
+ $(if $(findstring $(target),$(CFG_BUILD_TRIPLE)), \
398
+ $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
399
+ $(if $(findstring $(target),"arm-linux-androideabi"), \
400
+ $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
401
+ $(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \
402
+ $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
403
+ ), \
404
+ $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
405
+ ))))))
327
406
328
407
329
408
# #####################################################################
@@ -420,6 +499,9 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
420
499
--rustc-path $$(HBIN$(1 ) _H_$(3 ) ) /rustc$$(X_$(3 ) ) \
421
500
--aux-base $$(S ) src/test/auxiliary/ \
422
501
--stage-id stage$(1 ) -$(2 ) \
502
+ --target $(2 ) \
503
+ --adb-path=$(CFG_ADB ) \
504
+ --adb-test-dir=$(CFG_ADB_TEST_DIR ) \
423
505
--rustcflags "$(RUSTC_FLAGS_$(2 ) ) $$(CFG_RUSTC_FLAGS ) --target=$(2 ) " \
424
506
$$(CTEST_TESTARGS )
425
507
@@ -454,7 +536,7 @@ ifeq ($$(CTEST_DISABLE_$(4)),)
454
536
$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
455
537
$$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
456
538
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
457
- @$$(call E, run $(4): $$<)
539
+ @$$(call E, run $(4) [$(2)] : $$<)
458
540
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
459
541
$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
460
542
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
465
547
$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
466
548
$$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
467
549
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
468
- @$$(call E, run $(4): $$<)
550
+ @$$(call E, run $(4) [$(2)] : $$<)
469
551
@$$(call E, warning: tests disabled: $$(CTEST_DISABLE_$(4)))
470
552
touch $$@
471
553
@@ -506,7 +588,7 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4
506
588
$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
507
589
$$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
508
590
$$(PRETTY_DEPS_$(4 ) )
509
- @$$(call E, run pretty-rpass: $$< )
591
+ @$$(call E, run pretty-rpass [ $( 2 ) ] : $$< )
510
592
$$(Q )$$(call CFG_RUN_CTEST_$(2 ) ,$(1 ) ,$$< ,$(3 ) ) \
511
593
$$(PRETTY_ARGS$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) ) \
512
594
--logfile $$(call TEST_LOG_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) \
@@ -533,7 +615,7 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3)
533
615
$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,doc-$(4 ) ) : \
534
616
$$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
535
617
doc-$(4 ) -extract$(3 )
536
- @$$(call E, run doc-$(4 ) : $$< )
618
+ @$$(call E, run doc-$(4 ) [ $( 2 ) ] : $$< )
537
619
$$(Q )$$(call CFG_RUN_CTEST_$(2 ) ,$(1 ) ,$$< ,$(3 ) ) \
538
620
$$(DOC_TEST_ARGS$(1 ) -T-$(2 ) -H-$(3 ) -doc-$(4 ) ) \
539
621
--logfile $$(call TEST_LOG_FILE,$(1 ) ,$(2 ) ,$(3 ) ,doc-$(4 ) ) \
0 commit comments