Project

General

Profile

« Previous | Next » 

Revision 630

input.Makefile: Added test that generates VegBIEN.2-step.xml by mapping via a VegX.xml

View differences:

input.Makefile
15 15
tables := $(vegxMaps:maps/VegX.%.csv=%)
16 16
vegbienMaps := $(subst VegX.,VegBIEN.,$(vegxMaps))
17 17

  
18
+maps = $(filter maps/%,$(+_))
19
+in = $(filter-out maps/%,$(+_))
20

  
18 21
root := $(selfDir_3d1bc249)..
19 22
psqlAsBien := $(root)/bin/psql_vegbien
20 23

  
......
95 98

  
96 99
ifneq ($(wildcard test/),)
97 100

  
98
testOutputs := test/VegX.xml test/VegBIEN.xml test/import.out
101
tests := test/VegX.xml test/VegBIEN.xml test/VegBIEN.2-step.xml test/import.out
99 102

  
100
test: _always $(testOutputs) ;
103
test: _always $(tests) ;
101 104

  
102
.PRECIOUS: $(testOutputs)
105
.PRECIOUS: $(tests)
103 106

  
104
all += $(testOutputs)
107
all += $(tests)
105 108

  
109
testRef = $(1:.2-step.xml=.xml).ref
110

  
106 111
define test
107
env test=1 n=$(test_n) $(1) $(+_)$(if $(2),, >$@) 2>&1$(if $(2), |\
108
grep -v -E '^$(2)$$' >$@) || { e=$$?; cat $@; exit $$e;}
109
$(DIFF) $@.ref $@
112
env test=1 n=$(test_n) $(1) $(if $(+in),<$(+in)) $(+maps) $(if $(2),,>$@) 2>&1 \
113
$(if $(2),| grep -v -E '^$(2)$$' >$@) || { e=$$?; cat $@; exit $$e;}
114
$(DIFF) $(call testRef,$@) $@
110 115
endef
111 116

  
112 117
test2File = $(call test,$(map),Processed .* input rows)
......
118 123
test/VegBIEN.xml: $(vegbienMaps) _always
119 124
	$(test2File)
120 125

  
126
test/VegBIEN.2-step.xml: test/VegX.xml $(vegbienMaps) _always
127
	$(test2File)
128

  
121 129
test/import.out: $(vegbienMaps) _always
122 130
	$(test2Db)
123 131

  
124 132
%-ok: _always
125
	$(CP) $* $*.ref
133
	$(CP) $* $(call testRef,$*)
126 134

  
127 135
else
128 136
test: _always ;

Also available in: Unified diff