Skip to content

Commit

Permalink
Temporary revert all tests workarounds and run tests with gnu host
Browse files Browse the repository at this point in the history
  • Loading branch information
mati865 committed Mar 8, 2019
1 parent bba272d commit 2bcebde
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 54 deletions.
7 changes: 1 addition & 6 deletions src/bootstrap/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1636,9 +1636,8 @@ impl Step for Crate {
// libstd, then what we're actually testing is the libstd produced in
// stage1. Reflect that here by updating the compiler that we're working
// with automatically.
// FIXME(mati865): do similar for the other branch if this is correct
let compiler = if builder.force_use_stage1(compiler, target) {
builder.compiler(1, builder.config.build)
builder.compiler(1, compiler.host)
} else {
compiler.clone()
};
Expand Down Expand Up @@ -1803,10 +1802,6 @@ impl Step for CrateRustdoc {
cargo.arg("--");
cargo.args(&builder.config.cmd.test_args());

if target.contains("musl") {
cargo.arg("'-Ctarget-feature=-crt-static'");
}

if !builder.config.verbose_tests {
cargo.arg("--quiet");
}
Expand Down
4 changes: 3 additions & 1 deletion src/ci/docker/dist-x86_64-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ ENV HOSTS=x86_64-unknown-linux-musl \

ENV RUSTFLAGS="-C target-feature=-crt-static"

ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS
ENV SCRIPT \
python2.7 ../x.py test --target $HOSTS && \
python2.7 ../x.py dist --host $HOSTS --target $HOSTS
3 changes: 1 addition & 2 deletions src/test/run-make-fulldeps/link-cfg/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

all: $(call DYLIB,return1) $(call DYLIB,return2) $(call NATIVE_STATICLIB,return3)
ls $(TMPDIR)

$(BARE_RUSTC) --print cfg --target x86_64-unknown-linux-musl | $(CGREP) crt-static
$(RUSTC) --print cfg --target x86_64-unknown-linux-musl | $(CGREP) crt-static

$(RUSTC) no-deps.rs --cfg foo
$(call RUN,no-deps)
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-make-fulldeps/linker-output-non-utf8/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ all:
$(RUSTC) library.rs
mkdir $(bad_dir)
mv $(TMPDIR)/liblibrary.a $(bad_dir)
$(RUSTC) -L $(bad_dir) exec.rs 2>&1 | $(CGREP) this_symbol_not_defined
LIBRARY_PATH=$(bad_dir) $(RUSTC) exec.rs 2>&1 | $(CGREP) this_symbol_not_defined
7 changes: 0 additions & 7 deletions src/test/run-make-fulldeps/reproducible-build/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
-include ../tools.mk

# ignore-musl
#
# diff:
# -/checkout/obj/build/x86_64-unknown-linux-musl/test/run-make-fulldeps/reproducible-build/reproducible-build/rustcORhwur/libunwind-cfdf9e23c318976b.rlib: 6220632559893696134
# +/checkout/obj/build/x86_64-unknown-linux-musl/test/run-make-fulldeps/reproducible-build/reproducible-build/rustcMaw0kI/libunwind-cfdf9e23c318976b.rlib: 6220632559893696134

all: \
smoke \
debug \
Expand Down
6 changes: 1 addition & 5 deletions src/test/run-make/rustc-macro-dep-files/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# FIXME(eddyb) provide `HOST_RUSTC` and `TARGET_RUSTC`
# instead of hardcoding them everywhere they're needed.
all:
ifeq ($(IS_MUSL_HOST),1)
$(BARE_RUSTC) $(RUSTFLAGS) -Clinker=$(RUSTC_LINKER) foo.rs --out-dir $(TMPDIR)
else
$(BARE_RUSTC) foo.rs --out-dir $(TMPDIR)
endif
$(BARE_RUSTC) foo.rs --out-dir $(TMPDIR)
$(RUSTC) bar.rs --target $(TARGET) --emit dep-info
$(CGREP) -v "proc-macro source" < $(TMPDIR)/bar.d
39 changes: 7 additions & 32 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1602,15 +1602,18 @@ impl<'test> TestCx<'test> {
None
} else if self.config.target.contains("cloudabi")
|| self.config.target.contains("emscripten")
|| (self.config.target.contains("musl") && !aux_props.force_host)
|| self.config.target.contains("wasm32")
{
// We primarily compile all auxiliary libraries as dynamic libraries
// to avoid code size bloat and large binaries as much as possible
// for the test suite (otherwise including libstd statically in all
// executables takes up quite a bit of space).
//
// For targets like Emscripten, however, there is no support for
// dynamic libraries so we just go back to building a normal library.
// For targets like MUSL or Emscripten, however, there is no support for
// dynamic libraries so we just go back to building a normal library. Note,
// however, that for MUSL if the library is built with `force_host` then
// it's ok to be a dylib as the host should always support dylibs.
Some("lib")
} else {
Some("dylib")
Expand Down Expand Up @@ -1842,36 +1845,19 @@ impl<'test> TestCx<'test> {
None => {}
}

// Musl toolchain is build on linux-gnu host
// but with proper setup it can behave almost* like native linux-musl.
// One difference is "cc" which will link to glibc; force musl cc.
if self.props.force_host {
self.maybe_add_external_args(&mut rustc,
self.split_maybe_args(&self.config.host_rustcflags));
if self.config.target.contains("musl") {
if let Some(ref linker) = self.config.linker {
rustc.arg(format!("-Clinker={}", linker));
}
}
} else {
self.maybe_add_external_args(&mut rustc,
self.split_maybe_args(&self.config.target_rustcflags));
if !is_rustdoc {
if let Some(ref linker) = self.config.linker {
rustc.arg(format!("-Clinker={}", linker));
}
} else if self.config.target.contains("musl") {
if let Some(ref linker) = self.config.linker {
rustc.arg(format!("--linker={}", linker));
}
}
}

// Use dynamic musl for tests because static doesn't allow creating dylibs
if self.config.target.contains("musl") {
rustc.arg("-Ctarget-feature=-crt-static");
}

rustc.args(&self.props.compile_flags);

rustc
Expand Down Expand Up @@ -2655,12 +2641,6 @@ impl<'test> TestCx<'test> {
// compiler flags set in the test cases:
cmd.env_remove("RUSTFLAGS");

// Use dynamic musl for tests because static doesn't allow creating dylibs
if self.config.target.contains("musl") {
cmd.env("RUSTFLAGS", "-Ctarget-feature=-crt-static")
.env("IS_MUSL_HOST", "1");
}

if self.config.target.contains("msvc") && self.config.cc != "" {
// We need to pass a path to `lib.exe`, so assume that `cc` is `cl.exe`
// and that `lib.exe` lives next to it.
Expand All @@ -2683,13 +2663,8 @@ impl<'test> TestCx<'test> {
.env("CC", format!("'{}' {}", self.config.cc, cflags))
.env("CXX", format!("'{}'", &self.config.cxx));
} else {
let cflags = if self.config.target.contains("musl") {
self.config.cflags.replace("-static", "")
} else {
self.config.cflags.to_string()
};
cmd.env("CC", format!("{} {}", self.config.cc, cflags))
.env("CXX", format!("{} {}", self.config.cxx, cflags))
cmd.env("CC", format!("{} {}", self.config.cc, self.config.cflags))
.env("CXX", format!("{} {}", self.config.cxx, self.config.cflags))
.env("AR", &self.config.ar);

if self.config.target.contains("windows") {
Expand Down

0 comments on commit 2bcebde

Please sign in to comment.