Imported Upstream version 4.6.0
[debian/atlc] / tests / find-zero-length.test
1 #! /bin/sh
2 # Dr. David Kirkby. 
3
4 # This test checks for the existance of a file in the source 
5 # tree with a length of zero bytes. This is considered an
6 # error, as no such file should exist. 
7
8 # Use find to search for a file of zero bytes, putting
9 # any such files in $top_builddir/tmp/atlc-zero-bytes
10
11 mkdir $top_builddir/tmp 2> /dev/null
12 rm -f $top_builddir/tmp/atlc-zero-bytes
13
14 # since tmp/atlc-zero-bytes will be found, that must be ignored.
15 find $top_srcdir -size 0c | grep -v tmp/atlc-zero-bytes > $top_builddir/tmp/atlc-zero-bytes 
16
17 # The file $top_builddir/tmp/atlc-zero-bytes contains a list of all the 
18 # files which are zero bytes. Hopefully there are none, in
19 # which case $top_builddir/tmp/atlc-zero-bytes will itself be zero bytes
20 # long. We check for that and if not fail the test. If it fails,
21 # the list of zero byte files are in $top_builddir/tmp/atlc-zero-bytes
22 # If the test passes, the empty file $top_builddir/tmp/atlc-zero-bytes
23 # passes. 
24
25 if [ -s $top_builddir/tmp/atlc-zero-bytes  ]; then 
26   echo "FAILED:" $0 >> tests.log
27   exit 1
28 else
29   rm $top_builddir/tmp/atlc-zero-bytes
30   echo "PASSED:" $0 >> tests.log
31   exit 0
32 fi
33
34