[open-ils-commits] r8061 - in trunk: . Open-ILS/examples
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 14 11:35:05 EST 2007
Author: dbs
Date: 2007-11-14 11:18:20 -0500 (Wed, 14 Nov 2007)
New Revision: 8061
Added:
trunk/Open-ILS/examples/Makefile
Modified:
trunk/Makefile
trunk/install.sh
Log:
Add a basic 'make test' root Makefile target.
The initial test suite validates the example XML files where a schema is available
or checks files for well-formedness where a schema is not available.
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2007-11-14 04:40:25 UTC (rev 8060)
+++ trunk/Makefile 2007-11-14 16:18:20 UTC (rev 8061)
@@ -1,4 +1,5 @@
#!/bin/bash
+# vim:noet:ts=4
# --------------------------------------------------------------------
# Copyright (C) 2005 Georgia Public Library Service
# Bill Erickson <highfalutin at gmail.com>
@@ -39,3 +40,5 @@
clean:
@./install.sh clean
+test:
+ @./install.sh test
Added: trunk/Open-ILS/examples/Makefile
===================================================================
--- trunk/Open-ILS/examples/Makefile (rev 0)
+++ trunk/Open-ILS/examples/Makefile 2007-11-14 16:18:20 UTC (rev 8061)
@@ -0,0 +1,48 @@
+# 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))
+
+
Modified: trunk/install.sh
===================================================================
--- trunk/install.sh 2007-11-14 04:40:25 UTC (rev 8060)
+++ trunk/install.sh 2007-11-14 16:18:20 UTC (rev 8061)
@@ -1,4 +1,5 @@
#!/bin/bash
+# vim:noet:ts=4
# --------------------------------------------------------------------
# Copyright (C) 2005 Georgia Public Library Service
# Bill Erickson <highfalutin at gmail.com>
@@ -82,6 +83,10 @@
return 0;
}
+function testing {
+ if [ -z "$TESTING" ]; then return 1; fi;
+ return 0;
+}
# --------------------------------------------------------------------
@@ -129,6 +134,7 @@
"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;
;;
@@ -212,6 +218,7 @@
# clean - cleans all build files
# build - builds the specified sources
# install - installs the specified sources
+# test - tests the specified sources
# --------------------------------------------------------------------
function checkParams {
@@ -235,6 +242,9 @@
"verbose")
verbose="";;
+ "test")
+ TESTING="1";;
+
*) fail "Unknown option => $arg";
esac
done
@@ -257,6 +267,7 @@
checkParams "$@";
if building; then echo "Building..."; fi;
+if testing; then echo "Testing..."; fi;
if installing; then echo "Installing..."; fi;
@@ -267,5 +278,3 @@
mkInstallDirs;
runInstall;
-
-
More information about the open-ils-commits
mailing list