blob: 82b67d694d87adeefb52dc49911764506969e23e (
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
|
# -*- Mode: Makefile -*-
#
# Makefile.am - automake file for Raptor Feed tests
#
# Copyright (C) 2009, David Beckett http://www.dajobe.org/
#
# This package is Free Software and part of Redland http://librdf.org/
#
# It is licensed under the following three licenses as alternatives:
# 1. GNU Lesser General Public License (LGPL) V2.1 or any newer version
# 2. GNU General Public License (GPL) V2 or any newer version
# 3. Apache License, V2.0 or any newer version
#
# You may not use this file except in compliance with at least one of
# the above three licenses.
#
# See LICENSE.html or LICENSE.txt at the top of this package for the
# complete terms and further detail along with the license texts for
# the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
#
#
# Input RDF/XML (atom model) files - rdfxml parser
TEST_IN_RDF_ATOMS= test01.rdf test02.rdf test03.rdf
# Input Atom 1.0 (atom model) files - rss-tag-soup parser
TEST_IN_ATOMS= test04.atom test05.atom
# Output files in Turtle (after parsing) and Atom (after serializing)
OUT_RDF_TTLS= $(TEST_IN_RDF_ATOMS:.rdf=.ttl)
OUT_ATOM_TTLS= $(TEST_IN_ATOMS:.atom=.ttl)
OUT_RDF_ATOMS= $(TEST_IN_RDF_ATOMS:.rdf=.atom)
# Expected results for above
EXPECTED_TTLS= $(OUT_RDF_TTLS:.ttl=-result.ttl) $(OUT_ATOM_TTLS:.ttl=-result.ttl)
EXPECTED_ATOMS= $(OUT_RDF_ATOMS:.atom=-result.atom)
# Files generated during testing (to delete/clean)
OUT_TTLS = $(OUT_RDF_TTLS) $(OUT_ATOM_TTLS)
OUT_ATOMS = $(OUT_RDF_ATOMS)
EXTRA_DIST = \
CMakeLists.txt \
$(TEST_IN_RDF_ATOMS) $(TEST_IN_ATOMS) \
$(EXPECTED_TTLS) $(EXPECTED_ATOMS) \
atom.rng atom.rnc
CLEANFILES = $(OUT_ATOMS) $(OUT_TTLS) CMakeTests.txt errors*.log
RAPPER = $(top_builddir)/utils/rapper
# http://www.thaiopensource.com/relaxng/trang.html
TRANG = trang
build-rapper:
@(cd $(top_builddir)/utils ; $(MAKE) rapper$(EXEEXT))
FEED_TESTS=
if RAPTOR_PARSER_RDFXML
FEED_TESTS += check-rdfxml-to-turtle
endif
if RAPTOR_PARSER_RSS
FEED_TESTS += check-atom-to-turtle
endif
if RAPTOR_SERIALIZER_ATOM
FEED_TESTS += check-serialize-atom
endif
if MAINTAINER_MODE
FEED_TESTS += check-validate-atom
endif
check-local: build-rapper $(FEED_TESTS)
if MAINTAINER_MODE
check_rdfxml_to_turtle_deps = $(TEST_IN_RDF_ATOMS)
endif
# Parse from RDF/XML and Serialize to Turtle
check-rdfxml-to-turtle: $(check_rdfxml_to_turtle_deps)
@set +e; result=0; \
$(RECHO) "Testing RDF/XML to Turtle"; \
printf 'IF(RAPTOR_PARSER_RDFXML)\n\n' >>CMakeTests.txt; \
for test in $(TEST_IN_RDF_ATOMS); do \
parser=rdfxml; \
name=`basename $$test .rdf` ; \
turtle="$$name.ttl"; \
expected="$$name-result.ttl"; \
opts="-f writeBaseURI=0"; \
if test $$name = test01; then \
baseuri="http://example.org/whatsnew"; \
elif test $$name = test02; then \
baseuri="http://example.org/news/"; \
elif test $$name = test03; then \
baseuri="http://example.org"; \
fi; \
opts="-q -i $$parser -o turtle $$opts -O $$baseuri"; \
$(RECHO) $(RECHO_N) "Checking $$test $(RECHO_C)"; \
$(RAPPER) $$opts file:$(srcdir)/$$test > $$turtle 2> errors-crtt.log; \
status=$$?; \
if test $$status != 0; then \
$(RECHO) "FAILED with code $$status"; \
$(RECHO) "$(RAPPER) $$opts file:$(srcdir)/$$test"; \
cat errors-crtt.log ; \
result=1 ; \
elif cmp $(srcdir)/$$expected $$turtle >/dev/null 2>&1; then \
$(RECHO) "ok"; \
else \
$(RECHO) "FAILED"; \
$(RECHO) "$(RAPPER) $$opts file:$(srcdir)/$$test"; \
diff -u $(srcdir)/$$expected $$turtle; result=1; \
fi; \
rm -f errors-crtt.log ; \
printf '\tRAPPER_TEST(%s\n\t\t"%s"\n\t\t%s\n\t\t%s\n\t)\n\n' \
feeds.$$test \
"\$${RAPPER} $$opts file:\$${CMAKE_CURRENT_SOURCE_DIR}/$$test" \
$$turtle \
"\$${CMAKE_CURRENT_SOURCE_DIR}/$$expected" >>CMakeTests.txt; \
done; \
printf 'ENDIF(RAPTOR_PARSER_RDFXML)\n\n' >>CMakeTests.txt; \
set -e; exit $$result
if MAINTAINER_MODE
check_atom_to_turtle_deps = $(TEST_IN_ATOMS)
endif
# Parser from Atom and Serialize to Turtle
check-atom-to-turtle: $(check_atom_to_turtle_deps)
@set +e; result=0; \
$(RECHO) "Testing Atom to Turtle"; \
printf 'IF(RAPTOR_PARSER_RSS)\n\n' >>CMakeTests.txt; \
for test in $(TEST_IN_ATOMS); do \
parser=rss-tag-soup; \
name=`basename $$test .atom` ; \
turtle="$$name.ttl"; \
expected="$$name-result.ttl"; \
opts="-f writeBaseURI=0"; \
baseuri="http://www.example.org/blog/"; \
if test $$name = test04; then \
baseuri="http://www.example.org/blog/"; \
fi; \
opts="-q -i $$parser -o turtle $$opts -O $$baseuri"; \
$(RECHO) $(RECHO_N) "Checking $$test $(RECHO_C)"; \
$(RAPPER) $$opts file:$(srcdir)/$$test > $$turtle 2> errors-catt.log; \
status=$$?; \
if test $$status != 0; then \
$(RECHO) "FAILED with code $$status"; \
$(RECHO) "$(RAPPER) $$opts file:$(srcdir)/$$test"; \
cat errors-catt.log ; \
result=1 ; \
elif cmp $(srcdir)/$$expected $$turtle >/dev/null 2>&1; then \
$(RECHO) "ok"; \
else \
$(RECHO) "FAILED"; \
$(RECHO) "$(RAPPER) $$opts file:$(srcdir)/$$test"; \
diff -u $(srcdir)/$$expected $$turtle; result=1; \
fi; \
rm -f errors-catt.log ; \
printf '\tRAPPER_TEST(%s\n\t\t"%s"\n\t\t%s\n\t\t%s\n\t)\n\n' \
feeds.$$test \
"\$${RAPPER} $$opts file:\$${CMAKE_CURRENT_SOURCE_DIR}/$$test" \
$$turtle \
"\$${CMAKE_CURRENT_SOURCE_DIR}/$$expected" >>CMakeTests.txt; \
done; \
printf 'ENDIF(RAPTOR_PARSER_RSS)\n\n' >>CMakeTests.txt; \
set -e; exit $$result
# Parser from Turtle and Serialize to Atom
check-serialize-atom: check-atom-to-turtle
@set +e; result=0; \
$(RECHO) "Testing Turtle to Atom XML"; \
printf 'IF(RAPTOR_SERIALIZER_ATOM)\n\n' >>CMakeTests.txt; \
for test in $(OUT_RDF_TTLS); do \
name=`basename $$test .ttl` ; \
atom="$$name.atom"; \
expected="$$name-result.atom"; \
opts="-f writeBaseURI=0 -f rssTriples=atom-triples"; \
if test $$name = test01; then \
baseuri="http://example.org/whatsnew"; \
opts="$$opts -f atomEntryUri=http://example.org/2006/03/28/blog-item"; \
elif test $$name = test02; then \
baseuri="http://example.org/news/"; \
elif test $$name = test03; then \
baseuri="http://example.org"; \
fi; \
opts="-q -i turtle -o atom $$opts -I $$baseuri -O $$baseuri"; \
$(RECHO) $(RECHO_N) "Checking $$test $(RECHO_C)"; \
$(RAPPER) $$opts file:$$test > $$atom 2> errors-csa.log; \
status=$$?; \
if test $$status != 0; then \
$(RECHO) "FAILED with code $$status"; \
$(RECHO) "$(RAPPER) $$opts file:$$test"; \
cat errors-csa.log ; \
result=1 ; \
elif cmp $(srcdir)/$$expected $$atom >/dev/null 2>&1; then \
$(RECHO) "ok"; \
else \
$(RECHO) "FAILED"; \
$(RECHO) "$(RAPPER) $$opts file:$(srcdir)/$$test"; \
diff -u $(srcdir)/$$expected $$atom; result=1; \
fi; \
rm -f errors-csa.log ; \
printf '\tRAPPER_TEST(%s\n\t\t"%s"\n\t\t%s\n\t\t%s\n\t)\n\n' \
feeds.$$test \
"\$${RAPPER} $$opts file:$$test" \
$$atom \
"\$${CMAKE_CURRENT_SOURCE_DIR}/$$expected" >>CMakeTests.txt; \
done; \
printf 'ENDIF(RAPTOR_SERIALIZER_ATOM)\n\n' >>CMakeTests.txt; \
set -e; exit $$result
if MAINTAINER_MODE
SUFFIXES = .rng .rnc
.rnc.rng:
$(TRANG) $< $@
check-validate-atom: $(srcdir)/atom.rng check-serialize-atom $(TEST_IN_ATOMS)
@set +e; result=0; \
if test "X$(JING)" = X; then \
$(RECHO) "WARNING: Skipping feed validation RelaxNG tests - jing is missing"; \
else \
$(RECHO) "Validating Atom XML with RelaxNG"; \
for atom in $(OUT_ATOMS) $(TEST_IN_ATOMS); do \
test -f $$atom || atom=$(srcdir)/$$atom; \
$(RECHO) $(RECHO_N) "Validating $$atom $(RECHO_C)"; \
$(JING) $(srcdir)/atom.rng $$atom > errors-cva.log 2>&1; \
status=$$?; \
if test $$status != 0; then \
$(RECHO) "FAILED with code $$status"; result=1; \
$(RECHO) $(JING) $(srcdir)/atom.rng $$atom; \
sed -e "s,^.*$$atom,$$atom," errors-cva.log ; \
result=1 ; \
else \
$(RECHO) "ok"; \
fi; \
rm -f errors-cva.log; \
printf '\tADD_TEST(%s %s)\n' \
feeds.jing-$$atom \
"\$${JING} \$${CMAKE_CURRENT_SOURCE_DIR}/atom.rng $$atom" >>CMakeTests.txt; \
done; \
fi; \
set -e; exit $$result
endif
|