Skip to content

Commit 028b2ab

Browse files
committed
Bug fix in Makefile:
In addition to a timestamp, the SVRL files contain filepaths and auto-generated namespace prefixes, so they cannot be directly compared. Instead, extract only the svrl:text elements and compare ’em.
1 parent 0104604 commit 028b2ab

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

P5/Test/Makefile

+23-5
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,29 @@ detest: checkrnv
124124
diff -C0 -bBw expected-results/detest_xml_relaxng.log ./
125125
diff -C0 -bBw expected-results/detest_xml_schematron.log ./
126126
# Note on following somewhat complicated 'diff' command:
127-
# The log file contains some lines (like "Processing…" and "Loading…") that include filepaths that are different
128-
# when executed in different environments (like the Travis server, e.g.). Thus rather than comparing the files
129-
# directly, we delete those lines first, and compare the results of deletions.
130-
bash -c "diff -C0 -bBw <(grep -vF 'dct:created' expected-results/detest_odd_schematron.svrl) \
131-
<(grep -vF 'dct:created' ./detest_odd_schematron.svrl)"
127+
# The SVRL file contains lots of stuff, like timestamps,
128+
# filepaths, and auto-assigned namespace prefixes that are
129+
# different when executed in different environments (like the
130+
# Travis server, e.g.). Thus rather than comparing the files
131+
# directly, we extract only the <svrl:text> elements first, and
132+
# compare the results of only that. (Yes, it would be more
133+
# efficient to store expected-results/detest_odd_schematron.txt
134+
# in the repo rather than generating it every time it is to be
135+
# tested, but it seems to me this generation process is wonky
136+
# enough that it would be difficult to reproduce every time the
137+
# Schematron is updated.)
138+
@xmllint --xpath '//*[local-name(.)="text"]/text()[normalize-space(.)!=""]' \
139+
expected-results/detest_odd_schematron.svrl \
140+
| perl -pe 's, +, ,g;' \
141+
| egrep -v '^ *$$' \
142+
> expected-results/detest_odd_schematron.txt
143+
@xmllint --xpath '//*[local-name(.)="text"]/text()[normalize-space(.)!=""]' \
144+
detest_odd_schematron.svrl \
145+
| perl -pe 's, +, ,g;' \
146+
| egrep -v '^ *$$' \
147+
> detest_odd_schematron.txt
148+
diff -C0 -bBw expected-results/detest_odd_schematron.txt ./
149+
132150

133151
clean:
134152
@echo " "

0 commit comments

Comments
 (0)