Make check-*.sh scripts more portable (#16299)

This commit is contained in:
Behdad Esfahbod 2008-06-12 21:03:19 -04:00
parent d47142907f
commit b9acf625d6
7 changed files with 43 additions and 35 deletions

View file

@ -13,31 +13,33 @@ fi
test -z "$srcdir" && srcdir=.
status=0
stat=0
if ! test -f "$DOC_MODULE-undocumented.txt" -a -f "$DOC_MODULE-unused.txt"; then
if test -f "$DOC_MODULE-undocumented.txt" -a -f "$DOC_MODULE-unused.txt"; then
:
else
echo At least one of "$DOC_MODULE-undocumented.txt" and "$DOC_MODULE-unused.txt" not found.
echo Skipping test.
exit 0
fi
status=0
if test -f "$DOC_MODULE-unused.txt"; then
unused=`cat "$DOC_MODULE-unused.txt"`
if test -n "$unused"; then
echo Unused documentated symbols: 1>&2
cat "$DOC_MODULE-unused.txt" 1>&2
status=1
stat=1
fi
fi
if test -f "$DOC_MODULE-undocumented.txt"; then
if ! grep '^0 symbols incomplete' "$DOC_MODULE-undocumented.txt" >/dev/null ||
! grep '^0 not documented' "$DOC_MODULE-undocumented.txt" >/dev/null; then
if grep '^0 symbols incomplete' "$DOC_MODULE-undocumented.txt" >/dev/null &&
grep '^0 not documented' "$DOC_MODULE-undocumented.txt" >/dev/null; then
:
else
echo Incomplete or undocumented symbols: 1>&2
cat "$DOC_MODULE-undocumented.txt" 1>&2
status=1
stat=1
fi
fi
exit $status
exit $stat

View file

@ -6,6 +6,6 @@ test -z "$srcdir" && srcdir=.
test -z "$top_srcdir" && top_srcdir=$srcdir/../..
SGML_DOCS=true
FILES=$srcdir/tmpl/*.sgml
FILES=`echo $srcdir/tmpl/*.sgml`
. "$top_srcdir/src/check-doc-syntax.sh"

View file

@ -3,7 +3,7 @@
LANG=C
test -z "$srcdir" && srcdir=.
status=0
stat=0
echo 'Checking source files for missing or misplaced #include "cairoint.h"'
@ -12,6 +12,6 @@ while read x; do
grep '\<include\>' "$x" /dev/null | head -n 1
done |
grep -v '"cairoint.h"' |
grep . && status=1
grep . && stat=1
exit $status
exit $stat

View file

@ -2,14 +2,16 @@
LANG=C
if ! which nm 2>/dev/null >/dev/null; then
if which nm 2>/dev/null >/dev/null; then
:
else
echo "'nm' not found; skipping test"
exit 0
fi
test -z "$srcdir" && srcdir=.
test -z "$MAKE" && MAKE=make
status=0
stat=0
$MAKE check-has-hidden-symbols.i > /dev/null || exit 1
if tail -1 check-has-hidden-symbols.i | grep CAIRO_HAS_HIDDEN_SYMBOLS >/dev/null; then
@ -38,7 +40,7 @@ for def in $defs; do
eval $get_cairo_syms | grep -v '^_cairo_test_\|^_fini\|^_init' | sort -u
# cheat: copy the last line from the def file!
tail -n1 "$def"
} | diff "$def" - || status=1
} | diff "$def" - || stat=1
done
exit $status
exit $stat

View file

@ -2,13 +2,15 @@
LANG=C
if ! grep --version 2>/dev/null | grep GNU >/dev/null; then
if grep --version 2>/dev/null | grep GNU >/dev/null; then
:
else
echo "GNU grep not found; skipping test"
exit 0
fi
test -z "$srcdir" && srcdir=.
status=0
stat=0
echo Checking documentation for incorrect syntax
@ -25,8 +27,8 @@ enum_regexp='\([^%@]\|^\)\<\(FALSE\|TRUE\|NULL\|CAIRO_[0-9A-Z_]*\)\($\|[^(A-Za-z
if test "x$SGML_DOCS" = x; then
enum_regexp='^[^:]*:[/ ][*]\(\|[ \t].*\)'$enum_regexp
fi
if grep . /dev/null $FILES | sed -e '/<programlisting>/,/<\/programlisting>/d' | grep "$enum_regexp" | grep -v '#####'; then
status=1
if echo $FILES | xargs grep . /dev/null | sed -e '/<programlisting>/,/<\/programlisting>/d' | grep "$enum_regexp" | grep -v '#####'; then
stat=1
echo Error: some macros in the docs are not prefixed by percent sign.
echo Fix this by searching for the following regexp in the above files:
echo " '$enum_regexp'"
@ -39,8 +41,8 @@ else
type_regexp='\(.'$type_regexp'\)\|\('$type_regexp'.\)'
fi
if grep . /dev/null $FILES | sed -e '/<programlisting>/,/<\/programlisting>/d' | grep "$type_regexp" | grep -v '#####'; then
status=1
if echo $FILES | xargs grep . /dev/null | sed -e '/<programlisting>/,/<\/programlisting>/d' | grep "$type_regexp" | grep -v '#####'; then
stat=1
echo Error: some type names in the docs are not prefixed by hash sign,
echo neither are the only token in the doc line followed by colon.
echo Fix this by searching for the following regexp in the above files:
@ -53,18 +55,18 @@ if test "x$SGML_DOCS" = x; then
fi
# We need to filter out gtk-doc markup errors for program listings.
if grep . /dev/null $FILES | sed -e '/<programlisting>/,/<\/programlisting>/d' | grep "$func_regexp" | grep -v '^[^:]*: [*] [a-z_0-9]*:$' | grep -v '#####'; then
status=1
if echo $FILES | xargs grep . /dev/null | sed -e '/<programlisting>/,/<\/programlisting>/d' | grep "$func_regexp" | grep -v '^[^:]*: [*] [a-z_0-9]*:$' | grep -v '#####'; then
stat=1
echo Error: some function names in the docs are not followed by parentheses.
echo Fix this by searching for the following regexp in the above files:
echo " '$func_regexp'"
fi
note_regexp='NOTE'
if grep "$note_regexp" $FILES; then
status=1
if echo $FILES | xargs grep "$note_regexp" /dev/null; then
stat=1
echo Error: some source files contain the string 'NOTE'.
echo Be civil and replace it by 'Note' please.
fi
exit $status
exit $stat

View file

@ -3,7 +3,7 @@
LANG=C
test -z "$srcdir" && srcdir=.
status=0
stat=0
echo Checking public headers for missing cairo_public decorators
@ -16,6 +16,6 @@ awk '
{ context=$0; }
' |
sed 's/[.]h-/.h:/' |
grep . && status=1
grep . && stat=1
exit $status
exit $stat

View file

@ -2,14 +2,16 @@
LANG=C
if ! which readelf 2>/dev/null >/dev/null; then
if which readelf 2>/dev/null >/dev/null; then
:
else
echo "'readelf' not found; skipping test"
exit 0
fi
test -z "$srcdir" && srcdir=.
test -z "$MAKE" && MAKE=make
status=0
stat=0
$MAKE check-has-hidden-symbols.i > /dev/null || exit 1
if tail -1 check-has-hidden-symbols.i | grep CAIRO_HAS_HIDDEN_SYMBOLS >/dev/null; then
@ -19,7 +21,7 @@ fi
for so in .libs/lib*.so; do
echo Checking "$so" for local PLT entries
readelf -W -r "$so" | grep 'JU\?MP_SLO' | grep 'cairo' && status=1
readelf -W -r "$so" | grep 'JU\?MP_SLO' | grep 'cairo' && stat=1
done
exit $status
exit $stat