From 01f5a2a81d02f42d4ea277772d0752e80f8d32d1 Mon Sep 17 00:00:00 2001 From: Rich Kadel Date: Wed, 3 Feb 2021 16:26:25 -0800 Subject: [PATCH] Ensures `make` tests run under /bin/dash, like CI, and fixes a Makefile 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`. --- src/test/run-make-fulldeps/coverage-reports/Makefile | 3 +-- src/test/run-make-fulldeps/coverage/coverage_tools.mk | 2 -- src/test/run-make-fulldeps/tools.mk | 6 ++++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/test/run-make-fulldeps/coverage-reports/Makefile b/src/test/run-make-fulldeps/coverage-reports/Makefile index a700cf68cd9..31583eaa8fe 100644 --- a/src/test/run-make-fulldeps/coverage-reports/Makefile +++ b/src/test/run-make-fulldeps/coverage-reports/Makefile @@ -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 @@ -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)"/show_coverage_stderr.$@.txt \ diff --git a/src/test/run-make-fulldeps/coverage/coverage_tools.mk b/src/test/run-make-fulldeps/coverage/coverage_tools.mk index 11fd824e527..38643aaf902 100644 --- a/src/test/run-make-fulldeps/coverage/coverage_tools.mk +++ b/src/test/run-make-fulldeps/coverage/coverage_tools.mk @@ -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) diff --git a/src/test/run-make-fulldeps/tools.mk b/src/test/run-make-fulldeps/tools.mk index 634c9ece3f5..29ca30a7cd8 100644 --- a/src/test/run-make-fulldeps/tools.mk +++ b/src/test/run-make-fulldeps/tools.mk @@ -21,6 +21,12 @@ 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 +# CI platforms use `/bin/dash`. When compiling in other environments, the +# default may be different (for example, may default to `/bin/bash`), and syntax +# and results could be different. Ensure Makefile `$(shell ...)` invocations +# always run in `dash`. +SHELL := /bin/dash + # 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)