[xsd-users] Adding error tests to xsd

Boris Kolpackov boris at codesynthesis.com
Tue Apr 13 10:58:52 EDT 2010


Hi Ray,

Ray Lischner <rlischner at proteuseng.com> writes:

> In particular, I want to try running xsd and expect it to exit with a 
> non-zero return code. If xsd exits with a zero return code, that 
> indicates a test failure. Then I want to check the output from xsd 
> and veriyf that it contains the error message that I expect.

Here is the makefiles that is based on the tests/cxx/tree/test-template
that should do what you want:

include $(dir $(lastword $(MAKEFILE_LIST)))../../../../build/bootstrap.make

test   := $(out_base)/.test

# Do-nothing default target
#
$(out_base)/: $(driver)

# Test.
#
$(test): xsd := $(out_root)/xsd/xsd
$(test): $(xsd) $(src_base)/test.xsd $(src_base)/output
	$(call message,test $$1,$(xsd) cxx-tree $$1 || echo error expected | diff -u $(src_base)/output -,$(src_base)/test.xsd)

# Dependencies.
#
$(call import,$(src_root)/xsd/makefile)

If you want to run several test from the same makefile, take a look,
for example, at tests/cxx/parser/validation/all/makefile.

Boris



More information about the xsd-users mailing list