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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
| | #! /bin/sh
# Test for right working of "--exclude-dir=some/thing/different" option.
#
# Copyright (C) 2001, 2006, 2009-2023 Free Software Foundation, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved.
. "${srcdir=.}/init.sh"; path_prepend_ ../src
failures=0
mkdir -p /tmp/grep-tests/first/second
mkdir -p /tmp/grep-tests/third/forth
cd ..
cat ./exclude-dir-contents.txt > /tmp/grep-tests/first/header.h
cat ./exclude-dir-contents.txt > /tmp/grep-tests/first/second/header.h
cat ./exclude-dir-contents.txt > /tmp/grep-tests/third/header.h
cat ./exclude-dir-contents.txt > /tmp/grep-tests/third/forth/header.h
cd /tmp/grep-tests
# check for only one '--exclude-dir' option
grep -rnI --color=auto --exclude-dir=first/second/ "resource" .
if test $? -ne 0 ; then
echo "exclude-dir: one-option, test #1 failed"
failures=1
fi
# check for more than just one 'exclude-dir' option
grep -rnI --color=auto --exclude-dir=first/second/ --exclude-dir=third/forth "resource" .
if test $? -ne 0 ; then
echo "exclude-dir: multiple-option, test #2 failed"
failures=1
fi
rm -rf /tmp/grep-tests
cd -
Exit $failures
|