source: zzuf/trunk/test/check-build @ 4032

Last change on this file since 4032 was 4003, checked in by Sam Hocevar, 11 years ago

Check for typical source code issues in the testsuite.

  • Property svn:executable set to *
File size: 1.1 KB
Line 
1#!/bin/sh
2
3ret=0
4
5#
6# Check that the Win32 config.h is in sync with config.h.in
7#
8
9config_h_in=$(dirname "$0")/../config.h.in
10msvc_config_h=$(dirname "$0")/../msvc/config.h
11
12failure=0
13for key in $(sed -ne 's/.*#undef *\([A-Za-z0-9_]*\).*/\1/p' "$config_h_in");
14do
15  if ! grep '[ef] \<'"$key"'\>' "$msvc_config_h" >/dev/null 2>&1; then
16    echo "error: $key missing from msvc/config.h"
17    failure=1
18  fi
19done
20if test "$failure" != "0"; then
21  ret=1
22else
23  echo "0 errors in Win32 config.h"
24fi
25
26#
27# Check that we have no tabs or trailing spaces in the source code
28#
29failure=0
30for dir in src test; do
31  pushd ../$dir >/dev/null
32  # Dirty hack to print the $(SOURCES) variable
33  for x in $(make -s ID SHELL='echo @@$(SOURCES)@@' | tr -d '\n' | sed 's/.*@@\([^@]*\)@@.*/\1/');
34  do
35    if grep '[[:space:]]$' "$x" >/dev/null 2>&1; then
36      echo "error: $dir/$x contains trailing spaces"
37      failure=1
38    fi
39    if grep '   ' "$x" >/dev/null 2>&1; then
40      echo "error: $dir/$x contains tabs"
41      failure=1
42    fi
43  done
44  popd >/dev/null
45done
46if test "$failure" != "0"; then
47  ret=1
48else
49  echo "0 errors in source code"
50fi
51
52if test "$ret" != "0"; then
53  exit 1
54fi
55
56exit 0
57
Note: See TracBrowser for help on using the repository browser.