summaryrefslogtreecommitdiff
path: root/tests/docbook/Makefile.am
blob: 09e7239b95c7d326f6d6d7b07b8e509c0baa447f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
## Process this file with automake to produce Makefile.in

tests:
	@echo '## Running docbook tests'
	$(MAKE) single
	$(MAKE) xtchunk

valgrind:
	@echo '## Running the regression tests under Valgrind'
	$(MAKE) CHECKER='libtool --mode=execute valgrind -q --leak-check=full' tests

$(top_builddir)/xsltproc/xsltproc:
	@(cd ../../xsltproc ; $(MAKE) xsltproc)

EXTRA_DIST = README VERSION

CLEANFILES = .memdump

full: tests htmltests xhtmltests fotests

#
# a single tests to check that stuff ain't broken
#
single:
	@$(MKDIR_P) result/html
	@$(MKDIR_P) result/fo
	@$(MKDIR_P) result/xhtml
	@(echo > .memdump)
	@(for i in $(srcdir)/test/gdp-handbook.xml ; do \
	  echo -n "`basename $$i` : html " ; \
	  out=result/html/`basename $$i .xml`.tst; \
	  html=result/html/`basename $$i .xml`.html; \
	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet \
		$(srcdir)/html/docbook.xsl $$i > $$out ; \
	    if [ -f $(srcdir)/$$html ] ; then \
		grep -v id < $(srcdir)/$$html > $$html.noid ; \
		grep -v id < $$out > $$out.noid ; \
		diff $$html.noid $$out.noid ; \
		rm -f $$html.noid $$out.noid ; \
	    else \
		mv $$out $(srcdir)/$$html ; \
	    fi ; \
	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true` ; \
	  if [ -n "$$log" ] ; then \
		echo ; \
		echo result ; \
		echo "$$log" ; \
	  fi ; \
	  rm -f $$out ; \
	  echo -n "fo " ; \
	  out=result/fo/`basename $$i .xml`.tst; \
	  fo=result/fo/`basename $$i .xml`.fo; \
	  msg=result/fo/`basename $$i .xml`.msg; \
	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet \
		$(srcdir)/fo/docbook.xsl $$i > $$out 2> $$msg ; \
	  if [ -f $(srcdir)/$$fo ] ; then \
	      grep -v id < $(srcdir)/$$fo > $$fo.noid ; \
	      grep -v id < $$out > $$out.noid ; \
	      diff $$fo.noid $$out.noid ; \
	      rm -f $$fo.noid $$out.noid ; \
	  else \
		mv $$out $(srcdir)/$$fo ; \
	  fi ; \
	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true` ; \
	  if [ -n "$$log" ] ; then \
		echo ; \
		echo result ; \
		echo "$$log" ; \
	  fi ; \
	  rm -f $$out $$msg ; \
	  echo -n "xhtml " ; \
	  out=result/xhtml/`basename $$i .xml`.tst; \
	  xhtml=result/xhtml/`basename $$i .xml`.xhtml; \
	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet \
		$(srcdir)/xhtml/docbook.xsl $$i > $$out ; \
	  if [ -f $(srcdir)/$$xhtml ] ; then \
	      grep -v id < $(srcdir)/$$xhtml > $$xhtml.noid ; \
	      grep -v id < $$out > $$out.noid ; \
	      diff $$xhtml.noid $$out.noid ; \
	      rm -f $$xhtml.noid $$out.noid ; \
	  else \
		mv $$out $(srcdir)/$$xhtml ; \
	  fi ; \
	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true` ; \
	  if [ -n "$$log" ] ; then \
		echo ; \
		echo result ; \
		echo "$$log" ; \
	  fi ; \
	  rm -f $$out ; \
	  done )
	@echo

xtchunk:
	@$(MKDIR_P) result/html
	@$(MKDIR_P) result/xtchunk
	@(echo > .memdump)
	@echo -n html-chunking
	@(for i in $(srcdir)/test/gdp-handbook.xml ; do \
	  base=`basename $$i .xml` ; \
	  html=result/html/$$base.html; \
	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
		-o result/xtchunk/html/gdp-handbook \
		$(srcdir)/html/xtchunk.xsl $$i 2> $$base.err ; \
	    if [ -f $(srcdir)/result/html/$$base.err ] ; then \
		diff $(srcdir)/result/html/$$base.err $$base.err ; \
		rm $$base.err ; \
	    else \
		mv $$base.err $(srcdir)/result/html/$$base.err ; \
	    fi ; \
	    for html in result/xtchunk/html/*.html ; do \
	      orig=result/xtchunk/html/\`basename $$html .html\`.orig ;\
	      if [ -f $(srcdir)/$$orig ] ; then \
		  grep -v id < $$html > $$html.noid ; \
		  grep -v id < $(srcdir)/$$orig > $$orig.noid ; \
		  diff $$orig.noid $$html.noid ; \
		  rm -f $$html.noid $$orig.noid $$html; \
	      else \
		  mv $$html $(srcdir)/$$orig ; \
		fi ; \
	    done ; \
	    grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true` ; \
	  if [ -n "$$log" ] ; then \
		echo ; \
		echo result ; \
		echo "$$log" ; \
	  fi ; \
	  rm -f result/xtchunk/html/gdp-handbook ; \
	  done )
	@echo

#
# The full set of tests
#
htmltests: $(top_builddir)/xsltproc/xsltproc
	@$(MKDIR_P) result/html
	@(echo > .memdump)
	@echo "##"
	@echo "## HTML stylesheets regression tests"
	@echo "##"
	@(for i in $(srcdir)/test/*.xml ; do \
	  echo $$i ; \
	  out=result/html/`basename $$i .xml`.tst; \
	  html=result/html/`basename $$i .xml`.html; \
	  $(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/html/docbook.xsl $$i > $$out ; \
	  if [ -f $(srcdir)/$$html ] ; then \
	      grep -v id < $(srcdir)/$$html > $$html.noid ; \
	      grep -v id < $$out > $$out.noid ; \
	      diff $$html.noid $$out.noid ; \
	      rm -f $$html.noid $$out.noid ; \
	  else mv $$out $(srcdir)/$$html ; fi ; \
	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true;\
	  rm -f $$out ; done )

fotests: $(top_builddir)/xsltproc/xsltproc
	@$(MKDIR_P) result/fo
	@(echo > .memdump)
	@echo "##"
	@echo "## XSL FO stylesheets regression tests"
	@echo "##"
	@(for i in $(srcdir)/test/*.xml ; do \
	  echo $$i ; \
	  out=result/fo/`basename $$i .xml`.tst; \
	  fo=result/fo/`basename $$i .xml`.fo; \
	  msg=result/fo/`basename $$i .xml`.msg; \
	  $(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/fo/docbook.xsl $$i > $$out  2> $$msg ; \
	  if [ -f $(srcdir)/$$fo ] ; then \
	      grep -v id < $(srcdir)/$$fo > $$fo.noid ; \
	      grep -v id < $$out > $$out.noid ; \
	      diff $$fo.noid $$out.noid ; \
	      rm -f $$fo.noid $$out.noid ; \
	  else mv $$out $(srcdir)/$$fo ; fi ; \
	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true;\
	  rm -f $$out $$msg ; \
	  done )

xhtmltests: $(top_builddir)/xsltproc/xsltproc
	@$(MKDIR_P) result/xhtml
	@(echo > .memdump)
	@echo "##"
	@echo "## XHTML stylesheets regression tests"
	@echo "##"
	@(for i in $(srcdir)/test/*.xml ; do \
	  echo $$i ; \
	  out=result/xhtml/`basename $$i .xml`.tst; \
	  xhtml=result/xhtml/`basename $$i .xml`.xhtml; \
	  $(CHECKER) $(top_builddir)/xsltproc/xsltproc --nonet $(srcdir)/xhtml/docbook.xsl $$i > $$out ; \
	  if [ -f $(srcdir)/$$xhtml ] ; then \
	      grep -v id < $(srcdir)/$$xhtml > $$xhtml.noid ; \
	      grep -v id < $$out > $$out.noid ; \
	      diff $$xhtml.noid $$out.noid ; \
	      rm -f $$xhtml.noid $$out.noid ; \
	  else mv $$out $(srcdir)/$$xhtml ; fi ; \
	  grep "MORY ALLO" .memdump  | grep -v "MEMORY ALLOCATED : 0" || true;\
	  rm -f $$out ; done )

dist-hook:
	@(cd $(srcdir) ; tar -cf - --exclude CVS --exclude .svn common html dtd lib xhtml fo doc images template htmlhelp result test) | (cd $(distdir); tar xf -)