#!/bin/bash
+# vim:noet:ts=4
# --------------------------------------------------------------------
# Copyright (C) 2005 Georgia Public Library Service
# Bill Erickson <highfalutin@gmail.com>
clean:
@./install.sh clean
+test:
+ @./install.sh test
--- /dev/null
+# vim:noet:ts=4
+#
+# This is a simple implementation of a test suite for XML validity
+# (where possible) or well-formedness (if no schema is available)
+# to ensure that our sample XML configuration files are reasonably
+# clean.
+
+TESTIDL := $(shell xmllint --noout --schema fm_IDL.xsd fm_IDL.xml 2>&1 | wc -l)
+TESTOSRF := $(shell xmllint --noout opensrf.xml 2>&1 | wc -l)
+TESTOSRFCORE := $(shell xmllint --noout opensrf_core.xml 2>&1 | wc -l)
+
+test_idl:
+TOTAL := $(TOTAL).
+ifeq ($(TESTIDL), 1)
+SUCCESS := $(SUCCESS).
+else
+$(warning fm_IDL.xml does not validate)
+endif
+
+test_osrf:
+TOTAL := $(TOTAL).
+ifeq ($(TESTOSRF), 1)
+SUCCESS := $(SUCCESS).
+else
+$(warning opensrf.xml is not well-formed)
+endif
+
+test_osrf_core:
+TOTAL := $(TOTAL).
+ifeq ($(TESTOSRFCORE), 1)
+SUCCESS := $(SUCCESS).
+else
+$(warning opensrf_core.xml is not well-formed)
+endif
+
+test: test_idl test_osrf test_osrf_core
+# First we count the number of characters returned
+SUCCESSES ?= $(shell echo $(SUCCESS) | wc -m )
+FAILED ?= $(shell echo $(FAILURE) | wc -m )
+TOTALED ?= $(shell echo $(TOTAL) | wc -m )
+# Then we subtract one from the count to make it accurate
+SUCCESSTESTS ?= $(shell echo $(SUCCESSES) - 1 | bc )
+FAILEDTESTS ?= $(shell echo $(FAILED) -1 | bc )
+TOTALTESTS ?= $(shell echo $(TOTALED) -1 | bc )
+$(info Succesful tests: $(SUCCESSTESTS)/$(TOTALTESTS))
+$(info Failed tests: $(FAILEDTESTS)/$(TOTALTESTS))
+
+
#!/bin/bash
+# vim:noet:ts=4
# --------------------------------------------------------------------
# Copyright (C) 2005 Georgia Public Library Service
# Bill Erickson <highfalutin@gmail.com>
return 0;
}
+function testing {
+ if [ -z "$TESTING" ]; then return 1; fi;
+ return 0;
+}
# --------------------------------------------------------------------
"openils_all" )
if building; then $MAKE -C "$OPENILSDIR" all; fi;
+ if testing; then $MAKE -C "$OPENILSDIR/../examples" test; fi;
if installing; then $MAKE -C "$OPENILSDIR" install; fi;
;;
# clean - cleans all build files
# build - builds the specified sources
# install - installs the specified sources
+# test - tests the specified sources
# --------------------------------------------------------------------
function checkParams {
"verbose")
verbose="";;
+ "test")
+ TESTING="1";;
+
*) fail "Unknown option => $arg";
esac
done
checkParams "$@";
if building; then echo "Building..."; fi;
+if testing; then echo "Testing..."; fi;
if installing; then echo "Installing..."; fi;
mkInstallDirs;
runInstall;
-
-