Project

General

Profile

« Previous | Next » 

Revision 628

input.Makefile: Added test that generates VegBIEN.xml

View differences:

input.Makefile
64 64

  
65 65
import-%: maps/VegBIEN.%.csv _always
66 66
	-$(import_cmd)
67
import_cmd = (set -x; "time" env commit=1 $(map) $<) \
67
import_cmd = (set -x; "time" env commit=1 $(import) $<) \
68 68
$(if $(n),,>>$(log)) 2>&1$(if $(n),|tee -a $(log))
69 69

  
70 70
logs := $(wildcard *.log)
......
95 95

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

  
98
test: test/import.out _always
99
	$(DIFF) $<.ref $<
98
testOutputs := test/VegBIEN.xml test/import.out
100 99

  
101
all += test/import.out
100
test: _always $(testOutputs) ;
102 101

  
102
all += $(testOutputs)
103

  
104
define runTest
105
env test=1 n=$(test_n) $(1) $(+_)$(if $(2),, >$@) 2>&1$(if $(2), |\
106
grep -v -E '^$(2)$$' >$@) || { e=$$?; cat $@; exit $$e;}
107
$(DIFF) $@.ref $@
108
endef
109

  
110
test/VegBIEN.xml: $(vegbienMaps) _always
111
	$(call runTest,$(map),Processed .* input rows)
112
.PRECIOUS: test/VegBIEN.xml
113

  
103 114
test/import.out: $(vegbienMaps) _always
104
	env test=1 n=$(test_n) $(map) $(+_) >$@ 2>&1 || { e=$$?; cat $@; exit $$e;}
115
	$(call runTest,$(import))
105 116
.PRECIOUS: test/import.out
106 117

  
107 118
%-ok: _always
......
176 187
#####
177 188

  
178 189
# Must come after mapEnv is set
179
map := env $(mapEnv) out_database=vegbien $(root)/map
190
map := $(if $(mapEnv),env $(mapEnv) ,)$(root)/map
191
import := env out_database=vegbien $(map)

Also available in: Unified diff