92
92
$(foreach target,$(CFG_TARGET_TRIPLES), \
93
93
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
94
94
95
+ # Target specific variables
96
+ # for arm-linux-androidabi
97
+ define DEF_RUNNABLE_STATUS
98
+ CFG_RUNNABLE_$(1 ) =$(2 )
99
+ endef
100
+
101
+ $(foreach target,$(CFG_TARGET_TRIPLES), \
102
+ $(if $(findstring $(target),$(CFG_BUILD_TRIPLE)), \
103
+ $(info check : $(target ) test set is runnable \
104
+ $(eval $(call DEF_RUNNABLE_STATUS,$(target),true))), \
105
+ $(if $(findstring $(target),"arm-linux-androideabi"), \
106
+ $(if $(findstring adb,$(shell which adb)), \
107
+ $(if $(findstring device,$(shell adb devices 2>/dev/null | grep -E '^[A-Za-z0-9]+[[ :blank:]]+device')), \
108
+ $(info check : $(target ) test set is runnable \
109
+ $(info check : adb device attached) \
110
+ $(eval $(call DEF_RUNNABLE_STATUS,$(target),true))), \
111
+ $(info check : $(target ) test set is not runnable \
112
+ $(info check : adb device not attached) \
113
+ $(eval $(call DEF_RUNNABLE_STATUS,$(target),false))) \
114
+ ), \
115
+ $(info check : $(target ) test set is not runnable \
116
+ $(info check : adb not found) \
117
+ $(eval $(call DEF_RUNNABLE_STATUS,$(target),false))) \
118
+ ), \
119
+ $(info check : $(target ) test set is not runnable \
120
+ $(eval $(call DEF_RUNNABLE_STATUS,$(target),false)) \
121
+ ) \
122
+ ) \
123
+ ) \
124
+ )
125
+
126
+ ifeq ($(CFG_RUNNABLE_arm-linux-androideabi ) ,true)
127
+ CFG_ADB_DEVICE =true
128
+ CFG_ADB_PATH := $(shell which adb)
129
+ CFG_ADB_TEST_DIR =/system/tmp
130
+
131
+ $(info check : device $(CFG_ADB_TEST_DIR ) \
132
+ $(shell $(CFG_ADB_PATH) shell mkdir $(CFG_ADB_TEST_DIR) 1>/dev/null) \
133
+ $(shell $(CFG_ADB_PATH) shell rm $(CFG_ADB_TEST_DIR)/*-arm-linux-androideabi 1>/dev/null) \
134
+ $(shell $(CFG_ADB_PATH) shell rm $(CFG_ADB_TEST_DIR)/*.so 1>/dev/null) \
135
+ )
136
+ endif
95
137
96
138
# #####################################################################
97
139
# Main test targets
@@ -319,11 +361,52 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
319
361
&& touch $$@
320
362
endef
321
363
364
+ define DEF_TEST_CRATE_RULES_arm-linux-androideabi
365
+ check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) -exec: $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) )
366
+
367
+ $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
368
+ $(3 ) /test/$(4 ) test.stage$(1 ) -$(2 )$$(X_$(2 ) )
369
+ @$$(call E, run: $$< via adb)
370
+ @$(CFG_ADB_PATH ) push $$< $(CFG_ADB_TEST_DIR )
371
+ @$(CFG_ADB_PATH ) shell $(CFG_ADB_TEST_DIR ) /`echo $$< | sed 's/.*\///'` \
372
+ --logfile $(CFG_ADB_TEST_DIR ) /check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .log > \
373
+ tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp
374
+ @cat tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp
375
+ @touch tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .log
376
+ @$(CFG_ADB_PATH ) pull $(CFG_ADB_TEST_DIR ) /check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .log tmp/
377
+ @$(CFG_ADB_PATH ) shell rm $(CFG_ADB_TEST_DIR ) /check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .log
378
+ @if grep -q "result: ok" tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp; \
379
+ then \
380
+ rm tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp; \
381
+ touch $$@ ; \
382
+ else \
383
+ rm tmp/check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) .tmp; \
384
+ exit 101; \
385
+ fi
386
+ endef
387
+
388
+ define DEF_TEST_CRATE_RULES_null
389
+ check-stage$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) -exec: $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) )
390
+
391
+ $$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
392
+ $(3 ) /test/$(4 ) test.stage$(1 ) -$(2 )$$(X_$(2 ) )
393
+ @$$(call E, run: skipped $$< )
394
+ @touch $$@
395
+ endef
396
+
322
397
$(foreach host,$(CFG_HOST_TRIPLES), \
323
398
$(foreach target,$(CFG_TARGET_TRIPLES), \
324
399
$(foreach stage,$(STAGES), \
325
400
$(foreach crate, $(TEST_CRATES), \
326
- $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate)))))))
401
+ $(if $(findstring $(target),$(CFG_BUILD_TRIPLE)), \
402
+ $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
403
+ $(if $(findstring $(target),"arm-linux-androideabi"), \
404
+ $(if $(findstring $(CFG_RUNNABLE_arm-linux-androideabi),"true"), \
405
+ $(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \
406
+ $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
407
+ ), \
408
+ $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
409
+ ))))))
327
410
328
411
329
412
# #####################################################################
@@ -414,15 +497,36 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
414
497
415
498
# Rules for the cfail/rfail/rpass/bench/perf test runner
416
499
500
+ ifeq ($(CFG_ADB_DEVICE ) ,true)
501
+
502
+ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
503
+ --compile-lib-path $$(HLIB$(1 ) _H_$(3 ) ) \
504
+ --run-lib-path $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) \
505
+ --rustc-path $$(HBIN$(1 ) _H_$(3 ) ) /rustc$$(X_$(3 ) ) \
506
+ --aux-base $$(S ) src/test/auxiliary/ \
507
+ --stage-id stage$(1 ) -$(2 ) \
508
+ --host $(CFG_BUILD_TRIPLE ) \
509
+ --target $(2 ) \
510
+ --adb-path=$(CFG_ADB_PATH ) \
511
+ --adb-test-dir=$(CFG_ADB_TEST_DIR ) \
512
+ --rustcflags "$(RUSTC_FLAGS_$(2 ) ) $$(CFG_RUSTC_FLAGS ) --target=$(2 ) " \
513
+ $$(CTEST_TESTARGS )
514
+
515
+ else
516
+
417
517
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
418
518
--compile-lib-path $$(HLIB$(1 ) _H_$(3 ) ) \
419
519
--run-lib-path $$(TLIB$(1 ) _T_$(2 ) _H_$(3 ) ) \
420
- --rustc-path $$(HBIN$(1 ) _H_$(3 ) ) /rustc$$(X_$(3 ) ) \
520
+ --rustc-path $$(HBIN$(1 ) _H_$(3 ) ) /rustc$$(X_$(3 ) ) \
421
521
--aux-base $$(S ) src/test/auxiliary/ \
422
522
--stage-id stage$(1 ) -$(2 ) \
523
+ --host $(CFG_BUILD_TRIPLE ) \
524
+ --target $(2 ) \
423
525
--rustcflags "$(RUSTC_FLAGS_$(2 ) ) $$(CFG_RUSTC_FLAGS ) --target=$(2 ) " \
424
526
$$(CTEST_TESTARGS )
425
527
528
+ endif
529
+
426
530
CTEST_DEPS_rpass_$(1 ) -T-$(2 ) -H-$(3 ) = $$(RPASS_TESTS )
427
531
CTEST_DEPS_rpass_full_$(1 ) -T-$(2 ) -H-$(3 ) = $$(RPASS_FULL_TESTS ) $$(TLIBRUSTC_DEFAULT$(1 ) _T_$(2 ) _H_$(3 ) )
428
532
CTEST_DEPS_rfail_$(1 ) -T-$(2 ) -H-$(3 ) = $$(RFAIL_TESTS )
@@ -454,7 +558,7 @@ ifeq ($$(CTEST_DISABLE_$(4)),)
454
558
$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
455
559
$$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
456
560
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
457
- @$$(call E, run $(4): $$<)
561
+ @$$(call E, run $(4) [$(2)] : $$<)
458
562
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
459
563
$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
460
564
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
465
569
$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
466
570
$$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
467
571
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
468
- @$$(call E, run $(4): $$<)
572
+ @$$(call E, run $(4) [$(2)] : $$<)
469
573
@$$(call E, warning: tests disabled: $$(CTEST_DISABLE_$(4)))
470
574
touch $$@
471
575
@@ -506,7 +610,7 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4
506
610
$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) : \
507
611
$$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
508
612
$$(PRETTY_DEPS_$(4 ) )
509
- @$$(call E, run pretty-rpass: $$< )
613
+ @$$(call E, run pretty-rpass [ $( 2 ) ] : $$< )
510
614
$$(Q )$$(call CFG_RUN_CTEST_$(2 ) ,$(1 ) ,$$< ,$(3 ) ) \
511
615
$$(PRETTY_ARGS$(1 ) -T-$(2 ) -H-$(3 ) -$(4 ) ) \
512
616
--logfile $$(call TEST_LOG_FILE,$(1 ) ,$(2 ) ,$(3 ) ,$(4 ) ) \
@@ -533,7 +637,7 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3)
533
637
$$(call TEST_OK_FILE,$(1 ) ,$(2 ) ,$(3 ) ,doc-$(4 ) ) : \
534
638
$$(TEST_SREQ$(1 ) _T_$(2 ) _H_$(3 ) ) \
535
639
doc-$(4 ) -extract$(3 )
536
- @$$(call E, run doc-$(4 ) : $$< )
640
+ @$$(call E, run doc-$(4 ) [ $( 2 ) ] : $$< )
537
641
$$(Q )$$(call CFG_RUN_CTEST_$(2 ) ,$(1 ) ,$$< ,$(3 ) ) \
538
642
$$(DOC_TEST_ARGS$(1 ) -T-$(2 ) -H-$(3 ) -doc-$(4 ) ) \
539
643
--logfile $$(call TEST_LOG_FILE,$(1 ) ,$(2 ) ,$(3 ) ,doc-$(4 ) ) \
0 commit comments