1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-04 08:37:28 +03:00

Don't use grep -P in tests

The version of grep being used may not support the -P flag
(Perl-compatible regular expressions).
This commit is contained in:
Peter Wang 2022-06-26 15:44:34 +10:00
parent fe72463f55
commit 2963ab672c
11 changed files with 31 additions and 31 deletions

View File

@ -25,6 +25,6 @@ EOF
$CC -B. -o $t/exe $t/a.o -Wl,-emit-relocs
$QEMU $t/exe | grep -q 'Hello world'
readelf -S $t/exe | grep -Pq 'rela?\.text'
readelf -S $t/exe | grep -Eq 'rela?\.text'
echo OK

View File

@ -31,7 +31,7 @@ $CC -shared -fPIC -o $t/b.so -xc /dev/null
./mold -o $t/exe $t/a.o $t/b.so --export-dynamic
readelf --dyn-syms $t/exe > $t/log
grep -Pq 'NOTYPE GLOBAL DEFAULT \d+ bar' $t/log
grep -Pq 'NOTYPE GLOBAL DEFAULT \d+ _start' $t/log
grep -Eq 'NOTYPE GLOBAL DEFAULT [0-9]+ bar' $t/log
grep -Eq 'NOTYPE GLOBAL DEFAULT [0-9]+ _start' $t/log
echo OK

View File

@ -53,8 +53,8 @@ $QEMU $t/exe | grep -q 'Hello world'
DEBUGINFOD_URLS= gdb $t/exe -nx -batch -ex 'b main' -ex r -ex 'b trap' \
-ex c -ex bt -ex quit >& $t/log
grep -Pq 'hello \(\) at .*<stdin>:7' $t/log
grep -Pq 'greet \(\) at .*<stdin>:11' $t/log
grep -Pq 'main \(\) at .*<stdin>:4' $t/log
grep -q 'hello () at .*<stdin>:7' $t/log
grep -q 'greet () at .*<stdin>:11' $t/log
grep -q 'main () at .*<stdin>:4' $t/log
echo OK

View File

@ -64,9 +64,9 @@ $QEMU $t/exe | grep -q 'Hello world'
DEBUGINFOD_URLS= gdb $t/exe -nx -batch -ex 'b main' -ex r -ex 'b trap' \
-ex c -ex bt -ex quit >& $t/log
grep -Pq 'hello2 \(\) at .*<stdin>:7' $t/log
grep -Pq 'hello \(\) at .*<stdin>:4' $t/log
grep -Pq 'greet \(\) at .*<stdin>:8' $t/log
grep -Pq 'main \(\) at .*<stdin>:4' $t/log
grep -q 'hello2 () at .*<stdin>:7' $t/log
grep -q 'hello () at .*<stdin>:4' $t/log
grep -q 'greet () at .*<stdin>:8' $t/log
grep -q 'main () at .*<stdin>:4' $t/log
echo OK

View File

@ -64,9 +64,9 @@ $QEMU $t/exe | grep -q 'Hello world'
DEBUGINFOD_URLS= gdb $t/exe -nx -batch -ex 'b main' -ex r -ex 'b trap' \
-ex c -ex bt -ex quit >& $t/log
grep -Pq 'hello2 \(\) at .*<stdin>:7' $t/log
grep -Pq 'hello \(\) at .*<stdin>:4' $t/log
grep -Pq 'greet \(\) at .*<stdin>:8' $t/log
grep -Pq 'main \(\) at .*<stdin>:4' $t/log
grep -q 'hello2 () at .*<stdin>:7' $t/log
grep -q 'hello () at .*<stdin>:4' $t/log
grep -q 'greet () at .*<stdin>:8' $t/log
grep -q 'main () at .*<stdin>:4' $t/log
echo OK

View File

@ -64,9 +64,9 @@ $QEMU $t/exe | grep -q 'Hello world'
DEBUGINFOD_URLS= gdb $t/exe -nx -batch -ex 'b main' -ex r -ex 'b trap' \
-ex c -ex bt -ex quit >& $t/log
grep -Pq 'hello2 \(\) at .*<stdin>:7' $t/log
grep -Pq 'hello \(\) at .*<stdin>:4' $t/log
grep -Pq 'greet \(\) at .*<stdin>:8' $t/log
grep -Pq 'main \(\) at .*<stdin>:4' $t/log
grep -q 'hello2 () at .*<stdin>:7' $t/log
grep -q 'hello () at .*<stdin>:4' $t/log
grep -q 'greet () at .*<stdin>:8' $t/log
grep -q 'main () at .*<stdin>:4' $t/log
echo OK

View File

@ -96,13 +96,13 @@ $QEMU $t/exe | grep -q 'Hello world'
DEBUGINFOD_URLS= gdb $t/exe -nx -batch -ex 'b main' -ex r -ex 'b trap' \
-ex c -ex bt -ex quit >& $t/log
grep -Pq 'fn8 \(\) at .*/d.c:6' $t/log
grep -Pq 'fn7 \(\) at .*/d.c:10' $t/log
grep -Pq 'fn6 \(\) at .*/c.c:4' $t/log
grep -Pq 'fn5 \(\) at .*/c.c:8' $t/log
grep -Pq 'fn4 \(\) at .*/b.c:4' $t/log
grep -Pq 'fn3 \(\) at .*/b.c:8' $t/log
grep -Pq 'fn2 \(\) at .*/a.c:4' $t/log
grep -Pq 'fn1 \(\) at .*/a.c:8' $t/log
grep -q 'fn8 () at .*/d.c:6' $t/log
grep -q 'fn7 () at .*/d.c:10' $t/log
grep -q 'fn6 () at .*/c.c:4' $t/log
grep -q 'fn5 () at .*/c.c:8' $t/log
grep -q 'fn4 () at .*/b.c:4' $t/log
grep -q 'fn3 () at .*/b.c:8' $t/log
grep -q 'fn2 () at .*/a.c:4' $t/log
grep -q 'fn1 () at .*/a.c:8' $t/log
echo OK

View File

@ -25,7 +25,7 @@ int main() {
EOF
$CC -B. -o $t/b.so -shared $t/a.o
readelf -W --sections $t/b.so | grep -P -A1 '\.rela?\.dyn' | \
grep -Pq '\.rela?\.plt'
readelf -W --sections $t/b.so | grep -E -A1 '\.rela?\.dyn' | \
grep -Eq '\.rela?\.plt'
echo OK

View File

@ -18,6 +18,6 @@ void _start() {}
EOF
./mold -o $t/exe $t/a.o --oformat=binary -Ttext=0x4000 -Map=$t/map
grep -Pq '^\s+0x4000\s+\d+\s+\d+\s+\.text$' $t/map
grep -Eq '^\s+0x4000\s+[0-9]+\s+[0-9]+\s+\.text$' $t/map
echo OK

View File

@ -16,7 +16,7 @@ mkdir -p $t
[ "$CC" = cc ] || { echo skipped; exit; }
# ASAN doesn't work with LD_PRELOAD
nm mold-wrapper.so | grep -Pq '__[at]san_init' && { echo skipped; exit; }
nm mold-wrapper.so | grep -q '__[at]san_init' && { echo skipped; exit; }
which clang >& /dev/null || { echo skipped; exit; }

View File

@ -16,7 +16,7 @@ mkdir -p $t
[ "$CC" = cc ] || { echo skipped; exit; }
# ASAN doesn't work with LD_PRELOAD
nm mold-wrapper.so | grep -Pq '__[at]san_init' && { echo skipped; exit; }
nm mold-wrapper.so | grep -q '__[at]san_init' && { echo skipped; exit; }
cat <<'EOF' | $CC -xc -c -o $t/a.o -
#include <stdio.h>