Mercurial > gnulib
annotate tests/test-exclude7.sh @ 40221:8c1a17df67e0
tests: Prepare for using valgrind.
tests/*.sh: Invoke all test programs through ${CHECKER}.
tests/*/*.sh: Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 10 Mar 2019 11:32:11 +0100 |
parents | b06060465f09 |
children |
rev | line source |
---|---|
11811
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
1 #! /bin/sh |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
2 # Test suite for exclude. |
40057
b06060465f09
maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents:
19484
diff
changeset
|
3 # Copyright (C) 2009-2019 Free Software Foundation, Inc. |
11811
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
4 # This file is part of the GNUlib Library. |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
5 # |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
6 # This program is free software: you can redistribute it and/or modify |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
7 # it under the terms of the GNU General Public License as published by |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
8 # the Free Software Foundation; either version 3 of the License, or |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
9 # (at your option) any later version. |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
10 # |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
11 # This program is distributed in the hope that it will be useful, |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
14 # GNU General Public License for more details. |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
15 # |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
16 # You should have received a copy of the GNU General Public License |
19190 | 17 # along with this program. If not, see <https://www.gnu.org/licenses/>. |
11811
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
18 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
19 . "${srcdir=.}/init.sh"; path_prepend_ . |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
20 fail=0 |
11811
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
21 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
22 # Test exclude precedence |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
23 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
24 cat > in <<EOT |
11811
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
25 foo* |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
26 bar |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
27 Baz |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
28 EOT |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
29 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
30 cat > expected <<EOT |
16806
babe19575e66
exclude: process exclude and include directives in order
Paul Eggert <eggert@cs.ucla.edu>
parents:
16201
diff
changeset
|
31 bar: 0 |
11811
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
32 bar: 1 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
33 EOT |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
34 |
40221
8c1a17df67e0
tests: Prepare for using valgrind.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
35 ${CHECKER} test-exclude in -include in -- bar > out || exit $? |
8c1a17df67e0
tests: Prepare for using valgrind.
Bruno Haible <bruno@clisp.org>
parents:
40057
diff
changeset
|
36 ${CHECKER} test-exclude -include in -no-include in -- bar >> out || exit $? |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
37 |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
38 # Find out how to remove carriage returns from output. Solaris /usr/ucb/tr |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
39 # does not understand '\r'. |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
40 case $(echo r | tr -d '\r') in '') cr='\015';; *) cr='\r';; esac |
11811
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
41 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
42 # normalize output |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
43 LC_ALL=C tr -d "$cr" < out > k && mv k out |
11811
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
44 |
16081
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
45 compare expected out || fail=1 |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
46 |
ab4fc7286686
revamp the other test-exclude?.sh scripts to use init.sh, too
Jim Meyering <meyering@redhat.com>
parents:
14079
diff
changeset
|
47 Exit $fail |