tests: put some Makefile.am vars to test environment for gtkdoc-check
[gtk-doc.git] / tests / sanity.sh
blob829d350f23a77b9b051119224e75aa359d412eb5
1 #!/bin/sh
3 dir=`dirname $0`
4 suite="sanity"
6 failed=0
7 tested=0
9 echo "Running suite(s): gtk-doc-$suite";
11 # check the presence and non-emptyness of certain files
12 nok=0
13 for path in $dir/*/docs*/html; do
14 if test ! -s $path/index.html ; then nok=$(($nok + 1)); break; fi
15 if test ! -s $path/index.sgml ; then nok=$(($nok + 1)); break; fi
16 if test ! -s $path/home.png ; then nok=$(($nok + 1)); break; fi
17 done
18 if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
19 tested=$(($tested + 1))
22 # check online tags
23 nok=0
24 for file in $dir/*/docs*/html/index.sgml; do
25 grep >/dev/null "<ONLINE href=" $file
26 if test $? = 1 ; then nok=$(($nok + 1)); break; fi
27 grep >/dev/null "<ANCHOR id=" $file
28 if test $? = 1 ; then nok=$(($nok + 1)); break; fi
29 done
30 if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
31 tested=$(($tested + 1))
34 # check validity of generated xml files
35 nok=0
36 for file in $dir/*/docs*/xml/*.xml; do
37 xmllint --noout --noent $file
38 if test $? != 0 ; then
39 nok=$(($nok + 1));
41 done
42 if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
43 tested=$(($tested + 1))
46 # check validity of generated sgml files
47 nok=0
48 for file in $dir/*/docs*/xml/*.sgml; do
49 xmllint --noout --noent $file
50 if test $? != 0 ; then
51 nok=$(($nok + 1));
53 done
54 if test $nok -gt 0 ; then failed=$(($failed + 1)); fi
55 tested=$(($tested + 1))
58 # summary
59 rate=$((100*($tested - $failed)/$tested));
60 echo "$rate %: Checks $tested, Failures: $failed"
62 test $failed = 0
63 exit $?