summaryrefslogtreecommitdiff
path: root/tests/docbook/Makefile.am
blob: b223f4fed2ad29c6f2f7bfe20689275829938c39 (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
## Process this file with automake to produce Makefile.in

all:

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

valgrind:
	@echo '## Running the regression tests under Valgrind'
	$(MAKE) CHECKER='valgrind -q' tests

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

EXTRA_DIST = README VERSION

full: tests htmltests xhtmltests fotests

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

xtchunk:
	@(echo > .memdump)
	@echo -n html-chunking
	@(for i in $(srcdir)/test/gdp-handbook.xml ; do \
	  base=`basename $$i .xml` ; \
	  html=$(srcdir)/result/html/$$base.html; \
	  log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
		-o $(srcdir)/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 $(srcdir)/result/xtchunk/html/*.html ; do \
	      orig=$(srcdir)/result/xtchunk/html/\`basename $$html .html\`.orig ;\
	      if [ -f $$orig ] ; then \
		  grep -v id < $$html > $$html.noid ; \
		  grep -v id < $$orig > $$orig.noid ; \
		  diff $$orig.noid $$html.noid ; \
		  rm -f $$html.noid $$orig.noid $$html; \
	      else \
		  mv $$html $$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 $(srcdir)/result/xtchunk/html/gdp-handbook ; \
	  done )
	@echo

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

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

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

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