From 1e128bcc7fdca8219aa1ba0486ef37d2bd93d557 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 4 Jan 2011 16:07:39 +0000 Subject: [PATCH 5/6] test/interfaces: check that some invalid annotations aren't allowed --- .gitignore | 2 ++ test/interfaces/Makefile.am | 7 ++++++- test/interfaces/invalid-annotated-node.xml | 8 ++++++++ test/interfaces/invalid-nested-annotation.xml | 8 ++++++++ test/interfaces/run-test.sh | 20 +++++++++++++++++++- 5 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 test/interfaces/invalid-annotated-node.xml create mode 100644 test/interfaces/invalid-nested-annotation.xml diff --git a/.gitignore b/.gitignore index 827c0a0..70f1e66 100644 --- a/.gitignore +++ b/.gitignore @@ -217,7 +217,9 @@ tools/dbus-bus-introspect.xml tools/dbus-glib-bindings.h /test/interfaces/run-with-tmp-session-bus.conf /test/interfaces/*-bindings.h +/test/interfaces/*-bindings.h.tmp /test/interfaces/*-glue.h +/test/interfaces/*-glue.h.tmp /test/interfaces/test-server /test/interfaces/test-service /test/interfaces/test-client diff --git a/test/interfaces/Makefile.am b/test/interfaces/Makefile.am index a3d2da0..3cb2c39 100644 --- a/test/interfaces/Makefile.am +++ b/test/interfaces/Makefile.am @@ -14,13 +14,18 @@ LDADD = $(DBUS_GLIB_LIBS) \ ## so if adding tests not to be run in make check, don't add them to ## TESTS if DBUS_BUILD_TESTS -TESTS_ENVIRONMENT=DBUS_TOP_BUILDDIR=$(ABSOLUTE_TOP_BUILDDIR) +TESTS_ENVIRONMENT = \ + DBUS_TOP_BUILDDIR=$(ABSOLUTE_TOP_BUILDDIR) \ + DBUS_BINDING_TOOL=$(DBUS_BINDING_TOOL) \ + $(NULL) TESTS=run-test.sh else TESTS= endif EXTRA_DIST = \ + invalid-annotated-node.xml \ + invalid-nested-annotation.xml \ run-test.sh \ test-goodbye.xml \ test-hello.xml \ diff --git a/test/interfaces/invalid-annotated-node.xml b/test/interfaces/invalid-annotated-node.xml new file mode 100644 index 0000000..4759b1f --- /dev/null +++ b/test/interfaces/invalid-annotated-node.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/interfaces/invalid-nested-annotation.xml b/test/interfaces/invalid-nested-annotation.xml new file mode 100644 index 0000000..8d98836 --- /dev/null +++ b/test/interfaces/invalid-nested-annotation.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/test/interfaces/run-test.sh b/test/interfaces/run-test.sh index 385efdc..187280b 100755 --- a/test/interfaces/run-test.sh +++ b/test/interfaces/run-test.sh @@ -6,7 +6,8 @@ MODE=$1 ## so the tests can complain if you fail to use the script to launch them DBUS_TEST_GLIB_RUN_TEST_SCRIPT=1 export DBUS_TEST_GLIB_RUN_TEST_SCRIPT -DBUS_TOP_SRCDIR=`dirname "$0"`/../.. +srcdir=`dirname "$0"` +DBUS_TOP_SRCDIR="$srcdir/../.." export DBUS_TOP_SRCDIR # Rerun ourselves with tmp session bus if we're not already if test -z "$DBUS_TEST_GLIB_IN_RUN_TEST"; then @@ -15,5 +16,22 @@ if test -z "$DBUS_TEST_GLIB_IN_RUN_TEST"; then exec ${SHELL} $DBUS_TOP_SRCDIR/tools/run-with-tmp-session-bus.sh $SCRIPTNAME $MODE fi +for x in annotated-node nested-annotation; do + if ! test -f $srcdir/invalid-$x.xml; then + echo "invalid-$x.xml missing">&2 + exit 1 + fi + + if $DBUS_BINDING_TOOL --prefix=test_invalid --mode=glib-server \ + --output=invalid-glue.h $srcdir/invalid-$x.xml || + $DBUS_BINDING_TOOL --prefix=test_invalid --mode=glib-client \ + --output=invalid-bindings.h $srcdir/invalid-$x.xml; then + echo "invalid-$x.xml should not have been processed successfully!">&2 + exit 1 + else + echo "invalid-$x.xml failed, as expected">&2 + fi +done + echo "running test-client" ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/interfaces/test-client || die "test-client failed" -- 1.7.2.3