Skip to content

Commit 3a6f3cf

Browse files
committed
Move compiletest to src/ and cleanup build rules
1 parent edb5650 commit 3a6f3cf

File tree

11 files changed

+60
-48
lines changed

11 files changed

+60
-48
lines changed

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ include $(CFG_SRC_DIR)/mk/stage0.mk
321321
include $(CFG_SRC_DIR)/mk/rt.mk
322322
include $(CFG_SRC_DIR)/mk/rustllvm.mk
323323
include $(CFG_SRC_DIR)/mk/autodep.mk
324-
include $(CFG_SRC_DIR)/mk/fuzzer.mk
324+
include $(CFG_SRC_DIR)/mk/tools.mk
325325
include $(CFG_SRC_DIR)/mk/docs.mk
326326

327327

mk/fuzzer.mk

Lines changed: 0 additions & 28 deletions
This file was deleted.

mk/tests.mk

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ ifdef VERBOSE
5656
CTEST_TESTARGS += --verbose
5757
endif
5858

59-
# The test runner that runs the cfail/rfail/rpass and bench tests
60-
COMPILETEST_CRATE := $(S)src/test/compiletest/compiletest.rc
61-
COMPILETEST_INPUTS := $(wildcard $(S)src/test/compiletest/*rs)
62-
6359
# The standard library test crate
6460
STDTEST_CRATE := $(S)src/test/stdtest/stdtest.rc
6561
STDTEST_INPUTS := $(wildcard $(S)src/test/stdtest/*rs)
@@ -241,61 +237,55 @@ PRETTY_PRETTY_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
241237
--build-base test/pretty/ \
242238
--mode pretty \
243239

244-
test/compiletest.stage$(2)$$(X): $$(COMPILETEST_CRATE) \
245-
$$(COMPILETEST_INPUTS) \
246-
$$(SREQ$(2)$$(CFG_HOST_TRIPLE))
247-
@$$(call E, compile_and_link: $$@)
248-
$$(STAGE$(2)) -o $$@ $$<
249-
250-
test/compile-fail.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
240+
test/compile-fail.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
251241
$$(CFAIL_TESTS)
252242
@$$(call E, run: $$<)
253243
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(CFAIL_ARGS$(2))
254244
$$(Q)touch $$@
255245

256-
test/run-fail.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
246+
test/run-fail.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
257247
$$(RFAIL_TESTS)
258248
@$$(call E, run: $$<)
259249
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(RFAIL_ARGS$(2))
260250
$$(Q)touch $$@
261251

262-
test/run-pass.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
252+
test/run-pass.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
263253
$$(RPASS_TESTS)
264254
@$$(call E, run: $$<)
265255
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(RPASS_ARGS$(2))
266256
$$(Q)touch $$@
267257

268-
test/bench.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
258+
test/bench.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
269259
$$(BENCH_TESTS)
270260
@$$(call E, run: $$<)
271261
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(BENCH_ARGS$(2))
272262
$$(Q)touch $$@
273263

274-
test/perf.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
264+
test/perf.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
275265
$$(BENCH_TESTS)
276266
@$$(call E, perf: $$<)
277267
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PERF_ARGS$(2))
278268
$$(Q)touch $$@
279269

280-
test/pretty-rpass.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
270+
test/pretty-rpass.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
281271
$$(RPASS_TESTS)
282272
@$$(call E, run: $$<)
283273
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_RPASS_ARGS$(2))
284274
$$(Q)touch $$@
285275

286-
test/pretty-rfail.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
276+
test/pretty-rfail.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
287277
$$(RFAIL_TESTS)
288278
@$$(call E, run: $$<)
289279
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_RFAIL_ARGS$(2))
290280
$$(Q)touch $$@
291281

292-
test/pretty-bench.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
282+
test/pretty-bench.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
293283
$$(BENCH_TESTS)
294284
@$$(call E, run: $$<)
295285
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_BENCH_ARGS$(2))
296286
$$(Q)touch $$@
297287

298-
test/pretty-pretty.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
288+
test/pretty-pretty.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
299289
$$(PRETTY_TESTS)
300290
@$$(call E, run: $$<)
301291
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_PRETTY_ARGS$(2))

mk/tools.mk

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Rules for non-core tools built with the compiler, both for target
2+
# and host architectures
3+
4+
FUZZER_CRATE := $(S)src/fuzzer/fuzzer.rc
5+
FUZZER_INPUTS := $(wildcard $(addprefix $(S)src/fuzzer/, *.rs))
6+
7+
# The test runner that runs the cfail/rfail/rpass and bench tests
8+
COMPILETEST_CRATE := $(S)src/compiletest/compiletest.rc
9+
COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*rs)
10+
11+
# FIXME: These are only built for the host arch. Eventually we'll
12+
# have tools that need to built for other targets.
13+
define TOOLS_STAGE_N
14+
15+
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/fuzzer$$(X): \
16+
$$(FUZZER_CRATE) $$(FUZZER_INPUTS) \
17+
$$(TARGET_SREQ$(1)$(CFG_HOST_TRIPLE)) \
18+
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB) \
19+
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_LIBRUSTC)
20+
@$$(call E, compile_and_link: $$@)
21+
$$(STAGE$(1)) -o $$@ $$<
22+
23+
# Promote the stageN target to stageN+1 host
24+
# FIXME: Shouldn't need to depend on host/librustc.so once
25+
# rpath is working
26+
$$(HOST_BIN$(2))/fuzzer$$(X): \
27+
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/fuzzer$$(X) \
28+
$$(HOST_LIB$(2))/$$(CFG_LIBRUSTC) \
29+
$$(HOST_SREQ$(2))
30+
@$$(call E, cp: $$@)
31+
$$(Q)cp $$< $$@
32+
33+
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/compiletest$$(X): \
34+
$$(COMPILETEST_CRATE) $$(COMPILETEST_INPUTS) \
35+
$$(TARGET_SREQ$(1)$(CFG_HOST_TRIPLE)) \
36+
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB)
37+
@$$(call E, compile_and_link: $$@)
38+
$$(STAGE$(1)) -o $$@ $$<
39+
40+
$$(HOST_BIN$(2))/compiletest$$(X): \
41+
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/compiletest$$(X) \
42+
$$(HOST_SREQ$(2))
43+
@$$(call E, cp: $$@)
44+
$$(Q)cp $$< $$@
45+
46+
endef
47+
48+
$(eval $(call TOOLS_STAGE_N,0,1))
49+
$(eval $(call TOOLS_STAGE_N,1,2))
50+
$(eval $(call TOOLS_STAGE_N,2,3))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)