diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2008-06-12 21:03:19 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2008-06-12 21:03:19 -0400 |
commit | b9acf625d64f11253b5c8d32e890bb94e78809b4 (patch) | |
tree | af6b8e5d658228fa3ded89aaeb6cb6137046061b | |
parent | d47142907f01ae610fa06987c20741ae1382a4b7 (diff) |
Make check-*.sh scripts more portable (#16299)
-rwxr-xr-x | doc/public/check-doc-coverage.sh | 20 | ||||
-rwxr-xr-x | doc/public/check-doc-syntax.sh | 2 | ||||
-rwxr-xr-x | src/check-cairoint.sh | 6 | ||||
-rwxr-xr-x | src/check-def.sh | 10 | ||||
-rwxr-xr-x | src/check-doc-syntax.sh | 24 | ||||
-rwxr-xr-x | src/check-headers.sh | 6 | ||||
-rwxr-xr-x | src/check-plt.sh | 10 |
7 files changed, 43 insertions, 35 deletions
diff --git a/doc/public/check-doc-coverage.sh b/doc/public/check-doc-coverage.sh index 986af6d8..aa1ee52e 100755 --- a/doc/public/check-doc-coverage.sh +++ b/doc/public/check-doc-coverage.sh @@ -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 diff --git a/doc/public/check-doc-syntax.sh b/doc/public/check-doc-syntax.sh index d59d3ebf..c446d26b 100755 --- a/doc/public/check-doc-syntax.sh +++ b/doc/public/check-doc-syntax.sh @@ -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" diff --git a/src/check-cairoint.sh b/src/check-cairoint.sh index ef4e57e9..7bc26038 100755 --- a/src/check-cairoint.sh +++ b/src/check-cairoint.sh @@ -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 diff --git a/src/check-def.sh b/src/check-def.sh index f28be7c3..a7ea2a52 100755 --- a/src/check-def.sh +++ b/src/check-def.sh @@ -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 diff --git a/src/check-doc-syntax.sh b/src/check-doc-syntax.sh index 0c596549..bd07c4d1 100755 --- a/src/check-doc-syntax.sh +++ b/src/check-doc-syntax.sh @@ -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 diff --git a/src/check-headers.sh b/src/check-headers.sh index 4792b2db..f34abb03 100755 --- a/src/check-headers.sh +++ b/src/check-headers.sh @@ -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 diff --git a/src/check-plt.sh b/src/check-plt.sh index c69813b6..e0914995 100755 --- a/src/check-plt.sh +++ b/src/check-plt.sh @@ -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 |