source: libcaca/trunk/test/check-source @ 4332

Last change on this file since 4332 was 4332, checked in by Sam Hocevar, 10 years ago

Nicer make check output for our custom tests.

  • Property svn:executable set to *
File size: 808 bytes
Line 
1#!/bin/sh
2
3#
4# Check that we have no tabs or trailing spaces in the source code
5#
6nfails=0
7nfiles=0
8nlines=0
9for dir in caca kernel src cxx examples ruby tools; do
10  pushd ../$dir >/dev/null
11  for x in $(make -s echo-sources); do
12    case "$x" in
13      *.c|*.cpp|*.h|*.m)
14        nfiles=$(($nfiles + 1));
15        nlines=$(($nlines + `wc -l < "$x"`)) ;;
16      *)
17        continue ;;
18    esac
19    if grep '[[:space:]]$' "$x" >/dev/null 2>&1; then
20      echo "error: $dir/$x contains trailing spaces"
21      nfails=$(($nfails + 1))
22    fi
23    if grep '   ' "$x" >/dev/null 2>&1; then
24      echo "error: $dir/$x contains tabs"
25      nfails=$(($nfails + 1))
26    fi
27  done
28  popd >/dev/null
29done
30
31echo "$nfiles files, $nlines lines, $nfails errors in source code"
32
33if test "$nfails" != "0"; then
34  exit 1
35fi
36
37exit 0
38
Note: See TracBrowser for help on using the repository browser.