Skip to content

Commit

Permalink
Rollup merge of rust-lang#81734 - richkadel:fixfordash, r=pnkfelix
Browse files Browse the repository at this point in the history
Ensures `make` tests run under /bin/dash (if available), like CI, and fixes a Makefile

Note: This cherrypicks rust-lang#81688 (``@pnkfelix)``

Updates `tools.mk` to explicitly require `SHELL := /bin/dash`, since CI uses `dash` but other environments (including developer local machines) may default to `bash`.

Replaces bash-specific shell command in one Makefile with a dash-compatible alternative, and re-enables the affected Makefile test.

Removes apparently redundant definition of `UNAME`.

Also see: [zulip discussion thread](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/how.20to.20run.2Fbless.20src.2Ftest.2Frun-make-fulldeps.2Fcoverage.20.3F)

r? ``@pnkfelix``

FYI: ``@wesleywiser`` ``@tmandry``
  • Loading branch information
JohnTitor committed Feb 11, 2021
2 parents e1f0108 + ca3a714 commit 3a1c146
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/test/run-make-fulldeps/coverage-reports/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# ignore-test Broken; accidentally silently ignored on Linux CI; FIXME(#81688)
# needs-profiler-support
# ignore-windows-gnu
# min-llvm-version: 11.0
Expand Down Expand Up @@ -128,7 +127,7 @@ endif
$$( \
for file in $(TMPDIR)/rustdoc-$@/*/rust_out; \
do \
[[ -x $$file ]] && printf "%s %s " -object $$file; \
[ -x "$$file" ] && printf "%s %s " -object $$file; \
done \
) \
2> "$(TMPDIR)"/[email protected] \
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-make-fulldeps/coverage/coverage_tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@
# Enabling `-C link-dead-code` is not necessary when compiling with `-Z instrument-coverage`,
# due to improvements in the coverage map generation, to add unreachable functions known to Rust.
# Therefore, `-C link-dead-code` is no longer automatically enabled.

UNAME = $(shell uname)
13 changes: 13 additions & 0 deletions src/test/run-make-fulldeps/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ CGREP := "$(S)/src/etc/cat-and-grep.sh"
# diff with common flags for multi-platform diffs against text output
DIFF := diff -u --strip-trailing-cr

# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in
# Makefiles. Other platforms, including many developer platforms, default to
# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh`
# is configured to execute one or the other shell binary). `dash` features
# support only a small subset of `bash` features, so `dash` can be thought of as
# the lowest common denominator, and tests should be validated against `dash`
# whenever possible. Most developer platforms include `/bin/dash`, but to ensure
# tests still work when `/bin/dash`, if not available, this `SHELL` override is
# conditional:
ifneq (,$(wildcard /bin/dash))
SHELL := /bin/dash
endif

# This is the name of the binary we will generate and run; use this
# e.g. for `$(CC) -o $(RUN_BINFILE)`.
RUN_BINFILE = $(TMPDIR)/$(1)
Expand Down

0 comments on commit 3a1c146

Please sign in to comment.