Project

General

Profile

1
selfDir_uZPPqC := $(dir $(lastword $(MAKEFILE_LIST)))
2
root := $(selfDir_uZPPqC)..
3
include $(root)/lib/common.Makefile
4

    
5

    
6
##### Configuration
7

    
8
# Command line
9
full_import ?=
10
import_source ?= 1
11
log ?= $(if $(test),,1)
12
noclobber ?=
13
profile ?=
14
quiet ?=
15
reverify ?= 1
16
schema_only ?=
17
use_staged ?= $(by_col)
18

    
19
# Makefile
20
exts ?= csv tsv tab txt dat dmp xml
21
test_n ?= 2
22

    
23
##### Vars/functions
24

    
25
# Paths
26
datasrc := $(patsubst .%,%,$(notdir $(realpath .)))
27
bin := $(root)/bin
28
mappings := $(root)/mappings
29

    
30
# Make
31
SHELL := /bin/bash
32
selfMake = $(MAKE) --makefile=../input.Makefile
33
subMake = $(MAKE) $(@:$(root)/%=%) --directory=$(root)
34
+_ = $(+:_%=)
35
# used to filter the output of embedded $(shell make ...) invocations
36
filter_make := grep -vF -e lib -e ".Makefile'."
37
addBeforeExt = $(basename $(2))$(1)$(suffix $(2))
38

    
39
# Terminal
40
termCols := $(shell tput cols)
41

    
42
# Commands
43
MKDIR = mkdir -p
44
mkdir = $(MKDIR) $(@D)
45
diff = diff --unified=2
46
diffIgnoreSpace = $(diff) --ignore-space-change
47
diffVerbose = $(if $(verbose),diff --side-by-side --left-column\
48
--width=$(termCols),$(diff))
49

    
50
# BIEN commands
51
sortFilenames = $(shell $(bin)/sort_filenames $(1))
52
selfMap = $(bin)/cols 0 0
53
psqlAsBien := $(bin)/psql_verbose_vegbien
54
psqlNoSearchPath := env no_search_path=1 $(psqlAsBien)
55
# Usage: ($(inDatasrc); cat $(file))|$(psqlCmd)
56
inDatasrc := echo 'SET search_path TO "$(datasrc)";'
57

    
58
# SVN
59
setSvnIgnore = svn propset svn:ignore $(2) $(1)
60
define addDirWithIgnore
61
$(addDir)
62
$(setSvnIgnore)
63
endef
64

    
65
##### Environment
66

    
67
export PATH := $(bin):$(PATH)
68

    
69
##### General targets
70

    
71
all: _always maps ;
72

    
73
clean: _always
74
	$(RM) $(all)
75

    
76
remake: _always clean
77
	+$(selfMake)
78
# re-run make so that cache of existing files is reset
79

    
80
# Only remake if doesn't exist. This prevents unintentional remaking when the
81
# make script is newly checked out from svn (which sets the mod time to now) but
82
# the output is synced externally.
83
# Can't remove prereq to do this, because it determines when the rule applies.
84
make_script = $(if $(wildcard $@),,"time" ./$< >$@)
85

    
86
%/: %/map.csv _always ;
87

    
88
%/: % _always ;
89

    
90
%: %.make
91
	$(make_script)
92
.PRECIOUS: % # save partial outputs of aborted src make scripts
93

    
94
##### Tables discovery
95

    
96
sortFile := import_order.txt
97
noImportFile := _no_import
98

    
99
dontImport = $(wildcard $(noImportFile))$(wildcard $(1)/$(noImportFile))$(if\
100
$(import_source),,$(filter Source,$(1)))
101

    
102
ifeq ($(filter $(sortFile) list_tables,$(MAKECMDGOALS)),)
103
$(shell $(selfMake) $(sortFile)|$(filter_make) >&2)# keep $(sortFile) up-to-date
104
endif
105

    
106
sort_file_tables := $(if $(wildcard $(sortFile)),$(shell cat $(sortFile)))
107
    # $(shell) replaces "\n" with " "
108
tables := $(sort_file_tables)
109
allSubdirs := $(call wildcard/,*/)
110
allTables := $(call sortFilenames,$(filter-out _% verify logs,$(allSubdirs:%/=%)))
111
joinedTables := $(filter-out $(tables),$(allTables))
112
allTables := $(strip $(joinedTables) $(tables))# move joined tables to beginning
113
has_visible_files = $(call wildcard/,$(1)/*)
114
allTables := $(foreach table,$(allTables),$(if\
115
$(call has_visible_files,$(table)),$(table)))
116
ifeq ($(tables),)# none specified in sort file
117
tables := $(allTables)
118
endif
119
importTables := $(foreach table,$(tables),$(if\
120
$(call dontImport,$(table)),,$(table)))
121

    
122
list_tables: _always # use `make -s` to avoid echoing commands
123
	@for table in $(tables); do echo "$$table"; done
124

    
125
$(sortFile): _always
126
	# add any missing tables to $(sortFile)
127
	$(if $(filter-out $(sort_file_tables),$(tables)),$(selfMake) -s list_tables >$@)
128

    
129
##### SVN
130

    
131
svnFilesGlob:= */{,$(noImportFile),{,.}{map,VegBIEN}.csv{,.*},*header.*,*.sql,test.xml.ref}
132
svnFilesGlob := {map.csv,*{schema,~}*.sql,{,*/}{*.make,*terms.csv},$(svnFilesGlob)}
133
_svnFilesGlob := {_MySQL/{,*schema*.sql,*.make},{,*/}{*{run,Makefile},*.{md5,url,pdf},*README.TXT}}
134
svnFiles = $(filter-out _% logs/% %.data.sql,$(call wildcard/,$(svnFilesGlob)))\
135
$(call wildcard/,$(_svnFilesGlob))
136

    
137
# To update all inputs with these settings: make inputs/add
138
add: _always Source/add $(allTables:%=%/add)
139
	$(call setSvnIgnore,.,'*')
140
	$(call addDirWithIgnore,logs,$$'*.gz\n*.log.sql\n*.trace')
141
	$(call addDirWithIgnore,verify,$$'*.out\n*.csv\n*.xls\n*.xlsx')
142
	$(call addFile,import_order.txt)
143
	$(if $(wildcard _MySQL/),$(call addDirWithIgnore,_MySQL,'*'))
144
	$(if $(wildcard _src/),$(call addDirWithIgnore,_src,'*'))
145
	$(if $(wildcard _archive/),$(call addDirWithIgnore,_archive,'*'))
146
	$(call add*,$(svnFiles))
147

    
148
# Adds a new table subdir
149
%/add: _always
150
	$(call addDirWithIgnore,$*,'*')
151
	$(call addDirWithIgnore,$*/logs,$$'*.gz\n*.log.sql\n*.trace')
152

    
153
##### Existing maps discovery
154

    
155
anyMap := %/map.csv %/VegBIEN.csv %/unmapped_terms.csv %/new_terms.csv
156

    
157
exts := $(call ci,$(exts))
158
extsFilter := $(addprefix %.,$(exts))
159
dataOnly = $(filter $(extsFilter),$(1))
160

    
161
anyTest = $*/test.%
162
srcsOnly = $(filter-out $(anyMap) $(anyTest) %/logs,$(call dataOnly,$(1)))
163

    
164
srcDict := map.csv
165

    
166
vocab := $(mappings)/VegCore.vocab.csv
167
thesaurus := $(mappings)/VegCore.thesaurus.csv
168
coreMap := $(mappings)/VegCore-VegBIEN.csv
169

    
170
viaMaps := $(importTables:%=%/map.csv)
171

    
172
autogenMaps := $(subst map.,VegBIEN.,$(viaMaps))
173
directMaps := $(autogenMaps) $(filter-out $(autogenMaps),\
174
$(wildcard */VegBIEN.csv))
175

    
176
##### Sources
177

    
178
srcs = $(call sortFilenames,$(call srcsOnly,$(wildcard $*/*)))
179
nonHeaderSrcs = $(filter-out %/header.csv,$(srcs))
180
isRef = $(if $(nonHeaderSrcs),,1)
181
    # empty subdir, so references an already-installed staging table
182
isXml = $(filter %.xml,$(nonHeaderSrcs))
183
nonXml = $(if $(isXml),,1)
184
isCsv = $(if $(nonHeaderSrcs),$(if $(isXml),,1))
185
    # true if $(srcs) non-empty and contains no *.xml
186
catSrcs = $(bin)/cat$(if $(nonXml),_csv) $(nonHeaderSrcs)
187
withCatSrcs = $(catSrcs:$(bin)/%=$(bin)/with_%) --
188

    
189
# Run with `make -s` to avoid echoing make commands
190
cat: $(importTables:%=%/cat) _always ;
191

    
192
%/cat: _always
193
	$(catSrcs)
194

    
195
##### Input data retrieval
196

    
197
# Must come before `%.sql: _MySQL/%.sql` to override it
198
%.sql: %.sql.make
199
	$(make_script)
200

    
201
# The export must be created with:
202
# `--compatible=postgresql --add-locks=false --set-charset --no-create-info`
203
# Must come before `%.sql: _MySQL/%.sql` to override it
204
%.data.sql: _MySQL/%.data.sql
205
	$(if $(wildcard $@),,$(bin)/my2pg.data <$< >$@)
206

    
207
# The export must be created with:
208
# `--compatible=postgresql --add-locks=false --set-charset`
209
# Add `--no-data` to create a schema-only export.
210
%.sql: _MySQL/%.sql
211
	$(if $(wildcard $@),,$(bin)/my2pg <$< >$@)
212

    
213
##### Staging tables installation
214

    
215
srcTable := %.src
216

    
217
dbExportsWildcard = $(sort $(patsubst _MySQL/%.make,%,$(wildcard\
218
$(1) _MySQL/$(1).make)))
219

    
220
dbExports := $(call dbExportsWildcard,*schema*.sql)# schemas first
221
ifeq ($(schema_only),) # add rest of .sql files
222
dbExports += $(filter-out $(dbExports),$(call dbExportsWildcard,*.sql))
223
endif
224
dbExports := $(strip $(dbExports))# += adds extra whitespace
225
allInstalls := $(if $(dbExports),sql) $(filter-out Source,$(allTables))
226

    
227
install: _always schema $(allInstalls:%=%/install) ;
228

    
229
uninstall: _always confirm_rm_schema rm_schema ;
230
# rm_schema will also drop all staging tables
231

    
232
reinstall: _always uninstall install ;
233

    
234
confirm_rm_schema: _always
235
	$(if $(filter TNRS,$(datasrc)),$(call confirm,WARNING: This will delete the\
236
TNRS cache!,To save it: make backups/TNRS.backup-remake))
237

    
238
schema: _always
239
	-echo 'CREATE SCHEMA "$(datasrc)";'|$(psqlNoSearchPath)
240
# ignore errors if schema exists
241

    
242
rm_schema: _always
243
	echo 'DROP SCHEMA IF EXISTS "$(datasrc)" CASCADE;'|$(psqlNoSearchPath)
244

    
245
installLog := logs/install.log.sql
246

    
247
log_dir = $(1)logs
248
has_log_dir = $(call and,$(wildcard $(log_dir)),$(call not,$(noclobber)))
249
logInstall = $(if $(has_log_dir),$(if $(quiet),$(2)$(1)$(installLog)\
250
2>&1,2>&1|tee $(3) $(1)$(installLog)))
251
logInstallRoot = $(call logInstall,,>)
252
logInstall* = $(call logInstall,$*/,>)
253
logInstall*Add = $(call logInstall,$*/,>>,-a)# append to log
254

    
255
# Must come before %/install to override it
256
sql/install: $(dbExports)
257
	($(inDatasrc); cat $+|pg_dump_limit)|"time" env no_search_path=1 \
258
$(bin)/psql_script_vegbien --set=schema='"$(datasrc)"' $(logInstallRoot)
259

    
260
cleanup = $(if $(wildcard $*/cleanup.sql),($(inDatasrc); cat $*/cleanup.sql)\
261
|"time" $(psqlNoSearchPath) --echo-all --set=table='"$*"' $(logInstall*Add),\
262
(export schema=$(datasrc) table=$*; . $(bin)/vegbien_dest; unset schemas; \
263
$(bin)/csv2db) $(logInstall*Add))
264

    
265
%/header.csv:
266
	echo 'COPY (SELECT * FROM "$(datasrc)"."$*" LIMIT 0) TO STDOUT CSV HEADER;'|\
267
env no_search_path=1 $(bin)/psql_script_vegbien >$*/header.csv
268

    
269
exportHeader = $(selfMake) $*/header.csv
270

    
271
# Don't try to edit a view. Must come before %/install to override it.
272
%_view/install: _always ;
273

    
274
%.sql/run: _always
275
	$(if $(wildcard $(@D)),($(inDatasrc); cat $(@D))|(cd '$(*D)';\
276
"time" env no_search_path=1 ../$(bin)/psql_verbose_vegbien \
277
--set=table='"$(*D)"' --set=table_str=\''"$(*D)"'\'))
278

    
279
%/postprocess: _always
280
	$(if $(wildcard $*/run),,$(selfMake) $*/postprocess.sql/run)
281
	$(if $(wildcard $*/import),$*/import)
282

    
283
# For staging tables which are derived by joining together other staging tables.
284
%/install %/header.csv: %/create.sql _always
285
	($(inDatasrc); echo 'CREATE TABLE "$*" AS'; cat $<; echo ';')|"time" \
286
$(psqlNoSearchPath) --echo-all --set=schema='"$(datasrc)"' --set=table='"$*"' \
287
$(logInstall*)
288
	$(selfMake) $*/postprocess
289
	$(exportHeader)
290
	$(cleanup)
291
ifneq ($(noclobber),)
292
.PRECIOUS: %/header.csv
293
endif
294

    
295
%/install: _always
296
	$(if $(isCsv),$(import_install_))
297
	$(selfMake) $*/postprocess
298
	-$(exportHeader)
299
	-$(if $(isCsv),,$(cleanup))
300
# ignore errors if table does not exist (non-data dir)
301
define import_install_
302
(. $(bin)/vegbien_dest; unset schemas; "time" nice -n +5\
303
env schema=$(datasrc) table=$* $(bin)/csv2db $(catSrcs) $(logInstall*))
304
$(if $(filter $(srcTable),$*),($(inDatasrc);\
305
echo 'ALTER TABLE "$(datasrc)"."$*" RENAME row_num TO "$*.row_num";')|"time"\
306
$(psqlNoSearchPath) --echo-all --set=table='"$*"' $(logInstall*Add))
307
endef
308
# table-scope src table's row_num col to allow joining it with other tables
309

    
310
%/uninstall: _always
311
	echo 'DROP TABLE IF EXISTS "$(datasrc)"."$*" CASCADE;'|$(psqlNoSearchPath)
312

    
313
%/reinstall: _always %/uninstall %/install ;
314

    
315
postprocess: _always $(allTables:%=%/postprocess) ;
316

    
317
cleanup: _always $(tables:%=%/cleanup) ;
318

    
319
# WARNING: This removes any index comments, due to a PostgreSQL bug.
320
# This occurs because ALTER TABLE recreates the index but not its comment.
321
%/cleanup: _always
322
	$(cleanup)
323

    
324
##### Maps building
325

    
326
# Maps to (try to) build are added to this
327
maps :=
328

    
329
srcRoot = $(mappings)/root.sh
330
mkSrcMap = (. $(srcRoot); env datasrc=$(datasrc) $(bin)/src_map <$*/header.csv\
331
>$@)
332

    
333
translate = $(if $(wildcard $(1)),$(bin)/in_place $< $(bin)/translate_ci 1 $(1))
334

    
335
$(srcDict):# empty target in case it doesn't exist
336

    
337
# Via maps cleanup
338
ifneq ($(filter %/.map.csv.last_cleanup,$(MAKECMDGOALS)),)
339
%/.map.csv.last_cleanup: %/map.csv $(vocab) $(thesaurus) $(coreMap) $(srcDict)
340
	$(call translate,$(srcDict))
341
	$(bin)/in_place $< $(bin)/canon 1 $(vocab)
342
	$(call translate,$(thesaurus))
343
	$(bin)/in_place $< $(bin)/fix_line_endings
344
	touch $@
345
	+$(selfMake) $(<:%/map.csv=%/unmapped_terms.csv)
346
	+$(selfMake) $(<:%/map.csv=%/new_terms.csv)
347
.PRECIOUS: %/.map.csv.last_cleanup
348
else
349
%/map.csv: _always
350
	$(if $(wildcard $@),,$(mk_map_csv))
351
	+$(selfMake) $(@:%/map.csv=%/.map.csv.last_cleanup)
352
define mk_map_csv
353
+$(selfMake) $*/header.csv
354
$(if $(nonXml),$(mkSrcMap))
355
endef
356
endif
357

    
358
%/VegBIEN.csv: %/map.csv $(coreMap)
359
	<$< $(bin)/cat_cols 1 2$(if $(wildcard\
360
$*/run),|$(bin)/cols 1 1 3|(head -1 $<; tail -n +2)\
361
)|$(bin)/join $(coreMap)|$(bin)/sort_map >$@
362
maps += $(autogenMaps)
363

    
364
maps: $(maps) _always ;
365

    
366
all += $(maps)
367

    
368
##### Maps validation
369

    
370
# `tail -n +2`: Remove header before running filter_out_ci because filter_out_ci
371
# only removes the header if it matches the vocabulary's header.
372

    
373
%/unmapped_terms.csv: %/map.csv $(coreMap)
374
	tail -n +2 $<|$(bin)/cols 1|$(bin)/filter_out_ci 0 $(coreMap) >$@
375
	$(bin)/autoremove $@
376

    
377
%/new_terms.csv: %/map.csv $(vocab) $(thesaurus) %/unmapped_terms.csv
378
	$(newTerms)
379
	$(bin)/autoremove $@
380
newTerms = tail -n +2 $<|$(bin)/filter_out_ci 0 $(vocab)|$(bin)/filter_out_ci 0\
381
$(thesaurus) $(if $(wildcard $(word 4,$+)),|$(bin)/filter_out_ci 0 $(word 4,$+))\
382
|grep -vE -e '^"?:' -e 'UNUSED' >$@; exit 0 # grep exits nonzero if no match
383

    
384
termsSubdirs := $(importTables)
385

    
386
include $(root)/lib/mappings.Makefile
387

    
388
##### External dependencies
389

    
390
$(root)/%: _always
391
	+$(subMake)
392
.PRECIOUS: $(root)/% # let ext. dir's Makefile decide whether to delete on error
393

    
394
##### Mapping
395

    
396
+maps = $(filter %/map.csv %/VegBIEN.csv $(mappings)/%,$(+_))
397
map2db = env in_database=vegbien in_schema=$(datasrc) in_table=$*\
398
out_database=vegbien $(root)/map $(+maps)
399

    
400
##### Import to VegBIEN
401

    
402
import: $(importTables:%=%/import) _always ;
403

    
404
rm: _always
405
	echo "DELETE FROM source WHERE shortname = '$(datasrc)';"\
406
|"time" $(psqlAsBien)
407

    
408
reimport: _always rm import ;
409

    
410
profileTest = $(if $(profile),$(if $(test),1))
411
profileOnly = -env profile_to=/dev/fd/3 $(map2db) 3>&1 1>&2|\
412
$(bin)/profile_stats /dev/fd/0
413

    
414
log_ = $*/logs/$(if $(n),n=$(n).,)$(version).log.sql
415

    
416
# Displays the import log file path
417
# Run with `make -s` to avoid echoing make commands
418
%/log_file: _always
419
	echo $$(pwd)/$(log_)
420

    
421
trace = $(log_:.log.sql=.trace)
422
import = -$(if $(profileTest),$(profileOnly),(set -x; date; "time" env commit=1\
423
$(if $(profile),profile_to=$(trace)) $(map2db))$(if $(log), >>$(log_) 2>&1))
424
# don't abort on import errors, which often relate to invalid input data
425

    
426
import? = $(if $(call and,$(full_import),$(call dontImport,.)),,$(import))
427

    
428
%/import: %/VegBIEN.csv _always
429
	$(import?)
430
# default:
431
%/import: _always ;
432

    
433
#### Taxonomic scrubbing
434

    
435
scrub: _always
436
	$(selfMake) $(root)/scrub & echo $$!
437

    
438
# Removes TNRS taxondeterminations
439
unscrub: _always
440
	echo "SELECT delete_scrubbed_taxondeterminations('$(datasrc)');"|\
441
"time" env no_query_results=1 $(psqlAsBien)
442

    
443
rescrub: _always unscrub scrub ;
444

    
445
import_scrub: _always import scrub ;
446

    
447
reimport_scrub: _always reimport scrub ;
448

    
449
##### Log files from import
450

    
451
logs := $(wildcard */logs/*.log.sql */logs/*.trace)
452

    
453
rm_logs: _always
454
	$(RM) $(logs)
455

    
456
##### Verification of import
457

    
458
verifyTables := $(patsubst verify/%.ref,%,$(wildcard verify/*.ref))
459

    
460
verify: $(verifyTables:%=%/verify) _always ;
461

    
462
%/verify: verify/%.ref verify/%.out _always
463
	-$(diffVerbose) $(+_)
464
# don't abort on verification errors, which are expected during development
465
# default:
466
%/verify: verify/%.out _always
467
	$(if $(shell test -e $< && echo t),cat $<)
468
# don't run if verify/%.out's default do-nothing action was used
469
# can't use $(wildcard) because it won't recheck file after verify/%.out is run
470

    
471
psqlExport := "time" $(psqlNoSearchPath) --no-align --field-separator=$$'\t'\
472
--pset=footer=off --pset=null=NULL
473
# Note that using $(inDatasrc) will not work with datasources whose tables are
474
# the same name as VegBIEN tables (likely only VegBank), because the datasource
475
# is first in the search_path.
476
verify = $(if $(reverify),($(inDatasrc); cat $<)|$(psqlExport)\
477
--set=datasource="'$(datasrc)'" >$@)
478

    
479
verify/%.out: $(mappings)/verify.%.sql _always
480
	$(verify)
481
.PRECIOUS: verify/%.out # save partial output in case of error to help debugging
482
# default:
483
verify/%.out: _always ;
484

    
485
all += $(wildcard verify/*.out)
486

    
487
%.ref: %.ref.sql
488
	($(inDatasrc); cat $<)|$(psqlExport) >$@
489
.PRECIOUS: %.ref # there must always be a .ref for the make rules to work
490

    
491
##### Editing import
492

    
493
rename/%: _always
494
	echo "UPDATE source SET shortname = '$*' WHERE shortname = '$(datasrc)';"\
495
|$(psqlAsBien)
496

    
497
##### Testing
498

    
499
testRefOutput = $(subst .by_col,,$(1))
500
testRef = $(testRefOutput).ref
501
hasOwnRef = $(filter $@,$(call testRefOutput,$@))
502
# filter returns non-empty if they are equal
503

    
504
# `rm $@`: Remove outputs of successful tests to reduce clutter
505
# `$(foreach use_staged...)`: Run with use_staged=1
506
define runTest
507
@echo "Testing $(abspath $@)..."
508
>$@ env test=1 n=$(test_n) $(1) $(foreach use_staged,1,$(map2db))
509
$(if $(hasOwnRef),,-)@(set -x; $(diffIgnoreSpace) $(call testRef,$@) $@) 2>&1\
510
&& rm $@ || { e=$$?; $(if $(wildcard $(call testRef,$@)),,cat $@;)\
511
$(if $(hasOwnRef),\
512
{\
513
read -p $(emph)'Accept new test output? (y/n)'$(endEmph) REPLY;\
514
if test "$$REPLY" = y; then\
515
(set -x; $(MAKE) $@-ok --directory=$(realpath .) --makefile=../input.Makefile);\
516
exit 0;\
517
fi;\
518
};,\
519
echo $(emph)"Note: The preceding failed test is compared to another test's\
520
output"$(endEmph);\
521
echo $(emph)"When it fails, this always indicates a bug"$(endEmph);\
522
)\
523
exit $$e;}
524
endef
525

    
526
tests :=
527

    
528
%/test: %/test.xml _always ;
529

    
530
# Requires staging tables. To create them, run `make inputs/<datasrc>/install`.
531
# Non-flat-file inputs fall back to mimicking a successful test
532
%/test.xml: %/VegBIEN.csv _always
533
	$(if $(nonXml),$(call runTest,by_col=))
534
tests += %/test.xml
535

    
536
%/test.by_col.xml: %/VegBIEN.csv _always
537
	$(if $(nonXml),$(call runTest,by_col=1))
538

    
539
# Only run column-based tests if column-based mode enabled, because these tests
540
# are much slower than the row-based tests for small numbers of rows
541
ifneq ($(by_col),)
542
tests += %/test.by_col.xml
543
endif
544

    
545
testOutputs := $(foreach test,$(tests),$(importTables:%=$(test)))
546

    
547
.PRECIOUS: $(testOutputs) # save outputs of failed tests so they can be accepted
548

    
549
test: _always $(testOutputs) ;
550

    
551
all += $(wildcard %/test*.xml)
552

    
553
# Accepts a test output: make <test_output_path>-ok
554
%-ok: _always
555
	mv $* $(call testRef,$*)
556

    
557
accept-all: _always
558
	+yes|$(selfMake) test
559

    
560
##### Documentation
561

    
562
steps = $(selfMake) -s $*/import test=1 by_col=1 verbosity=2 n=100\
563
2>&1|$(bin)/debug2redmine >$@
564

    
565
%/logs/steps.by_col.log.sql: _always
566
	+$(steps)
(9-9/9)