Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Move run-make tests into compiletest #33093

Merged
merged 1 commit into from
Apr 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions mk/cfg/i586-pc-windows-msvc.mk
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# i586-pc-windows-msvc configuration
CC_i586-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
LINK_i586-pc-windows-msvc="$(CFG_MSVC_LINK_i386)" -nologo
CXX_i586-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
CPP_i586-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
AR_i586-pc-windows-msvc="$(CFG_MSVC_LIB_i386)" -nologo
CC_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386)
LINK_i586-pc-windows-msvc=$(CFG_MSVC_LINK_i386)
CXX_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386)
CPP_i586-pc-windows-msvc=$(CFG_MSVC_CL_i386)
AR_i586-pc-windows-msvc=$(CFG_MSVC_LIB_i386)
CFG_LIB_NAME_i586-pc-windows-msvc=$(1).dll
CFG_STATIC_LIB_NAME_i586-pc-windows-msvc=$(1).lib
CFG_LIB_GLOB_i586-pc-windows-msvc=$(1)-*.{dll,lib}
CFG_LIB_DSYM_GLOB_i586-pc-windows-msvc=$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_i586-pc-windows-msvc :=
CFG_GCCISH_CFLAGS_i586-pc-windows-msvc := -MD -arch:IA32
CFG_GCCISH_CXXFLAGS_i586-pc-windows-msvc := -MD -arch:IA32
CFG_GCCISH_CFLAGS_i586-pc-windows-msvc := -MD -arch:IA32 -nologo
CFG_GCCISH_CXXFLAGS_i586-pc-windows-msvc := -MD -arch:IA32 -nologo
CFG_GCCISH_LINK_FLAGS_i586-pc-windows-msvc :=
CFG_GCCISH_DEF_FLAG_i586-pc-windows-msvc :=
CFG_LLC_FLAGS_i586-pc-windows-msvc :=
Expand Down
14 changes: 7 additions & 7 deletions mk/cfg/i686-pc-windows-msvc.mk
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# i686-pc-windows-msvc configuration
CC_i686-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
LINK_i686-pc-windows-msvc="$(CFG_MSVC_LINK_i386)" -nologo
CXX_i686-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
CPP_i686-pc-windows-msvc="$(CFG_MSVC_CL_i386)" -nologo
AR_i686-pc-windows-msvc="$(CFG_MSVC_LIB_i386)" -nologo
CC_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386)
LINK_i686-pc-windows-msvc=$(CFG_MSVC_LINK_i386)
CXX_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386)
CPP_i686-pc-windows-msvc=$(CFG_MSVC_CL_i386)
AR_i686-pc-windows-msvc=$(CFG_MSVC_LIB_i386)
CFG_LIB_NAME_i686-pc-windows-msvc=$(1).dll
CFG_STATIC_LIB_NAME_i686-pc-windows-msvc=$(1).lib
CFG_LIB_GLOB_i686-pc-windows-msvc=$(1)-*.{dll,lib}
CFG_LIB_DSYM_GLOB_i686-pc-windows-msvc=$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_i686-pc-windows-msvc :=
CFG_GCCISH_CFLAGS_i686-pc-windows-msvc := -MD
CFG_GCCISH_CXXFLAGS_i686-pc-windows-msvc := -MD
CFG_GCCISH_CFLAGS_i686-pc-windows-msvc := -MD -nologo
CFG_GCCISH_CXXFLAGS_i686-pc-windows-msvc := -MD -nologo
CFG_GCCISH_LINK_FLAGS_i686-pc-windows-msvc :=
CFG_GCCISH_DEF_FLAG_i686-pc-windows-msvc :=
CFG_LLC_FLAGS_i686-pc-windows-msvc :=
Expand Down
14 changes: 7 additions & 7 deletions mk/cfg/x86_64-pc-windows-msvc.mk
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# x86_64-pc-windows-msvc configuration
CC_x86_64-pc-windows-msvc="$(CFG_MSVC_CL_x86_64)" -nologo
LINK_x86_64-pc-windows-msvc="$(CFG_MSVC_LINK_x86_64)" -nologo
CXX_x86_64-pc-windows-msvc="$(CFG_MSVC_CL_x86_64)" -nologo
CPP_x86_64-pc-windows-msvc="$(CFG_MSVC_CL_x86_64)" -nologo
AR_x86_64-pc-windows-msvc="$(CFG_MSVC_LIB_x86_64)" -nologo
CC_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64)
LINK_x86_64-pc-windows-msvc=$(CFG_MSVC_LINK_x86_64)
CXX_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64)
CPP_x86_64-pc-windows-msvc=$(CFG_MSVC_CL_x86_64)
AR_x86_64-pc-windows-msvc=$(CFG_MSVC_LIB_x86_64)
CFG_LIB_NAME_x86_64-pc-windows-msvc=$(1).dll
CFG_STATIC_LIB_NAME_x86_64-pc-windows-msvc=$(1).lib
CFG_LIB_GLOB_x86_64-pc-windows-msvc=$(1)-*.{dll,lib}
CFG_LIB_DSYM_GLOB_x86_64-pc-windows-msvc=$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_x86_64-pc-windows-msvc :=
CFG_GCCISH_CFLAGS_x86_64-pc-windows-msvc := -MD
CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-msvc := -MD
CFG_GCCISH_CFLAGS_x86_64-pc-windows-msvc := -MD -nologo
CFG_GCCISH_CXXFLAGS_x86_64-pc-windows-msvc := -MD -nologo
CFG_GCCISH_LINK_FLAGS_x86_64-pc-windows-msvc :=
CFG_GCCISH_DEF_FLAG_x86_64-pc-windows-msvc :=
CFG_LLC_FLAGS_x86_64-pc-windows-msvc :=
Expand Down
6 changes: 3 additions & 3 deletions mk/platform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ define CC_MACROS
CFG_CC_INCLUDE_$(1)=-I $$(1)
ifeq ($$(findstring msvc,$(1)),msvc)
CFG_CC_OUTPUT_$(1)=-Fo:$$(1)
CFG_CREATE_ARCHIVE_$(1)=$$(AR_$(1)) -OUT:$$(1)
CFG_CREATE_ARCHIVE_$(1)='$$(AR_$(1))' -OUT:$$(1)
else
CFG_CC_OUTPUT_$(1)=-o $$(1)
CFG_CREATE_ARCHIVE_$(1)=$$(AR_$(1)) crus $$(1)
Expand Down Expand Up @@ -187,7 +187,7 @@ define CFG_MAKE_TOOLCHAIN
endif
endif

CFG_COMPILE_C_$(1) = $$(CC_$(1)) \
CFG_COMPILE_C_$(1) = '$$(CC_$(1))' \
$$(CFLAGS) \
$$(CFG_GCCISH_CFLAGS) \
$$(CFG_GCCISH_CFLAGS_$(1)) \
Expand All @@ -198,7 +198,7 @@ define CFG_MAKE_TOOLCHAIN
$$(CFG_GCCISH_LINK_FLAGS_$(1)) \
$$(CFG_GCCISH_DEF_FLAG_$(1))$$(3) $$(2) \
$$(call CFG_INSTALL_NAME_$(1),$$(4))
CFG_COMPILE_CXX_$(1) = $$(CXX_$(1)) \
CFG_COMPILE_CXX_$(1) = '$$(CXX_$(1))' \
$$(CXXFLAGS) \
$$(CFG_GCCISH_CFLAGS) \
$$(CFG_GCCISH_CXXFLAGS) \
Expand Down
89 changes: 21 additions & 68 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ CODEGEN_RS := $(call rwildcard,$(S)src/test/codegen/,*.rs)
CODEGEN_CC := $(call rwildcard,$(S)src/test/codegen/,*.cc)
CODEGEN_UNITS_RS := $(call rwildcard,$(S)src/test/codegen-units/,*.rs)
INCREMENTAL_RS := $(call rwildcard,$(S)src/test/incremental/,*.rs)
RMAKE_RS := $(wildcard $(S)src/test/run-make/*/Makefile)
RUSTDOCCK_RS := $(call rwildcard,$(S)src/test/rustdoc/,*.rs)

RPASS_TESTS := $(RPASS_RS)
Expand All @@ -466,6 +467,7 @@ DEBUGINFO_LLDB_TESTS := $(DEBUGINFO_LLDB_RS)
CODEGEN_TESTS := $(CODEGEN_RS) $(CODEGEN_CC)
CODEGEN_UNITS_TESTS := $(CODEGEN_UNITS_RS)
INCREMENTAL_TESTS := $(INCREMENTAL_RS)
RMAKE_TESTS := $(RMAKE_RS)
RUSTDOCCK_TESTS := $(RUSTDOCCK_RS)

CTEST_SRC_BASE_rpass = run-pass
Expand Down Expand Up @@ -533,6 +535,11 @@ CTEST_BUILD_BASE_incremental = incremental
CTEST_MODE_incremental = incremental
CTEST_RUNTOOL_incremental = $(CTEST_RUNTOOL)

CTEST_SRC_BASE_rmake = run-make
CTEST_BUILD_BASE_rmake = run-make
CTEST_MODE_rmake = run-make
CTEST_RUNTOOL_rmake = $(CTEST_RUNTOOL)

CTEST_SRC_BASE_rustdocck = rustdoc
CTEST_BUILD_BASE_rustdocck = rustdoc
CTEST_MODE_rustdocck = rustdoc
Expand Down Expand Up @@ -629,6 +636,11 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
--host-rustcflags "$(RUSTC_FLAGS_$(3)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(3))" \
--lldb-python-dir=$(CFG_LLDB_PYTHON_DIR) \
--target-rustcflags "$(RUSTC_FLAGS_$(2)) $$(CTEST_RUSTC_FLAGS) -L $$(RT_OUTPUT_DIR_$(2))" \
--cc '$$(CC_$(3))' \
--cxx '$$(CXX_$(3))' \
--cflags "$$(CFG_GCCISH_CFLAGS_$(3))" \
--llvm-components "$$(LLVM_ALL_COMPONENTS_$(3))" \
--llvm-cxxflags "$$(LLVM_CXXFLAGS_$(3))" \
$$(CTEST_TESTARGS)

ifdef CFG_VALGRIND_RPASS
Expand Down Expand Up @@ -658,6 +670,9 @@ CTEST_DEPS_debuginfo-lldb_$(1)-T-$(2)-H-$(3) = $$(DEBUGINFO_LLDB_TESTS) \
CTEST_DEPS_codegen_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_TESTS)
CTEST_DEPS_codegen-units_$(1)-T-$(2)-H-$(3) = $$(CODEGEN_UNITS_TESTS)
CTEST_DEPS_incremental_$(1)-T-$(2)-H-$(3) = $$(INCREMENTAL_TESTS)
CTEST_DEPS_rmake_$(1)-T-$(2)-H-$(3) = $$(RMAKE_TESTS) \
$$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))

CTEST_DEPS_rustdocck_$(1)-T-$(2)-H-$(3) = $$(RUSTDOCCK_TESTS) \
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
$(S)src/etc/htmldocck.py
Expand Down Expand Up @@ -702,6 +717,10 @@ endif
endif

ifeq ($$(CTEST_DONT_RUN_$(1)-T-$(2)-H-$(3)-$(4)),)
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3)))
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
$$(call TEST_OK_FILE,$(1),$(2),$(3),$(4)): \
$$(TEST_SREQ$(1)_T_$(2)_H_$(3)) \
$$(CTEST_DEPS_$(4)_$(1)-T-$(2)-H-$(3))
Expand All @@ -724,7 +743,8 @@ endif
endef

CTEST_NAMES = rpass rpass-valgrind rpass-full rfail-full cfail-full rfail cfail pfail \
debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck incremental
debuginfo-gdb debuginfo-lldb codegen codegen-units rustdocck incremental \
rmake

$(foreach host,$(CFG_HOST), \
$(eval $(foreach target,$(CFG_TARGET), \
Expand Down Expand Up @@ -1009,70 +1029,3 @@ endef

$(foreach crate,$(TEST_CRATES), \
$(eval $(call DEF_CHECK_CRATE,$(crate))))

######################################################################
# RMAKE rules
######################################################################

RMAKE_TESTS := $(shell ls -d $(S)src/test/run-make/*/)
RMAKE_TESTS := $(RMAKE_TESTS:$(S)src/test/run-make/%/=%)

define DEF_RMAKE_FOR_T_H
# $(1) the stage
# $(2) target triple
# $(3) host triple


ifeq ($(2)$(3),$$(CFG_BUILD)$$(CFG_BUILD))
check-stage$(1)-T-$(2)-H-$(3)-rmake-exec: \
$$(call TEST_OK_FILE,$(1),$(2),$(3),rmake)

$$(call TEST_OK_FILE,$(1),$(2),$(3),rmake): \
$$(RMAKE_TESTS:%=$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok)
@touch $$@

$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
export INCLUDE := $$(CFG_MSVC_INCLUDE_PATH_$$(HOST_$(3)))
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
export LIB := $$(CFG_MSVC_LIB_PATH_$$(HOST_$(3)))
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
export MSVC_LIB := "$$(CFG_MSVC_LIB_$$(HOST_$(3)))"
$(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
$(S)src/test/run-make/%/Makefile \
$$(CSREQ$(1)_T_$(2)_H_$(3))
@rm -rf $(3)/test/run-make/$$*
@mkdir -p $(3)/test/run-make/$$*
$$(Q)touch [email protected]_time
$$(Q)$$(CFG_PYTHON) $(S)src/etc/maketest.py $$(dir $$<) \
$$(MAKE) \
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
$(3)/test/run-make/$$* \
'$$(CC_$(3))' \
"$$(CFG_GCCISH_CFLAGS_$(3))" \
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
"$$(TESTNAME)" \
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3)) \
"$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3))" \
"$$(LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3))" \
$(1) \
$$(S) \
$(3) \
"$$(LLVM_LIBDIR_RUSTFLAGS_$(3))" \
"$$(LLVM_ALL_COMPONENTS_$(3))" \
"$$(LLVM_CXXFLAGS_$(3))" \
'$$(CXX_$(3))'
@touch -r [email protected]_time $$@ && rm [email protected]_time
else
# FIXME #11094 - The above rule doesn't work right for multiple targets
check-stage$(1)-T-$(2)-H-$(3)-rmake-exec:
@true

endif


endef

$(foreach stage,$(STAGES), \
$(foreach target,$(CFG_TARGET), \
$(foreach host,$(CFG_HOST), \
$(eval $(call DEF_RMAKE_FOR_T_H,$(stage),$(target),$(host))))))
29 changes: 29 additions & 0 deletions src/bootstrap/build/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use std::fs;
use std::path::{PathBuf, Path};
use std::process::Command;

use build_helper::output;

use build::{Build, Compiler};

pub fn linkcheck(build: &Build, stage: u32, host: &str) {
Expand Down Expand Up @@ -112,6 +114,33 @@ pub fn compiletest(build: &Build,
cmd.arg("--verbose");
}

if suite == "run-make" {
let llvm_config = build.llvm_config(target);
let llvm_components = output(Command::new(&llvm_config).arg("--components"));
let llvm_cxxflags = output(Command::new(&llvm_config).arg("--cxxflags"));
cmd.arg("--cc").arg(build.cc(target))
.arg("--cxx").arg(build.cxx(target))
.arg("--cflags").arg(build.cflags(target).join(" "))
.arg("--llvm-components").arg(llvm_components.trim())
.arg("--llvm-cxxflags").arg(llvm_cxxflags.trim());
} else {
cmd.arg("--cc").arg("")
.arg("--cxx").arg("")
.arg("--cflags").arg("")
.arg("--llvm-components").arg("")
.arg("--llvm-cxxflags").arg("");
}

// Running a C compiler on MSVC requires a few env vars to be set, to be
// sure to set them here.
if target.contains("msvc") {
for &(ref k, ref v) in build.cc[target].0.env() {
if k != "PATH" {
cmd.env(k, v);
}
}
}

build.run(&mut cmd);
}

Expand Down
4 changes: 4 additions & 0 deletions src/bootstrap/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ impl Build {
CheckErrorIndex { compiler } => {
check::error_index(self, &compiler);
}
CheckRMake { compiler } => {
check::compiletest(self, &compiler, target.target,
"run-make", "run-make")
}

DistDocs { stage } => dist::docs(self, stage, target.target),
DistMingw { _dummy } => dist::mingw(self, target.target),
Expand Down
5 changes: 4 additions & 1 deletion src/bootstrap/build/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ macro_rules! targets {
(check_cfail_full, CheckCFailFull { compiler: Compiler<'a> }),
(check_docs, CheckDocs { compiler: Compiler<'a> }),
(check_error_index, CheckErrorIndex { compiler: Compiler<'a> }),
(check_rmake, CheckRMake { compiler: Compiler<'a> }),

// Distribution targets, creating tarballs
(dist, Dist { stage: u32 }),
Expand Down Expand Up @@ -345,6 +346,7 @@ impl<'a> Step<'a> {
self.check_cfail_full(compiler),
self.check_error_index(compiler),
self.check_docs(compiler),
self.check_rmake(compiler),
self.check_linkcheck(stage),
self.check_tidy(stage),
self.dist(stage),
Expand Down Expand Up @@ -384,7 +386,8 @@ impl<'a> Step<'a> {
]
}
Source::CheckRPassFull { compiler } |
Source::CheckCFailFull { compiler } => {
Source::CheckCFailFull { compiler } |
Source::CheckRMake { compiler } => {
vec![self.librustc(compiler),
self.tool_compiletest(compiler.stage)]
}
Expand Down
Loading