# This is for developer use only and lives in the repo but
# shouldn't end up in a tarball.
#
-# Remember to run "./test_headers.sh *.h"
+# Remember to run "./test_headers.sh"
# Remember to run "make depend" to update deps in Makefile.in
#
#!/bin/sh
# copyright (c) 2011 Emil Mikulic.
-#
-# The rule is that every header has to bring in all of its dependencies.
-#
-# This script tests to make sure it's true: for each header file,
-# test-compile a C source file that includes just the header.
-#
-# Also test that it can be included twice without problems.
-#
+
+a="\033[31;1m"
+z="\033[m"
+
+# Except for the c-ify output, every header should bring in all of its
+# dependencies, and be able to be included multiple times.
src=_test_hdr.c
obj=_test_hdr.o
+files=`ls *.h | fgrep -v -e graphjs.h -e stylecss.h`
-if [ $# -eq 0 ]; then
- echo "usage: $0 *.h" >&2
- exit 1
-fi
-
-for f in $*; do
+for f in $files; do
cat >$src <<EOF
#include "$f"
void test_hdr_do_nothing(void) { }
EOF
- if gcc -c $src 2>/dev/null; then
- true
- else
- echo "===> FAIL: $f <==="
+ if ! gcc -c $src 2>/dev/null; then
+ echo "${a}===> $f can't be included by itself${z}"
gcc -c $src
- fi
-
- cat >$src <<EOF
+ else
+ cat >$src <<EOF
#include "$f"
#include "$f"
void test_hdr_do_nothing(void) { }
EOF
- if gcc -c $src 2>/dev/null; then
- true
- else
- echo "===> FAIL DOUBLE: $f <==="
- gcc -c $src
+ if ! gcc -c $src 2>/dev/null; then
+ echo "${a}===> $f can't be included twice${z}"
+ gcc -c $src
+ fi
fi
done