Mercurial > gnulib
annotate tests/test-exclude7.sh @ 11811:451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
* lib/exclude.c: Include hash.h and mbuiter.h
(struct exclude_pattern, exclude_segment): New data types.
(struct exclude): Rewrite.
(fnmatch_pattern_has_wildcards): New function.
(new_exclude_segment, free_exclude_segment): New functions.
(excluded_file_pattern_p, excluded_file_name_p): New functions.
(excluded_file_name, add_exclude): Rewrite using new struct exclude.
* lib/exclude.h (is_fnmatch_pattern): New prototype.
* modules/exclude: Depend on hash and mbuiter.
* modules/exclude-tests: New file.
* tests/test-exclude.c: New file.
* tests/test-exclude1.sh: New file.
* tests/test-exclude2.sh: New file.
* tests/test-exclude3.sh: New file.
* tests/test-exclude4.sh: New file.
* tests/test-exclude5.sh: New file.
* tests/test-exclude6.sh: New file.
* tests/test-exclude7.sh: New file.
author | Sergey Poznyakoff <gray@gnu.org.ua> |
---|---|
date | Wed, 12 Aug 2009 19:03:07 +0300 |
parents | |
children | e53ecd6bb7d0 |
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. |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
3 # Copyright (C) 2009 Free Software Foundation, Inc. |
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 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
18 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
19 TMP=excltmp.$$ |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
20 LIST=flist.$$ |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
21 ERR=0 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
22 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
23 # Test exclude precedence |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
24 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
25 cat > $LIST <<EOT |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
26 foo* |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
27 bar |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
28 Baz |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
29 EOT |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
30 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
31 cat > $TMP <<EOT |
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 bar: 0 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
34 EOT |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
35 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
36 ./test-exclude$EXEEXT $LIST -include $LIST -- bar >$TMP.1 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
37 ./test-exclude$EXEEXT -include $LIST -no-include $LIST -- bar >>$TMP.1 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
38 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
39 diff -c $TMP $TMP.1 || ERR=1 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
40 |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
41 rm -f $TMP $TMP.1 $LIST |
451cf730f520
Optimize exclude: use hash tables for non-wildcard patterns.
Sergey Poznyakoff <gray@gnu.org.ua>
parents:
diff
changeset
|
42 exit $ERR |