From 3a6f3cf275061c03c8169ce50779efbda0faa845 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sun, 2 Oct 2011 17:28:59 -0700 Subject: [PATCH] Move compiletest to src/ and cleanup build rules --- Makefile.in | 2 +- mk/fuzzer.mk | 28 ------------- mk/tests.mk | 28 ++++--------- mk/tools.mk | 50 +++++++++++++++++++++++ src/{test => }/compiletest/common.rs | 0 src/{test => }/compiletest/compiletest.rc | 0 src/{test => }/compiletest/compiletest.rs | 0 src/{test => }/compiletest/header.rs | 0 src/{test => }/compiletest/procsrv.rs | 0 src/{test => }/compiletest/runtest.rs | 0 src/{test => }/compiletest/util.rs | 0 11 files changed, 60 insertions(+), 48 deletions(-) delete mode 100644 mk/fuzzer.mk create mode 100644 mk/tools.mk rename src/{test => }/compiletest/common.rs (100%) rename src/{test => }/compiletest/compiletest.rc (100%) rename src/{test => }/compiletest/compiletest.rs (100%) rename src/{test => }/compiletest/header.rs (100%) rename src/{test => }/compiletest/procsrv.rs (100%) rename src/{test => }/compiletest/runtest.rs (100%) rename src/{test => }/compiletest/util.rs (100%) diff --git a/Makefile.in b/Makefile.in index e401ec0ab33..52bc981176f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 diff --git a/mk/fuzzer.mk b/mk/fuzzer.mk deleted file mode 100644 index ced5d6ce6fe..00000000000 --- a/mk/fuzzer.mk +++ /dev/null @@ -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)) diff --git a/mk/tests.mk b/mk/tests.mk index 7dae7e6d552..112aa7b70fc 100644 --- a/mk/tests.mk +++ b/mk/tests.mk @@ -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)) diff --git a/mk/tools.mk b/mk/tools.mk new file mode 100644 index 00000000000..8805cd40be1 --- /dev/null +++ b/mk/tools.mk @@ -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)) diff --git a/src/test/compiletest/common.rs b/src/compiletest/common.rs similarity index 100% rename from src/test/compiletest/common.rs rename to src/compiletest/common.rs diff --git a/src/test/compiletest/compiletest.rc b/src/compiletest/compiletest.rc similarity index 100% rename from src/test/compiletest/compiletest.rc rename to src/compiletest/compiletest.rc diff --git a/src/test/compiletest/compiletest.rs b/src/compiletest/compiletest.rs similarity index 100% rename from src/test/compiletest/compiletest.rs rename to src/compiletest/compiletest.rs diff --git a/src/test/compiletest/header.rs b/src/compiletest/header.rs similarity index 100% rename from src/test/compiletest/header.rs rename to src/compiletest/header.rs diff --git a/src/test/compiletest/procsrv.rs b/src/compiletest/procsrv.rs similarity index 100% rename from src/test/compiletest/procsrv.rs rename to src/compiletest/procsrv.rs diff --git a/src/test/compiletest/runtest.rs b/src/compiletest/runtest.rs similarity index 100% rename from src/test/compiletest/runtest.rs rename to src/compiletest/runtest.rs diff --git a/src/test/compiletest/util.rs b/src/compiletest/util.rs similarity index 100% rename from src/test/compiletest/util.rs rename to src/compiletest/util.rs