Revision 1986
Added by Aaron Marcuse-Kubitza over 12 years ago
input.Makefile | ||
---|---|---|
141 | 141 |
catSrcs = $(bin)/cat$(if $(isCsv),_csv) $(srcs) |
142 | 142 |
withCatSrcs = $(catSrcs:$(bin)/%=$(bin)/with_%) -- |
143 | 143 |
|
144 |
# Usage: `make {--silent|-s} cat` (removes echoed make commands)
|
|
144 |
# Usage: `make {--silent|-s} inputs/<datasrc>/cat` (don't echo make commands)
|
|
145 | 145 |
cat: $(addprefix cat-,$(tables)) _always ; |
146 | 146 |
|
147 | 147 |
cat-%: _always |
... | ... | |
327 | 327 |
|
328 | 328 |
##### Testing |
329 | 329 |
|
330 |
hasOwnRef = $(filter-out %.2-step.xml,$@) |
|
331 |
testRef = $(1:.2-step.xml=.xml).ref |
|
330 |
testRefOutput = $(subst .2-step,,$(subst .staging,,$(1))) |
|
331 |
testRef = $(testRefOutput).ref |
|
332 |
hasOwnRef = $(filter $@,$(call testRefOutput,$@)) |
|
333 |
# filter returns non-empty if they are equal |
|
332 | 334 |
|
333 | 335 |
define runTest |
334 | 336 |
@echo "Testing $(abspath $@)..." |
... | ... | |
347 | 349 |
endef |
348 | 350 |
|
349 | 351 |
test2File = $(call runTest,$(map)) |
352 |
test2Db = $(call runTest,$(map2db)) |
|
350 | 353 |
|
351 | 354 |
tests := |
352 | 355 |
|
... | ... | |
364 | 367 |
tests += test/VegBIEN.%.2-step.xml |
365 | 368 |
|
366 | 369 |
test/import.%.out: maps/VegBIEN.%.csv _always |
367 |
$(call runTest,$(map2db))
|
|
370 |
$(test2Db)
|
|
368 | 371 |
tests += test/import.%.out |
369 | 372 |
|
373 |
testStaged2Db = $(foreach use_staged,1,$(test2Db)) # run with use_staged=1 |
|
374 |
|
|
375 |
# Requires staging tables. To create them, run `make inputs/<datasrc>/install`. |
|
376 |
test/import.%.staging.out: maps/VegBIEN.%.csv _always |
|
377 |
$(if $(isCsv),$(testStaged2Db),cp -p $(@:.staging.out=.out) $@) |
|
378 |
# non-flat-file inputs fall back to mimicking a successful test |
|
379 |
tests += test/import.%.staging.out |
|
380 |
|
|
370 | 381 |
testOutputs := $(foreach test,$(tests),$(tables:%=$(test))) |
371 | 382 |
|
372 | 383 |
.PRECIOUS: $(testOutputs) # save outputs of failed tests so they can be accepted |
Also available in: Unified diff
input.Makefile: Testing: Added test/import.%.staging.out test to test the staging tables. Sources: cat: Updated Usage comment to include the "inputs/<datasrc>/" prefix the user would need to add when running make.