Skip to content

Commit 77ab3a1

Browse files
committed
Auto merge of #46207 - kennytm:kill-grep, r=alexcrichton
Replace most call to grep in run-make by a script that cat the input. Introduced a new `src/etc/cat-and-grep.sh` script (called in run-make as `$(CGREP)`), which prints the input and do a grep simultaneously. This is mainly used to debug spurious failures in run-make, such as the spurious error in #45810, as well as real errors such as #46126. (cc #40713) Some `grep` still remains, mainly the `grep -c` calls that count the number of matches and print the result to stdout.
2 parents 73bca2b + 918158d commit 77ab3a1

File tree

47 files changed

+244
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+244
-120
lines changed

src/etc/cat-and-grep.sh

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
5+
# file at the top-level directory of this distribution and at
6+
# http://rust-lang.org/COPYRIGHT.
7+
#
8+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
9+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
10+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
11+
# option. This file may not be copied, modified, or distributed
12+
# except according to those terms.
13+
14+
# Performs `cat` and `grep` simultaneously for `run-make` tests in the Rust CI.
15+
#
16+
# This program will read lines from stdin and print them to stdout immediately.
17+
# At the same time, it will check if the input line contains the substring or
18+
# regex specified in the command line. If any match is found, the program will
19+
# set the exit code to 0, otherwise 1.
20+
#
21+
# This is written to simplify debugging runmake tests. Since `grep` swallows all
22+
# output, when a test involving `grep` failed, it is impossible to know the
23+
# reason just by reading the failure log. While it is possible to `tee` the
24+
# output into another stream, it becomes pretty annoying to do this for all test
25+
# cases.
26+
27+
USAGE='
28+
cat-and-grep.sh [-v] [-e] [-i] s1 s2 s3 ... < input.txt
29+
30+
Prints the stdin, and exits successfully only if all of `sN` can be found in
31+
some lines of the input.
32+
33+
Options:
34+
-v Invert match, exits successfully only if all of `sN` cannot be found
35+
-e Regex search, search using extended Regex instead of fixed string
36+
-i Case insensitive search.
37+
'
38+
39+
GREPPER=fgrep
40+
INVERT=0
41+
GREPFLAGS='q'
42+
while getopts ':vieh' OPTION; do
43+
case "$OPTION" in
44+
v)
45+
INVERT=1
46+
ERROR_MSG='should not be found'
47+
;;
48+
i)
49+
GREPFLAGS="i$GREPFLAGS"
50+
;;
51+
e)
52+
GREPPER=egrep
53+
;;
54+
h)
55+
echo "$USAGE"
56+
exit 2
57+
;;
58+
*)
59+
break
60+
;;
61+
esac
62+
done
63+
64+
shift $((OPTIND - 1))
65+
66+
LOG=$(mktemp -t cgrep.XXXXXX)
67+
trap "rm -f $LOG" EXIT
68+
69+
printf "[[[ begin stdout ]]]\n\033[90m"
70+
tee "$LOG"
71+
echo >> "$LOG" # ensure at least 1 line of output, otherwise `grep -v` may unconditionally fail.
72+
printf "\033[0m\n[[[ end stdout ]]]\n"
73+
74+
HAS_ERROR=0
75+
for MATCH in "$@"; do
76+
if "$GREPPER" "-$GREPFLAGS" -- "$MATCH" "$LOG"; then
77+
if [ "$INVERT" = 1 ]; then
78+
printf "\033[1;31mError: should not match: %s\033[0m\n" "$MATCH"
79+
HAS_ERROR=1
80+
fi
81+
else
82+
if [ "$INVERT" = 0 ]; then
83+
printf "\033[1;31mError: cannot match: %s\033[0m\n" "$MATCH"
84+
HAS_ERROR=1
85+
fi
86+
fi
87+
done
88+
89+
exit "$HAS_ERROR"

src/test/run-make/atomic-lock-free/Makefile

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,36 @@ all:
77
ifeq ($(UNAME),Linux)
88
ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86)
99
$(RUSTC) --target=i686-unknown-linux-gnu atomic_lock_free.rs
10-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
10+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
1111
$(RUSTC) --target=x86_64-unknown-linux-gnu atomic_lock_free.rs
12-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
12+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
1313
endif
1414
ifeq ($(filter arm,$(LLVM_COMPONENTS)),arm)
1515
$(RUSTC) --target=arm-unknown-linux-gnueabi atomic_lock_free.rs
16-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
16+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
1717
$(RUSTC) --target=arm-unknown-linux-gnueabihf atomic_lock_free.rs
18-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
18+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
1919
$(RUSTC) --target=armv7-unknown-linux-gnueabihf atomic_lock_free.rs
20-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
20+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
2121
endif
2222
ifeq ($(filter aarch64,$(LLVM_COMPONENTS)),aarch64)
2323
$(RUSTC) --target=aarch64-unknown-linux-gnu atomic_lock_free.rs
24-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
24+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
2525
endif
2626
ifeq ($(filter mips,$(LLVM_COMPONENTS)),mips)
2727
$(RUSTC) --target=mips-unknown-linux-gnu atomic_lock_free.rs
28-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
28+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
2929
$(RUSTC) --target=mipsel-unknown-linux-gnu atomic_lock_free.rs
30-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
30+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
3131
endif
3232
ifeq ($(filter powerpc,$(LLVM_COMPONENTS)),powerpc)
3333
$(RUSTC) --target=powerpc-unknown-linux-gnu atomic_lock_free.rs
34-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
34+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
3535
$(RUSTC) --target=powerpc64-unknown-linux-gnu atomic_lock_free.rs
36-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
36+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
3737
$(RUSTC) --target=powerpc64le-unknown-linux-gnu atomic_lock_free.rs
38-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
38+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
3939
$(RUSTC) --target=s390x-unknown-linux-gnu atomic_lock_free.rs
40-
nm "$(TMPDIR)/libatomic_lock_free.rlib" | grep -vq __atomic_fetch_add
40+
nm "$(TMPDIR)/libatomic_lock_free.rlib" | $(CGREP) -v __atomic_fetch_add
4141
endif
4242
endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
-include ../tools.mk
2+
3+
all:
4+
echo a | $(CGREP) a
5+
! echo b | $(CGREP) a
6+
echo xyz | $(CGREP) x y z
7+
! echo abc | $(CGREP) b c d
8+
printf "x\ny\nz" | $(CGREP) x y z
9+
10+
echo AbCd | $(CGREP) -i a b C D
11+
! echo AbCd | $(CGREP) a b C D
12+
13+
true | $(CGREP) -v nothing
14+
! echo nothing | $(CGREP) -v nothing
15+
! echo xyz | $(CGREP) -v w x y
16+
! echo xyz | $(CGREP) -v x y z
17+
echo xyz | $(CGREP) -v a b c
18+
19+
! echo 'foo bar baz' | $(CGREP) 'foo baz'
20+
echo 'foo bar baz' | $(CGREP) foo baz
21+
echo 'x a `b` c y z' | $(CGREP) 'a `b` c'
22+
23+
echo baaac | $(CGREP) -e 'ba*c'
24+
echo bc | $(CGREP) -e 'ba*c'
25+
! echo aaac | $(CGREP) -e 'ba*c'
26+
27+
echo aaa | $(CGREP) -e 'a+'
28+
! echo bbb | $(CGREP) -e 'a+'
29+
30+
echo abc | $(CGREP) -e 'a|e|i|o|u'
31+
! echo fgh | $(CGREP) -e 'a|e|i|o|u'
32+
echo abc | $(CGREP) -e '[aeiou]'
33+
! echo fgh | $(CGREP) -e '[aeiou]'
34+
! echo abc | $(CGREP) -e '[^aeiou]{3}'
35+
echo fgh | $(CGREP) -e '[^aeiou]{3}'
36+
echo ab cd ef gh | $(CGREP) -e '\bcd\b'
37+
! echo abcdefgh | $(CGREP) -e '\bcd\b'
38+
echo xyz | $(CGREP) -e '...'
39+
! echo xy | $(CGREP) -e '...'
40+
! echo xyz | $(CGREP) -e '\.\.\.'
41+
echo ... | $(CGREP) -e '\.\.\.'
42+
43+
echo foo bar baz | $(CGREP) -e 'foo.*baz'
44+
! echo foo bar baz | $(CGREP) -ve 'foo.*baz'
45+
! echo foo bar baz | $(CGREP) -e 'baz.*foo'
46+
echo foo bar baz | $(CGREP) -ve 'baz.*foo'

src/test/run-make/cdylib-fewer-symbols/Makefile

+4-6
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33

44
-include ../tools.mk
55

6-
ifdef IS_MSVC
6+
# FIXME: The __rdl_ and __rust_ symbol still remains, no matter using MSVC or GNU
7+
# See https://github.com/rust-lang/rust/pull/46207#issuecomment-347561753
8+
ifdef IS_WINDOWS
79
all:
810
true
911
else
1012
all:
1113
$(RUSTC) foo.rs
12-
nm -g "$(call DYLIB,foo)"
13-
nm -g "$(call DYLIB,foo)" | grep -vq __rdl_
14-
nm -g "$(call DYLIB,foo)" | grep -vq __rde_
15-
nm -g "$(call DYLIB,foo)" | grep -vq __rg_
16-
nm -g "$(call DYLIB,foo)" | grep -vq __rust_
14+
nm -g "$(call DYLIB,foo)" | $(CGREP) -v __rdl_ __rde_ __rg_ __rust_
1715
endif
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,31 @@
11
-include ../tools.mk
22

3-
LOG = $(TMPDIR)/log.txt
4-
53
all:
64
#Option taking a number
7-
$(RUSTC) -C codegen-units dummy.rs 2>&1 | tee $(LOG)
8-
grep 'codegen option `codegen-units` requires a number' $(LOG)
9-
$(RUSTC) -C codegen-units= dummy.rs 2>&1 | tee $(LOG)
10-
grep 'incorrect value `` for codegen option `codegen-units` - a number was expected' $(LOG)
11-
$(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | tee $(LOG)
12-
grep 'incorrect value `foo` for codegen option `codegen-units` - a number was expected' $(LOG)
5+
$(RUSTC) -C codegen-units dummy.rs 2>&1 | \
6+
$(CGREP) 'codegen option `codegen-units` requires a number'
7+
$(RUSTC) -C codegen-units= dummy.rs 2>&1 | \
8+
$(CGREP) 'incorrect value `` for codegen option `codegen-units` - a number was expected'
9+
$(RUSTC) -C codegen-units=foo dummy.rs 2>&1 | \
10+
$(CGREP) 'incorrect value `foo` for codegen option `codegen-units` - a number was expected'
1311
$(RUSTC) -C codegen-units=1 dummy.rs
1412
#Option taking a string
15-
$(RUSTC) -C extra-filename dummy.rs 2>&1 | tee $(LOG)
16-
grep 'codegen option `extra-filename` requires a string' $(LOG)
13+
$(RUSTC) -C extra-filename dummy.rs 2>&1 | \
14+
$(CGREP) 'codegen option `extra-filename` requires a string'
1715
$(RUSTC) -C extra-filename= dummy.rs 2>&1
1816
$(RUSTC) -C extra-filename=foo dummy.rs 2>&1
1917
#Option taking no argument
20-
$(RUSTC) -C lto= dummy.rs 2>&1 | tee $(LOG)
21-
grep 'codegen option `lto` takes no value' $(LOG)
22-
$(RUSTC) -C lto=1 dummy.rs 2>&1 | tee $(LOG)
23-
grep 'codegen option `lto` takes no value' $(LOG)
24-
$(RUSTC) -C lto=foo dummy.rs 2>&1 | tee $(LOG)
25-
grep 'codegen option `lto` takes no value' $(LOG)
18+
$(RUSTC) -C lto= dummy.rs 2>&1 | \
19+
$(CGREP) 'codegen option `lto` takes no value'
20+
$(RUSTC) -C lto=1 dummy.rs 2>&1 | \
21+
$(CGREP) 'codegen option `lto` takes no value'
22+
$(RUSTC) -C lto=foo dummy.rs 2>&1 | \
23+
$(CGREP) 'codegen option `lto` takes no value'
2624
$(RUSTC) -C lto dummy.rs
2725

2826
# Should not link dead code...
2927
$(RUSTC) -Z print-link-args dummy.rs 2>&1 | \
30-
grep -e '--gc-sections' -e '-z[^ ]* [^ ]*\<ignore\>' -e '-dead_strip' -e '/OPT:REF'
28+
$(CGREP) -e '--gc-sections|-z[^ ]* [^ ]*<ignore>|-dead_strip|/OPT:REF'
3129
# ... unless you specifically ask to keep it
3230
$(RUSTC) -Z print-link-args -C link-dead-code dummy.rs 2>&1 | \
33-
(! grep -e '--gc-sections' -e '-z[^ ]* [^ ]*\<ignore\>' -e '-dead_strip' -e '/OPT:REF')
31+
$(CGREP) -ve '--gc-sections|-z[^ ]* [^ ]*<ignore>|-dead_strip|/OPT:REF'

src/test/run-make/error-found-staticlib-instead-crate/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
all:
44
$(RUSTC) foo.rs --crate-type staticlib
5-
$(RUSTC) bar.rs 2>&1 | grep "found staticlib"
5+
$(RUSTC) bar.rs 2>&1 | $(CGREP) "found staticlib"

src/test/run-make/error-writing-dependencies/Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
all:
44
# Let's get a nice error message
55
$(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | \
6-
grep "error writing dependencies"
6+
$(CGREP) "error writing dependencies"
77
# Make sure the filename shows up
8-
$(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | grep "baz"
8+
$(BARE_RUSTC) foo.rs --emit dep-info --out-dir foo/bar/baz 2>&1 | $(CGREP) "baz"

src/test/run-make/hir-tree/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
all:
77
$(RUSTC) -o $(TMPDIR)/input.hir -Z unstable-options \
88
--unpretty=hir-tree input.rs
9-
grep '"Hello, Rustaceans!\\n"' $(TMPDIR)/input.hir
9+
$(CGREP) '"Hello, Rustaceans!\n"' < $(TMPDIR)/input.hir

src/test/run-make/include_bytes_deps/Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ ifneq ($(shell uname),FreeBSD)
88
ifndef IS_WINDOWS
99
all:
1010
$(RUSTC) --emit dep-info main.rs
11-
grep "input.txt" $(TMPDIR)/main.d
12-
grep "input.bin" $(TMPDIR)/main.d
11+
$(CGREP) "input.txt" "input.bin" < $(TMPDIR)/main.d
1312
else
1413
all:
1514

src/test/run-make/inline-always-many-cgu/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
all:
44
$(RUSTC) foo.rs --emit llvm-ir -C codegen-units=2
5-
if grep -w call $(TMPDIR)/*.ll; then \
5+
if cat $(TMPDIR)/*.ll | $(CGREP) -e '\bcall\b'; then \
66
echo "found call instruction when one wasn't expected"; \
77
exit 1; \
88
fi

src/test/run-make/invalid-library/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
all:
44
touch $(TMPDIR)/rust.metadata.bin
55
$(AR) crus $(TMPDIR)/libfoo-ffffffff-1.0.rlib $(TMPDIR)/rust.metadata.bin
6-
$(RUSTC) foo.rs 2>&1 | grep "can't find crate for"
6+
$(RUSTC) foo.rs 2>&1 | $(CGREP) "can't find crate for"

src/test/run-make/invalid-staticlib/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
all:
44
touch $(TMPDIR)/libfoo.a
5-
echo | $(RUSTC) - --crate-type=rlib -lstatic=foo 2>&1 | grep "failed to add native library"
5+
echo | $(RUSTC) - --crate-type=rlib -lstatic=foo 2>&1 | $(CGREP) "failed to add native library"
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-include ../tools.mk
22

33
all:
4-
TMP=fake TMPDIR=fake $(RUSTC) foo.rs 2>&1 | grep "couldn't create a temp dir:"
4+
TMP=fake TMPDIR=fake $(RUSTC) foo.rs 2>&1 | $(CGREP) "couldn't create a temp dir:"

src/test/run-make/issue-22131/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ all: foo.rs
44
$(RUSTC) --cfg 'feature="bar"' --crate-type lib foo.rs
55
$(RUSTDOC) --test --cfg 'feature="bar"' \
66
-L $(TMPDIR) foo.rs |\
7-
grep -q 'foo.rs - foo (line 11) ... ok'
7+
$(CGREP) 'foo.rs - foo (line 11) ... ok'
+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
-include ../tools.mk
22

33
all:
4-
$(RUSTC) -o "" blank.rs 2>&1 | \
5-
grep -i 'No such file or directory'
4+
$(RUSTC) -o "" blank.rs 2>&1 | $(CGREP) -i 'No such file or directory'
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-include ../tools.mk
22

33
all:
4-
$(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | \
5-
grep "error: Error loading target specification: Could not find specification for target"
4+
$(RUSTC) --target x86_64_unknown-linux-musl main.rs 2>&1 | $(CGREP) \
5+
"error: Error loading target specification: Could not find specification for target"
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
-include ../tools.mk
22

33
all:
4-
$(RUSTC) main.rs --error-format json 2>&1 | grep -q '"byte_start":490.*"byte_end":496'
4+
$(RUSTC) main.rs --error-format json 2>&1 | $(CGREP) -e '"byte_start":490\b' '"byte_end":496\b'
+6-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
-include ../tools.mk
2+
13
# The ICE occurred in the following situation:
24
# * `foo` declares `extern crate bar, baz`, depends only on `bar` (forgetting `baz` in `Cargo.toml`)
35
# * `bar` declares and depends on `extern crate baz`
46
# * All crates built in metadata-only mode (`cargo check`)
57
all:
68
# cc https://github.com/rust-lang/rust/issues/40623
7-
$(RUSTC) baz.rs --emit=metadata --out-dir=$(TMPDIR)
8-
$(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta --out-dir=$(TMPDIR)
9-
$(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta --out-dir=$(TMPDIR) 2>&1 | \
10-
grep -vq "unexpectedly panicked"
9+
$(RUSTC) baz.rs --emit=metadata
10+
$(RUSTC) bar.rs --emit=metadata --extern baz=$(TMPDIR)/libbaz.rmeta
11+
$(RUSTC) foo.rs --emit=metadata --extern bar=$(TMPDIR)/libbar.rmeta 2>&1 | \
12+
$(CGREP) -v "unexpectedly panicked"
1113
# ^ Succeeds if it doesn't find the ICE message

src/test/run-make/link-arg/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
RUSTC_FLAGS = -C link-arg="-lfoo" -C link-arg="-lbar" -Z print-link-args
33

44
all:
5-
$(RUSTC) $(RUSTC_FLAGS) empty.rs | grep lfoo | grep lbar
5+
$(RUSTC) $(RUSTC_FLAGS) empty.rs | $(CGREP) lfoo lbar

src/test/run-make/link-cfg/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
all: $(call DYLIB,return1) $(call DYLIB,return2) $(call NATIVE_STATICLIB,return3)
44
ls $(TMPDIR)
5-
$(RUSTC) --print cfg --target x86_64-unknown-linux-musl | grep crt-static
5+
$(RUSTC) --print cfg --target x86_64-unknown-linux-musl | $(CGREP) crt-static
66

77
$(RUSTC) no-deps.rs --cfg foo
88
$(call RUN,no-deps)

src/test/run-make/linker-output-non-utf8/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ all:
1919
$(RUSTC) library.rs
2020
mkdir $(bad_dir)
2121
mv $(TMPDIR)/liblibrary.a $(bad_dir)
22-
LIBRARY_PATH=$(bad_dir) $(RUSTC) exec.rs 2>&1 | grep this_symbol_not_defined
22+
LIBRARY_PATH=$(bad_dir) $(RUSTC) exec.rs 2>&1 | $(CGREP) this_symbol_not_defined
2323

2424
endif

src/test/run-make/many-crates-but-no-match/Makefile

+7-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ all:
2727
mv $(TMPDIR)/$(call RLIB_GLOB,crateA) $(A3)
2828
# Ensure crateC fails to compile since A1 is "missing" and A2/A3 hashes do not match
2929
$(RUSTC) -L $(A2) -L $(A3) crateC.rs >$(LOG) 2>&1 || true
30-
grep "found possibly newer version of crate \`crateA\` which \`crateB\` depends on" $(LOG)
31-
grep "note: perhaps that crate needs to be recompiled?" $(LOG)
32-
grep "crate \`crateA\`:" $(LOG) # this will match two entries
33-
grep "crate \`crateB\`:" $(LOG)
30+
$(CGREP) \
31+
'found possibly newer version of crate `crateA` which `crateB` depends on' \
32+
'note: perhaps that crate needs to be recompiled?' \
33+
'crate `crateA`:' \
34+
'crate `crateB`:' \
35+
< $(LOG)
36+
# the 'crate `crateA`' will match two entries.

0 commit comments

Comments
 (0)