*** empty log message ***
[findutils.git] / build-aux / check-testfiles.sh
blobbd354480167eba3ecc0fb83d3ff1ae666311a0ea
1 #! /bin/sh
2 # check-testfiles.sh -- Check we distributed all the test files we need
3 # Copyright (C) 2007 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
18 # USA.
20 rv=0
23 makelist () {
24 ls "${1}"/*/testsuite/*/*"${2}" | sed -e 's/.*\///' | sort
27 diagnose () {
28 makelist "${distdir}" "$1" > dist"${1}".txt &&
29 makelist "${srcdir}" "$1" > src"${1}".txt &&
30 diff src"${1}".txt dist"${1}".txt
31 rm -f src"${1}".txt dist"${1}".txt
32 echo
36 check_shipfiles () {
37 distcount=`ls ${distdir}/*/testsuite/*/*${suffix} | wc -l`
38 srccount=`ls ${srcdir}/*/testsuite/*/*${suffix} | wc -l`
39 if test $distcount -eq $srccount ; then
40 echo "All $srccount of the $suffix files are accounted for"
41 else
42 echo "ERROR: Missing $suffix files: source $srccount distributed $distcount" >&2
43 rv=1
44 diagnose "${suffix}"
49 main () {
50 distdir="$1"
51 srcdir="$2"
52 shift 2
53 if test "$#" -gt 0 ; then
54 for suffix ; do
55 check_shipfiles "$suffix"
56 done
57 exit $rv
58 else
59 echo "You did not specify any test file suffixes." >&2
60 exit 1
64 main "$@"