[gtk-doc] tests: add a test for stability of the generated html



commit 115debfc79e21b1688250b38c802d0997db27860
Author: Stefan Sauer <ensonic users sf net>
Date:   Fri May 15 20:32:37 2015 +0200

    tests: add a test for stability of the generated html
    
    This tests fails as soon as the generated html changes. We can then inspect the
    change and update the snapshot.

 tests/Makefile.am |   13 +++++++++++--
 tests/sanity.sh   |   15 +++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2fb48ae..496ddd2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,13 +15,22 @@ TESTS_ENVIRONMENT = \
 
 endif
 
-EXTRA_DIST = gtkdoctest.sh tools.sh \
-       gobject.sh bugs.sh annotations.sh fail.sh empty.sh sanity.sh
+EXTRA_DIST = gtkdoctest.sh tools.sh sanity.sh \
+       gobject.sh bugs.sh annotations.sh fail.sh empty.sh 
 
 # run any given test by running make <test>.check
 %.check: %
        @$(TESTS_ENVIRONMENT)   \
        ./$*
 
+snapshot:
+       @for dir in $(SUBDIRS); do \
+         if test -d $$dir/docs/html; then \
+      rm -rf $$dir/docs/html.ref; \
+      cp -r $$dir/docs/html $$dir/docs/html.ref; \
+    fi; \
+       done
+
+.PHONY: snapshot
 
 -include $(top_srcdir)/git.mk
diff --git a/tests/sanity.sh b/tests/sanity.sh
index 6ef67bc..fbe09f5 100755
--- a/tests/sanity.sh
+++ b/tests/sanity.sh
@@ -78,6 +78,21 @@ if test $nok -gt 0 ; then failed=`expr $failed + 1`; fi
 tested=`expr $tested + 1`
 
 
+# check stability of generated html
+nok=0
+for path in $dir/*/docs*/html; do
+  if test -d $path/html.ref; then
+    diff $path/html.ref $path/html
+    if test $? = 1 ; then
+      echo 1>&2 "difference in generated html for $path"
+      nok=`expr $nok + 1`; break;
+    fi
+  fi
+done
+if test $nok -gt 0 ; then failed=`expr $failed + 1`; fi
+tested=`expr $tested + 1`
+
+
 # summary
 successes=`expr $tested - $failed`
 rate=`expr 100 \* $successes / $tested`;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]