1testutils_files := testutils/comparators.c;testutils/list.c;testutils/domtsasserts.c
2testutils_files := $(testutils_files);testutils/utils.c;testutils/foreach.c;testutils/load.c
3
4TESTCFLAGS := $(TESTCFLAGS) -I$(DIR) -I$(DIR)testutils -Ibindings/xml -Ibindings/hubbub -Wno-unused -fno-strict-aliasing
5
6ALL_XML_TESTS :=
7
8# 1: Path to XML file
9# 2: Fragment C file name
10# 3: DTD file
11# 4: Test name
12define do_xml_test
13
14
15ifeq ($$(WANT_TEST),yes)
16
17$(DIR)$2: $(DIR)testcases/tests/$1 $(DIR)transform.pl  $(DIR)DOMTSHandler.pm
18	$(VQ)$(ECHO) "   XFORM: $1"
19	$(Q)$(PERL) $(DIR)transform.pl $(DIR)$3 $(DIR)testcases/tests/$(dir $1)/files $(DIR)testcases/tests/$1 > $(DIR)$2
20
21DIR_TEST_ITEMS := $$(DIR_TEST_ITEMS) $4:$2;$(testutils_files)
22
23endif
24
25DISTCLEAN_ITEMS := $$(DISTCLEAN_ITEMS) $(DIR)$2
26
27ALL_XML_TESTS := $$(ALL_XML_TESTS) $4
28
29
30
31endef
32
33# 1: suite base
34# 2: dtd for suite
35define do_xml_suite
36
37$(foreach XML,$(filter-out $1/metadata.xml,$(filter-out $1/alltests.xml,$(subst $(DIR)testcases/tests/,,$(wildcard $(DIR)testcases/tests/$1/*.xml)))),$(call do_xml_test,$(XML),$(subst /,_,$(XML:.xml=.c)),$2,$(subst /,_,$(XML:.xml=))))
38
39endef
40
41# 1: test name
42define write_index
43
44	$(Q)$(ECHO) "$1	$1" >> $@
45
46endef
47
48$(DIR)INDEX: test/Makefile
49	$(VQ)$(ECHO) "   INDEX: Making test index"
50	$(Q)$(ECHO) "#test	desc	dir" > $@
51	$(foreach XMLTEST,$(sort $(ALL_XML_TESTS)),$(call write_index,$(XMLTEST)))
52
53TEST_PREREQS := $(TEST_PREREQS) $(DIR)INDEX
54
55# Include the level 1 core tests
56$(eval $(call do_xml_suite,level1/core,dom1-interfaces.xml))
57# Include level 1 html tests
58$(eval $(call do_xml_suite,level1/html,dom1-interfaces.xml))
59
60# Include the level 2 core tests
61$(eval $(call do_xml_suite,level2/core,dom2-core-interface.xml))
62
63# Include level 2 html tests
64$(eval $(call do_xml_suite,level2/html,dom1-interfaces.xml))
65
66CLEAN_ITEMS := $(DIR)INDEX
67
68include $(NSBUILD)/Makefile.subdir
69
70