File: skip-read

package info (click to toggle)
grep 3.6-1%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,348 kB
  • sloc: ansic: 86,034; sh: 11,681; perl: 606; makefile: 378; awk: 71; sed: 16
file content (25 lines) | stat: -rwxr-xr-x 702 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# Check that grep skips reading in some cases.

. "${srcdir=.}/init.sh"; path_prepend_ ../src

fail=0

echo /dev/null >exp || framework_failure_

for opts in '-m0 y' '-f /dev/null' '-v ""'; do
  for matcher in '' -E -F; do
    for file in /dev/null no-such-file; do
      eval returns_ 1 grep $opts $matcher no-such-file > out || fail=1
      compare /dev/null out || fail=1
      eval returns_ 1 grep -l $opts $matcher /dev/null > out || fail=1
      compare /dev/null out || fail=1
    done
    eval returns_ 1 grep -L $opts $matcher /dev/null > out || fail=1
    compare exp out || fail=1
    eval returns_ 1 grep -L $opts $matcher /dev/null > /dev/null || fail=1
  done
done


Exit $fail