Skip to content

Commit 64c0793

Browse files
committed
---
yaml --- r: 140488 b: refs/heads/try2 c: 57c126e h: refs/heads/master v: v3
1 parent 2ab1a7d commit 64c0793

File tree

2 files changed

+109
-6
lines changed

2 files changed

+109
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: dca88701a311c7dffec1ee5e990df9570647ba03
8+
refs/heads/try2: 57c126e9bbcb4d02c40787afc46f5865874220d7
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/tests.mk

Lines changed: 108 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,48 @@ endef
9292
$(foreach target,$(CFG_TARGET_TRIPLES), \
9393
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
9494

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
95137

96138
######################################################################
97139
# Main test targets
@@ -319,11 +361,52 @@ $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
319361
&& touch $$@
320362
endef
321363

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+
322397
$(foreach host,$(CFG_HOST_TRIPLES), \
323398
$(foreach target,$(CFG_TARGET_TRIPLES), \
324399
$(foreach stage,$(STAGES), \
325400
$(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+
))))))
327410

328411

329412
######################################################################
@@ -414,15 +497,35 @@ TEST_SREQ$(1)_T_$(2)_H_$(3) = \
414497

415498
# Rules for the cfail/rfail/rpass/bench/perf test runner
416499

500+
ifeq ($(CFG_ADB_DEVICE),true)
501+
417502
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
418503
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
419504
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
420505
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
421506
--aux-base $$(S)src/test/auxiliary/ \
422507
--stage-id stage$(1)-$(2) \
508+
--host $(3) \
509+
--target $(2) \
510+
--adb-path=$(CFG_ADB_PATH) \
423511
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
424512
$$(CTEST_TESTARGS)
425513

514+
else
515+
516+
CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
517+
--compile-lib-path $$(HLIB$(1)_H_$(3)) \
518+
--run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
519+
--rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
520+
--aux-base $$(S)src/test/auxiliary/ \
521+
--stage-id stage$(1)-$(2) \
522+
--host $(3) \
523+
--target $(2) \
524+
--rustcflags "$(RUSTC_FLAGS_$(2)) $$(CFG_RUSTC_FLAGS) --target=$(2)" \
525+
$$(CTEST_TESTARGS)
526+
527+
endif
528+
426529
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
427530
CTEST_DEPS_rpass_full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(TLIBRUSTC_DEFAULT$(1)_T_$(2)_H_$(3))
428531
CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
@@ -454,7 +557,7 @@ ifeq ($$(CTEST_DISABLE_$(4)),)
454557
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
455558
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
456559
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
457-
@$$(call E, run $(4): $$<)
560+
@$$(call E, run $(4) [$(2)]: $$<)
458561
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
459562
$$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
460563
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
@@ -465,7 +568,7 @@ else
465568
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
466569
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
467570
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
468-
@$$(call E, run $(4): $$<)
571+
@$$(call E, run $(4) [$(2)]: $$<)
469572
@$$(call E, warning: tests disabled: $$(CTEST_DISABLE_$(4)))
470573
touch $$@
471574

@@ -506,7 +609,7 @@ check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4
506609
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
507610
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
508611
$$(PRETTY_DEPS_$(4))
509-
@$$(call E, run pretty-rpass: $$<)
612+
@$$(call E, run pretty-rpass [$(2)]: $$<)
510613
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
511614
$$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
512615
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
@@ -533,7 +636,7 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3)
533636
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): \
534637
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
535638
doc-$(4)-extract$(3)
536-
@$$(call E, run doc-$(4): $$<)
639+
@$$(call E, run doc-$(4) [$(2)]: $$<)
537640
$$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
538641
$$(DOC_TEST_ARGS$(1)-T-$(2)-H-$(3)-doc-$(4)) \
539642
--logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),doc-$(4)) \

0 commit comments

Comments
 (0)