summaryrefslogtreecommitdiff
path: root/test/Makefile
blob: 79f075d8291a2df16ec4f062577d88759e245f93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
testutils_files := testutils/comparators.c;testutils/list.c;testutils/domtsasserts.c
testutils_files := $(testutils_files);testutils/utils.c;testutils/foreach.c;testutils/load.c

TESTCFLAGS := $(TESTCFLAGS) -I$(DIR) -I$(DIR)testutils -Ibindings/xml -Ibindings/hubbub -Wno-unused -fno-strict-aliasing

ALL_XML_TESTS :=

# 1: Path to XML file
# 2: Fragment C file name
# 3: DTD file
# 4: Test name
define do_xml_test


ifeq ($$(WANT_TEST),yes)

$(DIR)$2: $(DIR)testcases/tests/$1 $(DIR)transform.pl  $(DIR)DOMTSHandler.pm
	$(VQ)$(ECHO) "   XFORM: $1"
	$(Q)$(PERL) $(DIR)transform.pl $(DIR)$3 $(DIR)testcases/tests/$(dir $1)/files $(DIR)testcases/tests/$1 > $(DIR)$2

DIR_TEST_ITEMS := $$(DIR_TEST_ITEMS) $4:$2;$(testutils_files)

endif

DISTCLEAN_ITEMS := $$(DISTCLEAN_ITEMS) $(DIR)$2

ALL_XML_TESTS := $$(ALL_XML_TESTS) $4



endef

# 1: suite base
# 2: dtd for suite
define do_xml_suite

$(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=))))

endef

# 1: test name
define write_index

	$(Q)$(ECHO) "$1	$1" >> $@

endef

$(DIR)INDEX: test/Makefile
	$(VQ)$(ECHO) "   INDEX: Making test index"
	$(Q)$(ECHO) "#test	desc	dir" > $@
	$(foreach XMLTEST,$(sort $(ALL_XML_TESTS)),$(call write_index,$(XMLTEST)))

TEST_PREREQS := $(TEST_PREREQS) $(DIR)INDEX

# Include the level 1 core tests
$(eval $(call do_xml_suite,level1/core,dom1-interfaces.xml))
# Include level 1 html tests
$(eval $(call do_xml_suite,level1/html,dom1-interfaces.xml))

# Include the level 2 core tests
$(eval $(call do_xml_suite,level2/core,dom2-core-interface.xml))

CLEAN_ITEMS := $(DIR)INDEX

include $(NSBUILD)/Makefile.subdir