Skip to content

Commit 090dac0

Browse files
committed
Auto merge of #81734 - richkadel:fixfordash, r=pnkfelix
Ensures `make` tests run under /bin/dash (if available), like CI, and fixes a Makefile Note: This cherrypicks #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`
2 parents 42a4673 + cbe6c70 commit 090dac0

File tree

5 files changed

+21
-39
lines changed

5 files changed

+21
-39
lines changed

Diff for: src/test/run-make-fulldeps/coverage-reports/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# ignore-test Broken; accidentally silently ignored on Linux CI; FIXME(#81688)
21
# needs-profiler-support
32
# ignore-windows-gnu
43
# min-llvm-version: 11.0
@@ -128,7 +127,7 @@ endif
128127
$$( \
129128
for file in $(TMPDIR)/rustdoc-$@/*/rust_out; \
130129
do \
131-
[[ -x $$file ]] && printf "%s %s " -object $$file; \
130+
[ -x "$$file" ] && printf "%s %s " -object $$file; \
132131
done \
133132
) \
134133
2> "$(TMPDIR)"/[email protected] \

Diff for: src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.partial_eq.txt

+3-18
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
2| |// structure of this test.
33
3| |
44
4| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
5-
^0 ^0 ^0 ^0 ^1 ^0 ^0^0
5+
^0 ^0 ^0 ^0 ^1 ^1 ^0^0
66
5| |pub struct Version {
77
6| | major: usize,
8-
7| 1| minor: usize, // Count: 1 - `PartialOrd` compared `minor` values in 3.2.1 vs. 3.3.0
9-
8| 0| patch: usize, // Count: 0 - `PartialOrd` was determined by `minor` (2 < 3)
8+
7| | minor: usize,
9+
8| | patch: usize,
1010
9| |}
1111
10| |
1212
11| |impl Version {
@@ -45,19 +45,4 @@
4545
44| |`function_source_hash` without a code region, if necessary.
4646
45| |
4747
46| |*/
48-
47| |
49-
48| |// FIXME(#79626): The derived traits get coverage, which is great, but some of the traits appear
50-
49| |// to get two coverage execution counts at different positions:
51-
50| |//
52-
51| |// ```text
53-
52| |// 4| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
54-
53| |// ^0 ^0 ^0 ^0 ^1 ^0 ^0^0
55-
54| |// ```text
56-
55| |//
57-
56| |// `PartialEq`, `PartialOrd`, and `Ord` (and possibly `Eq`, if the trait name was longer than 2
58-
57| |// characters) have counts at their first and last characters.
59-
58| |//
60-
59| |// Why is this? Why does `PartialOrd` have two values (1 and 0)? This must mean we are checking
61-
60| |// distinct coverages, so maybe we don't want to eliminate one of them. Should we merge them?
62-
61| |// If merged, do we lose some information?
6348

Diff for: src/test/run-make-fulldeps/coverage/coverage_tools.mk

-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,3 @@
1212
# Enabling `-C link-dead-code` is not necessary when compiling with `-Z instrument-coverage`,
1313
# due to improvements in the coverage map generation, to add unreachable functions known to Rust.
1414
# Therefore, `-C link-dead-code` is no longer automatically enabled.
15-
16-
UNAME = $(shell uname)

Diff for: src/test/run-make-fulldeps/coverage/partial_eq.rs

+2-17
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
55
pub struct Version {
66
major: usize,
7-
minor: usize, // Count: 1 - `PartialOrd` compared `minor` values in 3.2.1 vs. 3.3.0
8-
patch: usize, // Count: 0 - `PartialOrd` was determined by `minor` (2 < 3)
7+
minor: usize,
8+
patch: usize,
99
}
1010

1111
impl Version {
@@ -44,18 +44,3 @@ one expression, which is allowed, but the `function_source_hash` was only passed
4444
`function_source_hash` without a code region, if necessary.
4545
4646
*/
47-
48-
// FIXME(#79626): The derived traits get coverage, which is great, but some of the traits appear
49-
// to get two coverage execution counts at different positions:
50-
//
51-
// ```text
52-
// 4| 2|#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
53-
// ^0 ^0 ^0 ^0 ^1 ^0 ^0^0
54-
// ```text
55-
//
56-
// `PartialEq`, `PartialOrd`, and `Ord` (and possibly `Eq`, if the trait name was longer than 2
57-
// characters) have counts at their first and last characters.
58-
//
59-
// Why is this? Why does `PartialOrd` have two values (1 and 0)? This must mean we are checking
60-
// distinct coverages, so maybe we don't want to eliminate one of them. Should we merge them?
61-
// If merged, do we lose some information?

Diff for: src/test/run-make-fulldeps/tools.mk

+15
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@ CGREP := "$(S)/src/etc/cat-and-grep.sh"
2121
# diff with common flags for multi-platform diffs against text output
2222
DIFF := diff -u --strip-trailing-cr
2323

24+
# Some of the Rust CI platforms use `/bin/dash` to run `shell` script in
25+
# Makefiles. Other platforms, including many developer platforms, default to
26+
# `/bin/bash`. (In many cases, `make` is actually using `/bin/sh`, but `sh`
27+
# is configured to execute one or the other shell binary). `dash` features
28+
# support only a small subset of `bash` features, so `dash` can be thought of as
29+
# the lowest common denominator, and tests should be validated against `dash`
30+
# whenever possible. Most developer platforms include `/bin/dash`, but to ensure
31+
# tests still work when `/bin/dash`, if not available, this `SHELL` override is
32+
# conditional:
33+
ifndef IS_WINDOWS # dash interprets backslashes in executable paths incorrectly
34+
ifneq (,$(wildcard /bin/dash))
35+
SHELL := /bin/dash
36+
endif
37+
endif
38+
2439
# This is the name of the binary we will generate and run; use this
2540
# e.g. for `$(CC) -o $(RUN_BINFILE)`.
2641
RUN_BINFILE = $(TMPDIR)/$(1)

0 commit comments

Comments
 (0)