Move compiletest to src/ and cleanup build rules

This commit is contained in:
Brian Anderson 2011-10-02 17:28:59 -07:00
parent edb56507ee
commit 3a6f3cf275
11 changed files with 60 additions and 48 deletions

View File

@ -321,7 +321,7 @@ include $(CFG_SRC_DIR)/mk/stage0.mk
include $(CFG_SRC_DIR)/mk/rt.mk
include $(CFG_SRC_DIR)/mk/rustllvm.mk
include $(CFG_SRC_DIR)/mk/autodep.mk
include $(CFG_SRC_DIR)/mk/fuzzer.mk
include $(CFG_SRC_DIR)/mk/tools.mk
include $(CFG_SRC_DIR)/mk/docs.mk

View File

@ -1,28 +0,0 @@
FUZZER_CRATE := $(S)src/fuzzer/fuzzer.rc
FUZZER_INPUTS := $(wildcard $(addprefix $(S)src/fuzzer/, *.rs))
define FUZZ_STAGE_N
# We only really care about fuzzing on the host arch
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/fuzzer$$(X): \
$$(FUZZER_CRATE) $$(FUZZER_INPUTS) \
$$(TARGET_SREQ$(1)$(CFG_HOST_TRIPLE)) \
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB) \
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_LIBRUSTC)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) -o $$@ $$<
# Promote the stageN target to stageN+1 host
# FIXME: Shouldn't need to depend on host/librustc.so once
# rpath is working
$$(HOST_BIN$(2))/fuzzer$$(X): \
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/fuzzer$$(X) \
$$(HOST_LIB$(2))/$$(CFG_LIBRUSTC)
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
endef
$(eval $(call FUZZ_STAGE_N,0,1))
$(eval $(call FUZZ_STAGE_N,1,2))
$(eval $(call FUZZ_STAGE_N,2,3))

View File

@ -56,10 +56,6 @@ ifdef VERBOSE
CTEST_TESTARGS += --verbose
endif
# The test runner that runs the cfail/rfail/rpass and bench tests
COMPILETEST_CRATE := $(S)src/test/compiletest/compiletest.rc
COMPILETEST_INPUTS := $(wildcard $(S)src/test/compiletest/*rs)
# The standard library test crate
STDTEST_CRATE := $(S)src/test/stdtest/stdtest.rc
STDTEST_INPUTS := $(wildcard $(S)src/test/stdtest/*rs)
@ -241,61 +237,55 @@ PRETTY_PRETTY_ARGS$(2) := $$(CTEST_COMMON_ARGS$(2)) \
--build-base test/pretty/ \
--mode pretty \
test/compiletest.stage$(2)$$(X): $$(COMPILETEST_CRATE) \
$$(COMPILETEST_INPUTS) \
$$(SREQ$(2)$$(CFG_HOST_TRIPLE))
@$$(call E, compile_and_link: $$@)
$$(STAGE$(2)) -o $$@ $$<
test/compile-fail.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
test/compile-fail.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
$$(CFAIL_TESTS)
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(CFAIL_ARGS$(2))
$$(Q)touch $$@
test/run-fail.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
test/run-fail.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
$$(RFAIL_TESTS)
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(RFAIL_ARGS$(2))
$$(Q)touch $$@
test/run-pass.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
test/run-pass.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
$$(RPASS_TESTS)
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(RPASS_ARGS$(2))
$$(Q)touch $$@
test/bench.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
test/bench.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
$$(BENCH_TESTS)
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(BENCH_ARGS$(2))
$$(Q)touch $$@
test/perf.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
test/perf.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
$$(BENCH_TESTS)
@$$(call E, perf: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PERF_ARGS$(2))
$$(Q)touch $$@
test/pretty-rpass.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
test/pretty-rpass.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
$$(RPASS_TESTS)
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_RPASS_ARGS$(2))
$$(Q)touch $$@
test/pretty-rfail.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
test/pretty-rfail.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
$$(RFAIL_TESTS)
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_RFAIL_ARGS$(2))
$$(Q)touch $$@
test/pretty-bench.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
test/pretty-bench.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
$$(BENCH_TESTS)
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_BENCH_ARGS$(2))
$$(Q)touch $$@
test/pretty-pretty.stage$(2).out.tmp: test/compiletest.stage$(2)$$(X) \
test/pretty-pretty.stage$(2).out.tmp: $$(HOST_BIN$(2))/compiletest$$(X) \
$$(PRETTY_TESTS)
@$$(call E, run: $$<)
$$(Q)$$(call CFG_RUN_CTEST,$(2),$$<) $$(PRETTY_PRETTY_ARGS$(2))

50
mk/tools.mk Normal file
View File

@ -0,0 +1,50 @@
# Rules for non-core tools built with the compiler, both for target
# and host architectures
FUZZER_CRATE := $(S)src/fuzzer/fuzzer.rc
FUZZER_INPUTS := $(wildcard $(addprefix $(S)src/fuzzer/, *.rs))
# The test runner that runs the cfail/rfail/rpass and bench tests
COMPILETEST_CRATE := $(S)src/compiletest/compiletest.rc
COMPILETEST_INPUTS := $(wildcard $(S)src/compiletest/*rs)
# FIXME: These are only built for the host arch. Eventually we'll
# have tools that need to built for other targets.
define TOOLS_STAGE_N
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/fuzzer$$(X): \
$$(FUZZER_CRATE) $$(FUZZER_INPUTS) \
$$(TARGET_SREQ$(1)$(CFG_HOST_TRIPLE)) \
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB) \
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_LIBRUSTC)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) -o $$@ $$<
# Promote the stageN target to stageN+1 host
# FIXME: Shouldn't need to depend on host/librustc.so once
# rpath is working
$$(HOST_BIN$(2))/fuzzer$$(X): \
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/fuzzer$$(X) \
$$(HOST_LIB$(2))/$$(CFG_LIBRUSTC) \
$$(HOST_SREQ$(2))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/compiletest$$(X): \
$$(COMPILETEST_CRATE) $$(COMPILETEST_INPUTS) \
$$(TARGET_SREQ$(1)$(CFG_HOST_TRIPLE)) \
$$(TARGET_LIB$(1)$(CFG_HOST_TRIPLE))/$$(CFG_STDLIB)
@$$(call E, compile_and_link: $$@)
$$(STAGE$(1)) -o $$@ $$<
$$(HOST_BIN$(2))/compiletest$$(X): \
$$(TARGET_BIN$(1)$(CFG_HOST_TRIPLE))/compiletest$$(X) \
$$(HOST_SREQ$(2))
@$$(call E, cp: $$@)
$$(Q)cp $$< $$@
endef
$(eval $(call TOOLS_STAGE_N,0,1))
$(eval $(call TOOLS_STAGE_N,1,2))
$(eval $(call TOOLS_STAGE_N,2,3))