PageRenderTime 549ms CodeModel.GetById 23ms RepoModel.GetById 3ms app.codeStats 1ms

/mk/tests.mk

https://github.com/dardevelin/rust
Makefile | 928 lines | 658 code | 166 blank | 104 comment | 7 complexity | 56b3767cbb5f29083a6992d704598421 MD5 | raw file
Possible License(s): JSON, Apache-2.0, MIT
  1. # Copyright 2012 The Rust Project Developers. See the COPYRIGHT
  2. # file at the top-level directory of this distribution and at
  3. # http://rust-lang.org/COPYRIGHT.
  4. #
  5. # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
  6. # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
  7. # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
  8. # option. This file may not be copied, modified, or distributed
  9. # except according to those terms.
  10. ######################################################################
  11. # Test variables
  12. ######################################################################
  13. # The names of crates that must be tested
  14. TEST_TARGET_CRATES = $(TARGET_CRATES)
  15. TEST_DOC_CRATES = $(DOC_CRATES)
  16. TEST_HOST_CRATES = $(HOST_CRATES)
  17. TEST_CRATES = $(TEST_TARGET_CRATES) $(TEST_HOST_CRATES)
  18. ######################################################################
  19. # Environment configuration
  20. ######################################################################
  21. # The arguments to all test runners
  22. ifdef TESTNAME
  23. TESTARGS += $(TESTNAME)
  24. endif
  25. ifdef CHECK_IGNORED
  26. TESTARGS += --ignored
  27. endif
  28. TEST_BENCH = --bench
  29. # Arguments to the cfail/rfail/rpass/bench tests
  30. ifdef CFG_VALGRIND
  31. CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
  32. TEST_BENCH =
  33. endif
  34. ifdef NO_BENCH
  35. TEST_BENCH =
  36. endif
  37. # Arguments to the perf tests
  38. ifdef CFG_PERF_TOOL
  39. CTEST_PERF_RUNTOOL = --runtool "$(CFG_PERF_TOOL)"
  40. endif
  41. CTEST_TESTARGS := $(TESTARGS)
  42. ifdef VERBOSE
  43. CTEST_TESTARGS += --verbose
  44. endif
  45. # If we're running perf then set this environment variable
  46. # to put the benchmarks into 'hard mode'
  47. ifeq ($(MAKECMDGOALS),perf)
  48. RUST_BENCH=1
  49. export RUST_BENCH
  50. endif
  51. TEST_LOG_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
  52. TEST_OK_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).ok
  53. TEST_RATCHET_FILE=tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4)-metrics.json
  54. TEST_RATCHET_NOISE_PERCENT=10.0
  55. # Whether to ratchet or merely save benchmarks
  56. ifdef CFG_RATCHET_BENCH
  57. CRATE_TEST_EXTRA_ARGS=\
  58. --test $(TEST_BENCH) \
  59. --ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
  60. --ratchet-noise-percent $(TEST_RATCHET_NOISE_PERCENT)
  61. else
  62. CRATE_TEST_EXTRA_ARGS=\
  63. --test $(TEST_BENCH) \
  64. --save-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4))
  65. endif
  66. # If we're sharding the testsuite between parallel testers,
  67. # pass this argument along to the compiletest and crate test
  68. # invocations.
  69. ifdef TEST_SHARD
  70. CTEST_TESTARGS += --test-shard=$(TEST_SHARD)
  71. CRATE_TEST_EXTRA_ARGS += --test-shard=$(TEST_SHARD)
  72. endif
  73. define DEF_TARGET_COMMANDS
  74. ifdef CFG_UNIXY_$(1)
  75. CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),,$$(CFG_VALGRIND) $$(1))
  76. endif
  77. ifdef CFG_WINDOWSY_$(1)
  78. CFG_TESTLIB_$(1)=$$(CFG_BUILD_DIR)$$(2)/$$(strip \
  79. $$(if $$(findstring stage0,$$(1)), \
  80. stage0/$$(CFG_LIBDIR_RELATIVE), \
  81. $$(if $$(findstring stage1,$$(1)), \
  82. stage1/$$(CFG_LIBDIR_RELATIVE), \
  83. $$(if $$(findstring stage2,$$(1)), \
  84. stage2/$$(CFG_LIBDIR_RELATIVE), \
  85. $$(if $$(findstring stage3,$$(1)), \
  86. stage3/$$(CFG_LIBDIR_RELATIVE), \
  87. )))))/rustlib/$$(CFG_BUILD)/lib
  88. CFG_RUN_TEST_$(1)=$$(call CFG_RUN_$(1),$$(call CFG_TESTLIB_$(1),$$(1),$$(3)),$$(1))
  89. endif
  90. # Run the compiletest runner itself under valgrind
  91. ifdef CTEST_VALGRIND
  92. CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
  93. $$(call CFG_RUN_TEST_$$(CFG_BUILD),$$(2),$$(3))
  94. else
  95. CFG_RUN_CTEST_$(1)=$$(RPATH_VAR$$(1)_T_$$(3)_H_$$(3)) \
  96. $$(call CFG_RUN_$$(CFG_BUILD),$$(TLIB$$(1)_T_$$(3)_H_$$(3)),$$(2))
  97. endif
  98. endef
  99. $(foreach target,$(CFG_TARGET), \
  100. $(eval $(call DEF_TARGET_COMMANDS,$(target))))
  101. # Target platform specific variables
  102. # for arm-linux-androidabi
  103. define DEF_ADB_DEVICE_STATUS
  104. CFG_ADB_DEVICE_STATUS=$(1)
  105. endef
  106. $(foreach target,$(CFG_TARGET), \
  107. $(if $(findstring $(target),"arm-linux-androideabi"), \
  108. $(if $(findstring adb,$(CFG_ADB)), \
  109. $(if $(findstring device,$(shell $(CFG_ADB) devices 2>/dev/null | grep -E '^[:_A-Za-z0-9-]+[[:blank:]]+device')), \
  110. $(info check: android device attached) \
  111. $(eval $(call DEF_ADB_DEVICE_STATUS, true)), \
  112. $(info check: android device not attached) \
  113. $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
  114. ), \
  115. $(info check: adb not found) \
  116. $(eval $(call DEF_ADB_DEVICE_STATUS, false)) \
  117. ), \
  118. ) \
  119. )
  120. ifeq ($(CFG_ADB_DEVICE_STATUS),true)
  121. CFG_ADB_TEST_DIR=/data/tmp
  122. $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
  123. $(shell $(CFG_ADB) remount 1>/dev/null) \
  124. $(shell $(CFG_ADB) shell rm -r $(CFG_ADB_TEST_DIR) >/dev/null) \
  125. $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)) \
  126. $(shell $(CFG_ADB) shell mkdir $(CFG_ADB_TEST_DIR)/tmp) \
  127. $(shell $(CFG_ADB) push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
  128. $(foreach crate,$(TARGET_CRATES),\
  129. $(shell $(CFG_ADB) push $(TLIB2_T_arm-linux-androideabi_H_$(CFG_BUILD))/$(call CFG_LIB_GLOB_arm-linux-androideabi,$(crate)) \
  130. $(CFG_ADB_TEST_DIR)))\
  131. )
  132. else
  133. CFG_ADB_TEST_DIR=
  134. endif
  135. ######################################################################
  136. # Main test targets
  137. ######################################################################
  138. check: cleantmptestlogs cleantestlibs tidy check-notidy
  139. check-notidy: cleantmptestlogs cleantestlibs all check-stage2
  140. $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
  141. check-lite: cleantestlibs cleantmptestlogs \
  142. $(foreach crate,$(TARGET_CRATES),check-stage2-$(crate)) \
  143. check-stage2-rpass \
  144. check-stage2-rfail check-stage2-cfail check-stage2-rmake
  145. $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
  146. check-ref: cleantestlibs cleantmptestlogs check-stage2-rpass \
  147. check-stage2-rfail check-stage2-cfail check-stage2-rmake
  148. $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
  149. check-docs: cleantestlibs cleantmptestlogs check-stage2-docs
  150. $(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
  151. # NOTE: Remove after reprogramming windows bots
  152. check-fast: check-lite
  153. .PHONY: cleantmptestlogs cleantestlibs
  154. cleantmptestlogs:
  155. $(Q)rm -f tmp/*.log
  156. cleantestlibs:
  157. $(Q)find $(CFG_BUILD)/test \
  158. -name '*.[odasS]' -o \
  159. -name '*.so' -o \
  160. -name '*.dylib' -o \
  161. -name '*.dll' -o \
  162. -name '*.def' -o \
  163. -name '*.bc' -o \
  164. -name '*.dSYM' -o \
  165. -name '*.libaux' -o \
  166. -name '*.out' -o \
  167. -name '*.err' -o \
  168. -name '*.debugger.script' \
  169. | xargs rm -rf
  170. ######################################################################
  171. # Tidy
  172. ######################################################################
  173. ifdef CFG_NOTIDY
  174. tidy:
  175. else
  176. ALL_CS := $(wildcard $(S)src/rt/*.cpp \
  177. $(S)src/rt/*/*.cpp \
  178. $(S)src/rt/*/*/*.cpp \
  179. $(S)src/rustllvm/*.cpp)
  180. ALL_CS := $(filter-out $(S)src/rt/miniz.cpp \
  181. $(wildcard $(S)src/rt/sundown/src/*.c) \
  182. $(wildcard $(S)src/rt/sundown/html/*.c) \
  183. ,$(ALL_CS))
  184. ALL_HS := $(wildcard $(S)src/rt/*.h \
  185. $(S)src/rt/*/*.h \
  186. $(S)src/rt/*/*/*.h \
  187. $(S)src/rustllvm/*.h)
  188. ALL_HS := $(filter-out $(S)src/rt/vg/valgrind.h \
  189. $(S)src/rt/vg/memcheck.h \
  190. $(S)src/rt/msvc/typeof.h \
  191. $(S)src/rt/msvc/stdint.h \
  192. $(S)src/rt/msvc/inttypes.h \
  193. $(wildcard $(S)src/rt/sundown/src/*.h) \
  194. $(wildcard $(S)src/rt/sundown/html/*.h) \
  195. ,$(ALL_HS))
  196. # Run the tidy script in multiple parts to avoid huge 'echo' commands
  197. tidy:
  198. @$(call E, check: formatting)
  199. $(Q)find $(S)src -name '*.r[sc]' \
  200. | grep '^$(S)src/libuv' -v \
  201. | grep '^$(S)src/llvm' -v \
  202. | grep '^$(S)src/gyp' -v \
  203. | grep '^$(S)src/libbacktrace' -v \
  204. | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
  205. $(Q)find $(S)src/etc -name '*.py' \
  206. | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
  207. $(Q)find $(S)src/doc -name '*.js' \
  208. | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
  209. $(Q)find $(S)src/etc -name '*.sh' \
  210. | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
  211. $(Q)find $(S)src/etc -name '*.pl' \
  212. | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
  213. $(Q)find $(S)src/etc -name '*.c' \
  214. | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
  215. $(Q)find $(S)src/etc -name '*.h' \
  216. | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
  217. $(Q)echo $(ALL_CS) \
  218. | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
  219. $(Q)echo $(ALL_HS) \
  220. | xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
  221. $(Q)find $(S)src -type f -perm +111 \
  222. -not -name '*.rs' -and -not -name '*.py' \
  223. -and -not -name '*.sh' \
  224. | grep '^$(S)src/llvm' -v \
  225. | grep '^$(S)src/libuv' -v \
  226. | grep '^$(S)src/gyp' -v \
  227. | grep '^$(S)src/etc' -v \
  228. | grep '^$(S)src/doc' -v \
  229. | grep '^$(S)src/compiler-rt' -v \
  230. | grep '^$(S)src/libbacktrace' -v \
  231. | xargs $(CFG_PYTHON) $(S)src/etc/check-binaries.py
  232. endif
  233. ######################################################################
  234. # Sets of tests
  235. ######################################################################
  236. define DEF_TEST_SETS
  237. check-stage$(1)-T-$(2)-H-$(3)-exec: \
  238. check-stage$(1)-T-$(2)-H-$(3)-rpass-exec \
  239. check-stage$(1)-T-$(2)-H-$(3)-rfail-exec \
  240. check-stage$(1)-T-$(2)-H-$(3)-cfail-exec \
  241. check-stage$(1)-T-$(2)-H-$(3)-rpass-full-exec \
  242. check-stage$(1)-T-$(2)-H-$(3)-rmake-exec \
  243. check-stage$(1)-T-$(2)-H-$(3)-crates-exec \
  244. check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec \
  245. check-stage$(1)-T-$(2)-H-$(3)-bench-exec \
  246. check-stage$(1)-T-$(2)-H-$(3)-debuginfo-exec \
  247. check-stage$(1)-T-$(2)-H-$(3)-codegen-exec \
  248. check-stage$(1)-T-$(2)-H-$(3)-doc-exec \
  249. check-stage$(1)-T-$(2)-H-$(3)-pretty-exec
  250. # Only test the compiler-dependent crates when the target is
  251. # able to build a compiler (when the target triple is in the set of host triples)
  252. ifneq ($$(findstring $(2),$$(CFG_HOST)),)
  253. check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
  254. $$(foreach crate,$$(TEST_CRATES), \
  255. check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
  256. else
  257. check-stage$(1)-T-$(2)-H-$(3)-crates-exec: \
  258. $$(foreach crate,$$(TEST_TARGET_CRATES), \
  259. check-stage$(1)-T-$(2)-H-$(3)-$$(crate)-exec)
  260. endif
  261. check-stage$(1)-T-$(2)-H-$(3)-doc-crates-exec: \
  262. $$(foreach crate,$$(TEST_DOC_CRATES), \
  263. check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$$(crate)-exec)
  264. check-stage$(1)-T-$(2)-H-$(3)-doc-exec: \
  265. $$(foreach docname,$$(DOCS), \
  266. check-stage$(1)-T-$(2)-H-$(3)-doc-$$(docname)-exec)
  267. check-stage$(1)-T-$(2)-H-$(3)-pretty-exec: \
  268. check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-exec \
  269. check-stage$(1)-T-$(2)-H-$(3)-pretty-rpass-full-exec \
  270. check-stage$(1)-T-$(2)-H-$(3)-pretty-rfail-exec \
  271. check-stage$(1)-T-$(2)-H-$(3)-pretty-bench-exec \
  272. check-stage$(1)-T-$(2)-H-$(3)-pretty-pretty-exec
  273. endef
  274. $(foreach host,$(CFG_HOST), \
  275. $(foreach target,$(CFG_TARGET), \
  276. $(foreach stage,$(STAGES), \
  277. $(eval $(call DEF_TEST_SETS,$(stage),$(target),$(host))))))
  278. ######################################################################
  279. # Crate testing
  280. ######################################################################
  281. define TEST_RUNNER
  282. # If NO_REBUILD is set then break the dependencies on everything but
  283. # the source files so we can test crates without rebuilding any of the
  284. # parent crates.
  285. ifeq ($(NO_REBUILD),)
  286. TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(SREQ$(1)_T_$(2)_H_$(3)) \
  287. $$(foreach crate,$$(TARGET_CRATES),\
  288. $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \
  289. $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4))
  290. else
  291. TESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
  292. endif
  293. $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): CFG_COMPILER_HOST_TRIPLE = $(2)
  294. $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2)): \
  295. $$(CRATEFILE_$(4)) \
  296. $$(TESTDEP_$(1)_$(2)_$(3)_$(4))
  297. @$$(call E, oxidize: $$@)
  298. $$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test \
  299. -L "$$(RT_OUTPUT_DIR_$(2))" \
  300. -L "$$(LLVM_LIBDIR_$(2))"
  301. endef
  302. $(foreach host,$(CFG_HOST), \
  303. $(eval $(foreach target,$(CFG_TARGET), \
  304. $(eval $(foreach stage,$(STAGES), \
  305. $(eval $(foreach crate,$(TEST_CRATES), \
  306. $(eval $(call TEST_RUNNER,$(stage),$(target),$(host),$(crate))))))))))
  307. define DEF_TEST_CRATE_RULES
  308. check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
  309. $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
  310. $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
  311. @$$(call E, run: $$<)
  312. $$(Q)$$(call CFG_RUN_TEST_$(2),$$<,$(2),$(3)) $$(TESTARGS) \
  313. --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
  314. $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) \
  315. && touch $$@
  316. endef
  317. define DEF_TEST_CRATE_RULES_arm-linux-androideabi
  318. check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
  319. $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
  320. $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
  321. @$$(call E, run: $$< via adb)
  322. $$(Q)$(CFG_ADB) push $$< $(CFG_ADB_TEST_DIR)
  323. $$(Q)$(CFG_ADB) shell '(cd $(CFG_ADB_TEST_DIR); LD_LIBRARY_PATH=. \
  324. ./$$(notdir $$<) \
  325. --logfile $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log \
  326. $$(call CRATE_TEST_EXTRA_ARGS,$(1),$(2),$(3),$(4)) $(TESTARGS))' \
  327. > tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
  328. $$(Q)cat tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp
  329. $$(Q)touch tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
  330. $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log tmp/
  331. $$(Q)$(CFG_ADB) shell rm $(CFG_ADB_TEST_DIR)/check-stage$(1)-T-$(2)-H-$(3)-$(4).log
  332. $$(Q)$(CFG_ADB) pull $(CFG_ADB_TEST_DIR)/$$(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) tmp/
  333. @if grep -q "result: ok" tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
  334. then \
  335. rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
  336. touch $$@; \
  337. else \
  338. rm tmp/check-stage$(1)-T-$(2)-H-$(3)-$(4).tmp; \
  339. exit 101; \
  340. fi
  341. endef
  342. define DEF_TEST_CRATE_RULES_null
  343. check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
  344. $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
  345. $(3)/stage$(1)/test/$(4)test-$(2)$$(X_$(2))
  346. @$$(call E, failing: no device for $$< )
  347. false
  348. endef
  349. $(foreach host,$(CFG_HOST), \
  350. $(foreach target,$(CFG_TARGET), \
  351. $(foreach stage,$(STAGES), \
  352. $(foreach crate, $(TEST_CRATES), \
  353. $(if $(findstring $(target),$(CFG_BUILD)), \
  354. $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))), \
  355. $(if $(findstring $(target),"arm-linux-androideabi"), \
  356. $(if $(findstring $(CFG_ADB_DEVICE_STATUS),"true"), \
  357. $(eval $(call DEF_TEST_CRATE_RULES_arm-linux-androideabi,$(stage),$(target),$(host),$(crate))), \
  358. $(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
  359. ), \
  360. $(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
  361. ))))))
  362. ######################################################################
  363. # Rules for the compiletest tests (rpass, rfail, etc.)
  364. ######################################################################
  365. RPASS_RC := $(wildcard $(S)src/test/run-pass/*.rc)
  366. RPASS_RS := $(wildcard $(S)src/test/run-pass/*.rs)
  367. RPASS_FULL_RC := $(wildcard $(S)src/test/run-pass-fulldeps/*.rc)
  368. RPASS_FULL_RS := $(wildcard $(S)src/test/run-pass-fulldeps/*.rs)
  369. RFAIL_RC := $(wildcard $(S)src/test/run-fail/*.rc)
  370. RFAIL_RS := $(wildcard $(S)src/test/run-fail/*.rs)
  371. CFAIL_RC := $(wildcard $(S)src/test/compile-fail/*.rc)
  372. CFAIL_RS := $(wildcard $(S)src/test/compile-fail/*.rs)
  373. BENCH_RS := $(wildcard $(S)src/test/bench/*.rs)
  374. PRETTY_RS := $(wildcard $(S)src/test/pretty/*.rs)
  375. DEBUGINFO_RS := $(wildcard $(S)src/test/debug-info/*.rs)
  376. CODEGEN_RS := $(wildcard $(S)src/test/codegen/*.rs)
  377. CODEGEN_CC := $(wildcard $(S)src/test/codegen/*.cc)
  378. # perf tests are the same as bench tests only they run under
  379. # a performance monitor.
  380. PERF_RS := $(wildcard $(S)src/test/bench/*.rs)
  381. RPASS_TESTS := $(RPASS_RC) $(RPASS_RS)
  382. RPASS_FULL_TESTS := $(RPASS_FULL_RC) $(RPASS_FULL_RS)
  383. RFAIL_TESTS := $(RFAIL_RC) $(RFAIL_RS)
  384. CFAIL_TESTS := $(CFAIL_RC) $(CFAIL_RS)
  385. BENCH_TESTS := $(BENCH_RS)
  386. PERF_TESTS := $(PERF_RS)
  387. PRETTY_TESTS := $(PRETTY_RS)
  388. DEBUGINFO_TESTS := $(DEBUGINFO_RS)
  389. CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
  390. CTEST_SRC_BASE_rpass = run-pass
  391. CTEST_BUILD_BASE_rpass = run-pass
  392. CTEST_MODE_rpass = run-pass
  393. CTEST_RUNTOOL_rpass = $(CTEST_RUNTOOL)
  394. CTEST_SRC_BASE_rpass-full = run-pass-fulldeps
  395. CTEST_BUILD_BASE_rpass-full = run-pass-fulldeps
  396. CTEST_MODE_rpass-full = run-pass
  397. CTEST_RUNTOOL_rpass-full = $(CTEST_RUNTOOL)
  398. CTEST_SRC_BASE_rfail = run-fail
  399. CTEST_BUILD_BASE_rfail = run-fail
  400. CTEST_MODE_rfail = run-fail
  401. CTEST_RUNTOOL_rfail = $(CTEST_RUNTOOL)
  402. CTEST_SRC_BASE_cfail = compile-fail
  403. CTEST_BUILD_BASE_cfail = compile-fail
  404. CTEST_MODE_cfail = compile-fail
  405. CTEST_RUNTOOL_cfail = $(CTEST_RUNTOOL)
  406. CTEST_SRC_BASE_bench = bench
  407. CTEST_BUILD_BASE_bench = bench
  408. CTEST_MODE_bench = run-pass
  409. CTEST_RUNTOOL_bench = $(CTEST_RUNTOOL)
  410. CTEST_SRC_BASE_perf = bench
  411. CTEST_BUILD_BASE_perf = perf
  412. CTEST_MODE_perf = run-pass
  413. CTEST_RUNTOOL_perf = $(CTEST_PERF_RUNTOOL)
  414. CTEST_SRC_BASE_debuginfo = debug-info
  415. CTEST_BUILD_BASE_debuginfo = debug-info
  416. CTEST_MODE_debuginfo = debug-info
  417. CTEST_RUNTOOL_debuginfo = $(CTEST_RUNTOOL)
  418. CTEST_SRC_BASE_codegen = codegen
  419. CTEST_BUILD_BASE_codegen = codegen
  420. CTEST_MODE_codegen = codegen
  421. CTEST_RUNTOOL_codegen = $(CTEST_RUNTOOL)
  422. # CTEST_DISABLE_$(TEST_GROUP), if set, will cause the test group to be
  423. # disabled and the associated message to be printed as a warning
  424. # during attempts to run those tests.
  425. ifeq ($(CFG_GDB),)
  426. CTEST_DISABLE_debuginfo = "no gdb found"
  427. endif
  428. ifeq ($(CFG_CLANG),)
  429. CTEST_DISABLE_codegen = "no clang found"
  430. endif
  431. ifeq ($(CFG_OSTYPE),apple-darwin)
  432. CTEST_DISABLE_debuginfo = "gdb on darwing needs root"
  433. endif
  434. # CTEST_DISABLE_NONSELFHOST_$(TEST_GROUP), if set, will cause that
  435. # test group to be disabled *unless* the target is able to build a
  436. # compiler (i.e. when the target triple is in the set of of host
  437. # triples). The associated message will be printed as a warning
  438. # during attempts to run those tests.
  439. CTEST_DISABLE_NONSELFHOST_rpass-full = "run-pass-full suite is unavailable when cross-compiling."
  440. define DEF_CTEST_VARS
  441. # All the per-stage build rules you might want to call from the
  442. # command line.
  443. #
  444. # $(1) is the stage number
  445. # $(2) is the target triple to test
  446. # $(3) is the host triple to test
  447. # Prerequisites for compiletest tests
  448. TEST_SREQ$(1)_T_$(2)_H_$(3) = \
  449. $$(HBIN$(1)_H_$(3))/compiletest$$(X_$(3)) \
  450. $$(SREQ$(1)_T_$(2)_H_$(3))
  451. # Rules for the cfail/rfail/rpass/bench/perf test runner
  452. # The tests select when to use debug configuration on their own;
  453. # remove directive, if present, from CFG_RUSTC_FLAGS (issue #7898).
  454. CTEST_RUSTC_FLAGS := $$(subst --cfg ndebug,,$$(CFG_RUSTC_FLAGS))
  455. # The tests can not be optimized while the rest of the compiler is optimized, so
  456. # filter out the optimization (if any) from rustc and then figure out if we need
  457. # to be optimized
  458. CTEST_RUSTC_FLAGS := $$(subst -O,,$$(CTEST_RUSTC_FLAGS))
  459. ifndef CFG_DISABLE_OPTIMIZE_TESTS
  460. CTEST_RUSTC_FLAGS += -O
  461. endif
  462. CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
  463. --compile-lib-path $$(HLIB$(1)_H_$(3)) \
  464. --run-lib-path $$(TLIB$(1)_T_$(2)_H_$(3)) \
  465. --rustc-path $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
  466. --clang-path $(if $(CFG_CLANG),$(CFG_CLANG),clang) \
  467. --llvm-bin-path $(CFG_LLVM_INST_DIR_$(CFG_BUILD))/bin \
  468. --aux-base $$(S)src/test/auxiliary/ \
  469. --stage-id stage$(1)-$(2) \
  470. --target $(2) \
  471. --host $(3) \
  472. --adb-path=$(CFG_ADB) \
  473. --adb-test-dir=$(CFG_ADB_TEST_DIR) \
  474. --host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
  475. --target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
  476. $$(CTEST_TESTARGS)
  477. CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
  478. CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(2)_H_$(3))
  479. CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
  480. CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
  481. CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)
  482. CTEST_DEPS_perf_$(1)-T-$(2)-H-$(3) = $$(PERF_TESTS)
  483. CTEST_DEPS_debuginfo_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_TESTS)
  484. CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
  485. endef
  486. $(foreach host,$(CFG_HOST), \
  487. $(eval $(foreach target,$(CFG_TARGET), \
  488. $(eval $(foreach stage,$(STAGES), \
  489. $(eval $(call DEF_CTEST_VARS,$(stage),$(target),$(host))))))))
  490. define DEF_RUN_COMPILETEST
  491. CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
  492. $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
  493. --src-base $$(S)src/test/$$(CTEST_SRC_BASE_$(4))/ \
  494. --build-base $(3)/test/$$(CTEST_BUILD_BASE_$(4))/ \
  495. --ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
  496. --mode $$(CTEST_MODE_$(4)) \
  497. $$(CTEST_RUNTOOL_$(4))
  498. check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
  499. # CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)
  500. # Goal: leave this variable as empty string if we should run the test.
  501. # Otherwise, set it to the reason we are not running the test.
  502. # (Encoded as a separate variable because GNU make does not have a
  503. # good way to express OR on ifeq commands)
  504. ifneq ($$(CTEST_DISABLE_$(4)),)
  505. # Test suite is disabled for all configured targets.
  506. CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_$(4))
  507. else
  508. # else, check if non-self-hosted target (i.e. target not-in hosts) ...
  509. ifeq ($$(findstring $(2),$$(CFG_HOST)),)
  510. # ... if so, then check if this test suite is disabled for non-selfhosts.
  511. ifneq ($$(CTEST_DISABLE_NONSELFHOST_$(4)),)
  512. # Test suite is disabled for this target.
  513. CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4) := $$(CTEST_DISABLE_NONSELFHOST_$(4))
  514. endif
  515. endif
  516. # Neither DISABLE nor DISABLE_NONSELFHOST is set ==> okay, run the test.
  517. endif
  518. ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),)
  519. $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
  520. $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
  521. $$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
  522. @$$(call E, run $(4) [$(2)]: $$<)
  523. $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
  524. $$(CTEST_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
  525. --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
  526. && touch $$@
  527. else
  528. $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)):
  529. @$$(call E, run $(4) [$(2)]: $$<)
  530. @$$(call E, warning: tests disabled: $$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)))
  531. touch $$@
  532. endif
  533. endef
  534. CTEST_NAMES = rpass rpass-full rfail cfail bench perf debuginfo codegen
  535. $(foreach host,$(CFG_HOST), \
  536. $(eval $(foreach target,$(CFG_TARGET), \
  537. $(eval $(foreach stage,$(STAGES), \
  538. $(eval $(foreach name,$(CTEST_NAMES), \
  539. $(eval $(call DEF_RUN_COMPILETEST,$(stage),$(target),$(host),$(name))))))))))
  540. PRETTY_NAMES = pretty-rpass pretty-rpass-full pretty-rfail pretty-bench pretty-pretty
  541. PRETTY_DEPS_pretty-rpass = $(RPASS_TESTS)
  542. PRETTY_DEPS_pretty-rpass-full = $(RPASS_FULL_TESTS)
  543. PRETTY_DEPS_pretty-rfail = $(RFAIL_TESTS)
  544. PRETTY_DEPS_pretty-bench = $(BENCH_TESTS)
  545. PRETTY_DEPS_pretty-pretty = $(PRETTY_TESTS)
  546. PRETTY_DIRNAME_pretty-rpass = run-pass
  547. PRETTY_DIRNAME_pretty-rpass-full = run-pass-fulldeps
  548. PRETTY_DIRNAME_pretty-rfail = run-fail
  549. PRETTY_DIRNAME_pretty-bench = bench
  550. PRETTY_DIRNAME_pretty-pretty = pretty
  551. define DEF_RUN_PRETTY_TEST
  552. PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4) := \
  553. $$(CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3)) \
  554. --src-base $$(S)src/test/$$(PRETTY_DIRNAME_$(4))/ \
  555. --build-base $(3)/test/$$(PRETTY_DIRNAME_$(4))/ \
  556. --mode pretty
  557. check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4))
  558. $$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
  559. $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
  560. $$(PRETTY_DEPS_$(4))
  561. @$$(call E, run pretty-rpass [$(2)]: $$<)
  562. $$(Q)$$(call CFG_RUN_CTEST_$(2),$(1),$$<,$(3)) \
  563. $$(PRETTY_ARGS$(1)-T-$(2)-H-$(3)-$(4)) \
  564. --logfile $$(call TEST_LOG_FILE,$(1),$(2),$(3),$(4)) \
  565. && touch $$@
  566. endef
  567. $(foreach host,$(CFG_HOST), \
  568. $(foreach target,$(CFG_TARGET), \
  569. $(foreach stage,$(STAGES), \
  570. $(foreach pretty-name,$(PRETTY_NAMES), \
  571. $(eval $(call DEF_RUN_PRETTY_TEST,$(stage),$(target),$(host),$(pretty-name)))))))
  572. ######################################################################
  573. # Crate & freestanding documentation tests
  574. ######################################################################
  575. define DEF_RUSTDOC
  576. RUSTDOC_EXE_$(1)_T_$(2)_H_$(3) := $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3))
  577. RUSTDOC_$(1)_T_$(2)_H_$(3) := $$(RPATH_VAR$(1)_T_$(2)_H_$(3)) $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
  578. endef
  579. $(foreach host,$(CFG_HOST), \
  580. $(foreach target,$(CFG_TARGET), \
  581. $(foreach stage,$(STAGES), \
  582. $(eval $(call DEF_RUSTDOC,$(stage),$(target),$(host))))))
  583. # Freestanding
  584. define DEF_DOC_TEST
  585. check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4))
  586. # If NO_REBUILD is set then break the dependencies on everything but
  587. # the source files so we can test documentation without rebuilding
  588. # rustdoc etc.
  589. ifeq ($(NO_REBUILD),)
  590. DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
  591. $$(D)/$(4).md \
  592. $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
  593. $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
  594. else
  595. DOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(D)/$(4).md
  596. endif
  597. ifeq ($(2),$$(CFG_BUILD))
  598. $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
  599. @$$(call E, run doc-$(4) [$(2)])
  600. $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --cfg dox --test $$< --test-args "$$(TESTARGS)" && touch $$@
  601. else
  602. $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
  603. touch $$@
  604. endif
  605. endef
  606. $(foreach host,$(CFG_HOST), \
  607. $(foreach target,$(CFG_TARGET), \
  608. $(foreach stage,$(STAGES), \
  609. $(foreach docname,$(DOCS), \
  610. $(eval $(call DEF_DOC_TEST,$(stage),$(target),$(host),$(docname)))))))
  611. # Crates
  612. define DEF_CRATE_DOC_TEST
  613. # If NO_REBUILD is set then break the dependencies on everything but
  614. # the source files so we can test crate documentation without
  615. # rebuilding any of the parent crates.
  616. ifeq ($(NO_REBUILD),)
  617. CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = \
  618. $$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
  619. $$(CRATE_FULLDEPS_$(1)_T_$(2)_H_$(3)_$(4)) \
  620. $$(RUSTDOC_EXE_$(1)_T_$(2)_H_$(3))
  621. else
  622. CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4) = $$(RSINPUTS_$(4))
  623. endif
  624. check-stage$(1)-T-$(2)-H-$(3)-doc-crate-$(4)-exec: \
  625. $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4))
  626. ifeq ($(2),$$(CFG_BUILD))
  627. $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)): $$(CRATEDOCTESTDEP_$(1)_$(2)_$(3)_$(4))
  628. @$$(call E, run doc-crate-$(4) [$(2)])
  629. $$(Q)$$(RUSTDOC_$(1)_T_$(2)_H_$(3)) --test \
  630. $$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
  631. else
  632. $$(call TEST_OK_FILE,$(1),$(2),$(3),doc-crate-$(4)):
  633. touch $$@
  634. endif
  635. endef
  636. $(foreach host,$(CFG_HOST), \
  637. $(foreach target,$(CFG_TARGET), \
  638. $(foreach stage,$(STAGES), \
  639. $(foreach crate,$(TEST_DOC_CRATES), \
  640. $(eval $(call DEF_CRATE_DOC_TEST,$(stage),$(target),$(host),$(crate)))))))
  641. ######################################################################
  642. # Shortcut rules
  643. ######################################################################
  644. TEST_GROUPS = \
  645. crates \
  646. $(foreach crate,$(TEST_CRATES),$(crate)) \
  647. $(foreach crate,$(TEST_DOC_CRATES),doc-crate-$(crate)) \
  648. rpass \
  649. rpass-full \
  650. rfail \
  651. cfail \
  652. bench \
  653. perf \
  654. rmake \
  655. debuginfo \
  656. codegen \
  657. doc \
  658. $(foreach docname,$(DOCS),doc-$(docname)) \
  659. pretty \
  660. pretty-rpass \
  661. pretty-rpass-full \
  662. pretty-rfail \
  663. pretty-bench \
  664. pretty-pretty \
  665. $(NULL)
  666. define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST
  667. check-stage$(1)-T-$(2)-H-$(3): check-stage$(1)-T-$(2)-H-$(3)-exec
  668. endef
  669. $(foreach stage,$(STAGES), \
  670. $(foreach target,$(CFG_TARGET), \
  671. $(foreach host,$(CFG_HOST), \
  672. $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST,$(stage),$(target),$(host))))))
  673. define DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP
  674. check-stage$(1)-T-$(2)-H-$(3)-$(4): check-stage$(1)-T-$(2)-H-$(3)-$(4)-exec
  675. endef
  676. $(foreach stage,$(STAGES), \
  677. $(foreach target,$(CFG_TARGET), \
  678. $(foreach host,$(CFG_HOST), \
  679. $(foreach group,$(TEST_GROUPS), \
  680. $(eval $(call DEF_CHECK_FOR_STAGE_AND_TARGET_AND_HOST_AND_GROUP,$(stage),$(target),$(host),$(group)))))))
  681. define DEF_CHECK_FOR_STAGE
  682. check-stage$(1): check-stage$(1)-H-$$(CFG_BUILD)
  683. check-stage$(1)-H-all: $$(foreach target,$$(CFG_TARGET), \
  684. check-stage$(1)-H-$$(target))
  685. endef
  686. $(foreach stage,$(STAGES), \
  687. $(eval $(call DEF_CHECK_FOR_STAGE,$(stage))))
  688. define DEF_CHECK_FOR_STAGE_AND_GROUP
  689. check-stage$(1)-$(2): check-stage$(1)-H-$$(CFG_BUILD)-$(2)
  690. check-stage$(1)-H-all-$(2): $$(foreach target,$$(CFG_TARGET), \
  691. check-stage$(1)-H-$$(target)-$(2))
  692. endef
  693. $(foreach stage,$(STAGES), \
  694. $(foreach group,$(TEST_GROUPS), \
  695. $(eval $(call DEF_CHECK_FOR_STAGE_AND_GROUP,$(stage),$(group)))))
  696. define DEF_CHECK_FOR_STAGE_AND_HOSTS
  697. check-stage$(1)-H-$(2): $$(foreach target,$$(CFG_TARGET), \
  698. check-stage$(1)-T-$$(target)-H-$(2))
  699. endef
  700. $(foreach stage,$(STAGES), \
  701. $(foreach host,$(CFG_HOST), \
  702. $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS,$(stage),$(host)))))
  703. define DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP
  704. check-stage$(1)-H-$(2)-$(3): $$(foreach target,$$(CFG_TARGET), \
  705. check-stage$(1)-T-$$(target)-H-$(2)-$(3))
  706. endef
  707. $(foreach stage,$(STAGES), \
  708. $(foreach host,$(CFG_HOST), \
  709. $(foreach group,$(TEST_GROUPS), \
  710. $(eval $(call DEF_CHECK_FOR_STAGE_AND_HOSTS_AND_GROUP,$(stage),$(host),$(group))))))
  711. define DEF_CHECK_DOC_FOR_STAGE
  712. check-stage$(1)-docs: $$(foreach docname,$$(DOCS),\
  713. check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-$$(docname)) \
  714. $$(foreach crate,$$(TEST_DOC_CRATES),\
  715. check-stage$(1)-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-doc-crate-$$(crate))
  716. endef
  717. $(foreach stage,$(STAGES), \
  718. $(eval $(call DEF_CHECK_DOC_FOR_STAGE,$(stage))))
  719. define DEF_CHECK_CRATE
  720. check-$(1): check-stage2-T-$$(CFG_BUILD)-H-$$(CFG_BUILD)-$(1)-exec
  721. endef
  722. $(foreach crate,$(TEST_CRATES), \
  723. $(eval $(call DEF_CHECK_CRATE,$(crate))))
  724. ######################################################################
  725. # RMAKE rules
  726. ######################################################################
  727. RMAKE_TESTS := $(shell ls -d $(S)src/test/run-make/*/)
  728. RMAKE_TESTS := $(RMAKE_TESTS:$(S)src/test/run-make/%/=%)
  729. define DEF_RMAKE_FOR_T_H
  730. # $(1) the stage
  731. # $(2) target triple
  732. # $(3) host triple
  733. ifeq ($(2)$(3),$$(CFG_BUILD)$$(CFG_BUILD))
  734. check-stage$(1)-T-$(2)-H-$(3)-rmake-exec: \
  735. $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake)
  736. $$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
  737. $$(RMAKE_TESTS:%=$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok)
  738. @touch $$@
  739. $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
  740. $(S)src/test/run-make/%/Makefile \
  741. $$(CSREQ$(1)_T_$(2)_H_$(3))
  742. @rm -rf $(3)/test/run-make/$$*
  743. @mkdir -p $(3)/test/run-make/$$*
  744. $$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
  745. $$(MAKE) \
  746. $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
  747. $(3)/test/run-make/$$* \
  748. "$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
  749. $$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
  750. "$$(TESTNAME)" \
  751. "$$(RPATH_VAR$(1)_T_$(2)_H_$(3))"
  752. @touch $$@
  753. else
  754. # FIXME #11094 - The above rule doesn't work right for multiple targets
  755. check-stage$(1)-T-$(2)-H-$(3)-rmake-exec:
  756. @true
  757. endif
  758. endef
  759. $(foreach stage,$(STAGES), \
  760. $(foreach target,$(CFG_TARGET), \
  761. $(foreach host,$(CFG_HOST), \
  762. $(eval $(call DEF_RMAKE_FOR_T_H,$(stage),$(target),$(host))))))