Count errors in script and don“t ignore them in make test
diff --git a/Makefile b/Makefile
index 9b9f669..65a21c1 100644
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,7 @@
tail -n 1 xslt/idsCorpus-template.xml >> $@
test: models/dereko_domains_s.classifier i5valid
- - bash test/test-xml.sh
+ bash test/test-xml.sh
i5: $(foreach year,$(YEARS),$(TARGET_DIR)/dnb$(year).i5.xml)
diff --git a/test/test-xml.sh b/test/test-xml.sh
index 0d1e629..659f9b9 100755
--- a/test/test-xml.sh
+++ b/test/test-xml.sh
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
TESTDIR=$(dirname $0)
ASSERTSH=${TESTDIR}/assert.sh
-set -e
+# set -e
. ${ASSERTSH}
-
+ERRORS=0
TEXTS=6
I5_FILE=target/dnb18.i5.xml
if [ ! -f "$I5_FILE" ]; then
@@ -18,6 +18,7 @@
log_success "$I5_FILE contains $TEXTS idsText elements"
else
log_failure "$I5_FILE does not contain $TEXTS idsText elements, but: $observed"
+ ((ERRORS++))
fi
@@ -33,6 +34,7 @@
log_success "c.title contains yeaar"
else
log_failure "c.title does not contain year: $observed"
+ ((ERRORS++))
fi
observed=$(xmlstarlet sel --net -t -v "count(/idsCorpus/idsDoc/idsText/idsHeader/fileDesc/sourceDesc/biblStruct/monogr/h.author[contains(., '[')])" target/dnb13.i5.xml)
@@ -40,4 +42,12 @@
log_success "authors do not contain []"
else
log_failure "authors contain []: $observed"
-fi
\ No newline at end of file
+ ((ERRORS++))
+fi
+
+if [ $ERRORS -gt 0 ]; then
+ log_failure "There were $ERRORS errors"
+ exit 1
+else
+ log_success "All tests passed"
+fi