Makefile 20.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# this is <Makefile>
# ----------------------------------------------------------------------------
# $Id$
# Copyright (c) 2012 by Daniel Armbruster 
# ----
# This file is part of csback.
# 
# csback is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# csback is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with csback.  If not, see <http://www.gnu.org/licenses/>.
# ----
# Daniel Armbruster 15/01/2012
# 
# REVISIONS and CHANGES
# 15/01/2012	V0.1	Daniel Armbruster
25
# 16/01/2012  V0.2  added package rule
26
# 28/02/2012  V0.3  smaller modifications - added csbackobs.py
27
28
29
30
# 27/04/2012  V0.4  added lsYears.py - removed with V0.5 (deprecated)
# 13/02/2013  V0.5  added csbackresc.py and ssh/scp specific checks
# 14/02/2013  V0.6  added csclean.sh
# 28/02/2013  V0.7  added csbackscp.py
31
32
# 08/11/2013  V0.8  several csbackgen.py tests implemented which are related to
# 									the time exclusion commandline arguments 
33
#
34
# ----------------------------------------------------------------------------
35
PROGRAMS=csback2cron.py csbackntfy.py csbackgen.py csbackchk.py csbackobs.py \
36
	csbackresc.py csbackscp.py csclean.sh
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

.PHONY: all
all: install doc

.PHONY: install
install: installscripts

.PHONY: doc
doc: pdfdoc
  	
# ----------------------------------------------------------------------------
LOCBINDIR=~/bin
RSYNC=$(shell env which rsync)
CRON=$(shell ps -ef | grep -v grep | grep -cw cron)
SYSLOGNG=$(shell ps -ef | grep -v grep | grep -cw syslog)
52
LOGROTATE=$(shell if [ -d /etc/logrotate.d/ ]; then echo logrotate; fi)
53
PYTHON=$(shell env which python)
54
55
SSH=$(shell env which ssh)
SCP=$(shell env which scp)
56
57
58

# ----------------------------------------------------------------------------
.PHONY: clean
59
60
clean: 
	/bin/rm -rvf $(addprefix $(LOCBINDIR)/,$(patsubst %.py,%,$(PROGRAMS))) 
61
	/bin/rm -rvf $(addprefix $(LOCBINDIR)/,$(patsubst %.sh,%,$(PROGRAMS))) 
62
63
64
65
66
67
68
69
70
71
	$(MAKE) -C doc clean

# ----------------------------------------------------------------------------
CHECKVAR=$(if $($(1)),,$(error ERROR: missing variable $(1)))
CHECKVARS=$(foreach var,$(1),$(call CHECKVAR,$(var)))

CHECKPROG=$(if $($(1)),,$(error ERROR: missing program $(1)))
CHECKPROGS=$(foreach prog,$(1),$(call CHECKPROG,$(prog)))

$(call CHECKVARS, LOCBINDIR)
72
$(call CHECKPROGS, RSYNC CRON SYSLOGNG LOGROTATE PYTHON SSH SCP)
73
74
75
76

# ----------------------------------------------------------------------------
PWD=$(shell env pwd)

77
78
79
$(addprefix $(LOCBINDIR)/, $(PROGRAMS)): $(addprefix $(PWD)/, $(PROGRAMS))

$(LOCBINDIR)/%: %.py
80
	mkdir -pv $(LOCBINDIR)
81
82
83
	ln -fs $(addprefix $(PWD)/,$<) $@
	chmod +x $(addprefix $(PWD)/,$<) 

84
85
86
87
88
89
90
$(LOCBINDIR)/%: %.sh
	mkdir -pv $(LOCBINDIR)
	ln -fs $(addprefix $(PWD)/,$<) $@
	chmod +x $(addprefix $(PWD)/,$<) 

installscripts: $(addprefix $(LOCBINDIR)/, $(patsubst %.py,%,$(PROGRAMS)) \
	$(patsubst %.sh,%,$(PROGRAMS)))
91

92
# ----------------------------------------------------------------------------
93
94
95
pdfdoc:
	$(MAKE) -C doc pdf

96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# ============================================================================
# create package
# --------------
# version code based on current date
VERSIONCODE=$(shell date +'%Y%m%d')
# name of the package (including version code)
THEPACKAGE=csback$(VERSIONCODE)
# directory to place temporary files in
TMPDIR=$(HOME)/tmp
# path where the package will be created
TMPPATH=$(TMPDIR)/$(THEPACKAGE)

# tar file
PACKAGETARFILE=$(THEPACKAGE).tar
# gzipped tar file
PACKAGEGZIPFILE=$(PACKAGETARFILE).gz
# bzipped tar file
PACKAGEBZIPFILE=$(PACKAGETARFILE).bz2

# list of README files to be obtained from the subversion repository
INFOFILESFROMSVNWITHPATH=src/LICENSE.GPL
# list of files to be created
INFOFILESFROMSVN=$(notdir $(INFOFILESFROMSVNWITHPATH))

DIRFROMSVNWITHPATH=src/python/csback
# list of files to be created
DIRFROMSVN=$(notdir $(DIRFROMSVNWITHPATH))

# rule for the creation of README files from the repository
$(addprefix $(TMPPATH)/,$(INFOFILESFROMSVN)):
	mkdir -pv $(dir $@)
	svn export \
	$(SVNTF)/trunk/$(filter %$(notdir $@),$(INFOFILESFROMSVNWITHPATH)) $@
	
# rule for the creation of csback files from the repository
$(addprefix $(TMPPATH)/,$(DIRFROMSVN)):
	mkdir -pv $(dir $@)
	svn export $(SVNTF)/trunk/$(filter %$(notdir $@),$(DIRFROMSVNWITHPATH)) $@

# create package tar archive
$(TMPDIR)/$(PACKAGETARFILE): $(TMPPATH)
	/bin/rm -fv $@
	cd $</..; tar cvf $@ $(notdir $<)
	/bin/rm -fv $(TMPDIR)/$(PACKAGEGZIPFILE) $(TMPDIR)/$(PACKAGEBZIPFILE)

# create compressed archives
$(TMPDIR)/$(PACKAGEGZIPFILE): $(TMPDIR)/$(PACKAGETARFILE)
	/bin/cp -vf $< $<.sik
	gzip -vf9 $<
	/bin/mv $<.sik $<
$(TMPDIR)/$(PACKAGEBZIPFILE): $(TMPDIR)/$(PACKAGETARFILE); bzip2 -vf9 $<

.PHONY: package
package:
	- /bin/rm -rvf $(TMPPATH) 
	$(MAKE) $(addprefix $(TMPPATH)/,$(INFOFILESFROMSVN)) 
	$(MAKE) $(addprefix $(TMPPATH)/,$(DIRFROMSVN)) 
	$(MAKE) -C $(TMPPATH)/$(DIRFROMSVN) doc
	$(MAKE) $(TMPDIR)/$(PACKAGEGZIPFILE) $(TMPDIR)/$(PACKAGEBZIPFILE)  
	/bin/mv -fv $(TMPDIR)/$(PACKAGEGZIPFILE) $(TMPDIR)/$(PACKAGEBZIPFILE) \
	$(TF_PUBLICATIONPATH) 
157

158
159
160
161
162
163
# ============================================================================
# tests
# --------------
# generate directory with sample files
TESTDIR=testdir
TESTRESULTDIR=testResults
164
165
TESTS=$(addprefix test, $(shell seq 0 13))

166
NOW=$(shell date +"%Y%m%d%H%M")
167
168
169
170
171
TWOMINUTESAGO=$(shell date --date "now 2 minutes ago" +"%Y%m%d%H%M") 
TWOANDHALFMINUTESAGO=$(shell date --date "now 2 minutes ago 30 seconds ago" \
										 +"%Y%m%d%H%M") 
THREEMINUTESAGO=$(shell date --date "now 3 minutes ago" +"%Y%m%d%H%M") 
FOURMINUTESAGO=$(shell date --date "now 4 minutes ago" +"%Y%m%d%H%M") 
172
HALFDAYAGO=$(shell date --date "now 12 hours ago" +"%Y%m%d%H%M") 
173
174
175
ONEDAYAGO=$(shell date --date "now 1 day ago" +"%Y%m%d%H%M") 
ONEDAYONEMINUTEAGO=$(shell date --date "now 1 day ago 1 minute ago" \
									 +"%Y%m%d%H%M") 
176
177
178
179
180
181
ONEDAYTWOMINUTESAGO=$(shell date --date "now 1 day ago 2 minute ago" \
									 +"%Y%m%d%H%M") 
ONEDAYTHREEMINUTESAGO=$(shell date --date "now 1 day ago 3 minute ago" \
									 +"%Y%m%d%H%M") 
ONEDAYFOURMINUTESAGO=$(shell date --date "now 1 day ago 4 minute ago" \
									 +"%Y%m%d%H%M") 
182
183
184
185
ONEDAYMINUSONEMINUTEAGO=$(shell date --date "now 23 hours ago 59 minutes ago" \
									 +"%Y%m%d%H%M") 
ONEDAYMINUSTWOMINUTESAGO=$(shell date --date "now 23 hours ago 58 minutes ago" \
									 +"%Y%m%d%H%M") 
186
TWODAYSAGO=$(shell date --date "now 2 days ago" +"%Y%m%d%H%M") 
187
THREEDAYSAGO=$(shell date --date "now 3 days ago" +"%Y%m%d%H%M") 
188

189
.PHONY: testclean
190
191
192
193
194
195
196
197
198
199
200
201
202
203
testclean: 
	rm -rfv $(TESTDIR)
	rm -rfv $(TESTRESULTDIR)

.PHONY: $(TESTDIR)
$(TESTDIR):
	mkdir -pv $@
$(TESTRESULTDIR):
	mkdir -pv $@

$(TESTDIR)/now: $(TESTDIR)
	touch -t $(NOW) $@
$(TESTDIR)/halfDayAgo: $(TESTDIR)
	touch -t $(HALFDAYAGO) $@
204
205
206
207
208
209
210
211
$(TESTDIR)/twoMinutesAgo: $(TESTDIR)
	touch -t $(TWOMINUTESAGO) $@
$(TESTDIR)/threeMinutesAgo: $(TESTDIR)
	touch -t $(THREEMINUTESAGO) $@
$(TESTDIR)/twoAndHalfMinutesAgo: $(TESTDIR)
	touch -t $(TWOANDHALFMINUTESAGO) $@
$(TESTDIR)/fourMinutesAgo: $(TESTDIR)
	touch -t $(FOURMINUTESAGO) $@
212
213
214
215
$(TESTDIR)/oneDayAgo: $(TESTDIR)
	touch -t $(ONEDAYAGO) $@
$(TESTDIR)/twoDaysAgo: $(TESTDIR)
	touch -t $(TWODAYSAGO) $@
216
217
218
219
$(TESTDIR)/threeDaysAgo: $(TESTDIR)
	touch -t $(THREEDAYSAGO) $@
$(TESTDIR)/oneDayOneMinuteAgo: $(TESTDIR)
	touch -t $(ONEDAYONEMINUTEAGO) $@
220
221
222
223
224
225
$(TESTDIR)/oneDayTwoMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYTWOMINUTESAGO) $@
$(TESTDIR)/oneDayThreeMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYTHREEMINUTESAGO) $@
$(TESTDIR)/oneDayFourMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYFOURMINUTESAGO) $@
226
227
228
229
$(TESTDIR)/oneDayMinusOneMinuteAgo: $(TESTDIR)
	touch -t $(ONEDAYMINUSONEMINUTEAGO) $@
$(TESTDIR)/oneDayMinusTwoMinutesAgo: $(TESTDIR)
	touch -t $(ONEDAYMINUSTWOMINUTESAGO) $@
230
231

.PHONY: testEnv
232
233
234
testEnv: $(addprefix $(TESTDIR)/, now halfDayAgo oneDayAgo twoDaysAgo \
	oneDayOneMinuteAgo oneDayMinusOneMinuteAgo oneDayMinusTwoMinutesAgo \
	threeDaysAgo twoMinutesAgo threeMinutesAgo fourMinutesAgo \
235
236
	twoAndHalfMinutesAgo oneDayTwoMinutesAgo oneDayThreeMinutesAgo \
	oneDayFourMinutesAgo)
237

238
tests: $(TESTS)
239

240
testlst: $(addprefix $(TESTRESULTDIR)/, $(addsuffix .result, $(TESTS)))
241
242
243
244
245
	@echo -ne "----\n"
	@cat $^
	

%.result: %.csbackgen.result %.find.result 
246
247
248
249
ifeq ($(CONFIG),"")
	$(warning WARNING: Variable CONFIG not set.)
	$(eval CONFIG:=$(shell echo "undefined"))
endif
250
251
	testID="$(shell basename -s .result $@ | tr -d '[:alpha:]')"; \
	if [ -z "$(shell diff $^)" ]; then \
252
		echo "TEST $${testID}: OK    ($(CONFIG))" > $@; \
253
	else \
254
		echo "TEST $${testID}: ERROR ($(CONFIG))" > $@; \
255
256
	fi

257
258
259
260
261
262
263
264
265
266
test0: $(TESTRESULTDIR)/test0.result
$(TESTRESULTDIR)/test0.result: $(TESTRESULTDIR)/test0.csbackgen.result \
	$(TESTRESULTDIR)/test0.find.result 
$(TESTRESULTDIR)/test0.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mtime 0"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime 0"))
	@echo -ne "----\n"
	@echo -ne "TEST 0: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
267
268
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
269
270
271
272
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test0.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@

273
274
275
276
test1: $(TESTRESULTDIR)/test1.result
$(TESTRESULTDIR)/test1.result: $(TESTRESULTDIR)/test1.csbackgen.result \
	$(TESTRESULTDIR)/test1.find.result 
$(TESTRESULTDIR)/test1.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
277
278
	$(eval CONFIG:= $(shell echo "--mtime 1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime 1"))
279
	@echo -ne "----\n"
280
	@echo -ne "TEST 1: $(CONFIG)\n"
281
	@echo -ne "----\n"
282
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
283
284
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
285
286
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | \
		sort | grep -v -e "checksumfile.cs" > $@
287
$(TESTRESULTDIR)/test1.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
288
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
289
290
291
292
293

test2: $(TESTRESULTDIR)/test2.result 
$(TESTRESULTDIR)/test2.result: $(TESTRESULTDIR)/test2.csbackgen.result \
	$(TESTRESULTDIR)/test2.find.result 
$(TESTRESULTDIR)/test2.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
294
295
	$(eval CONFIG:= $(shell echo "--mtime -1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime -1"))
296
	@echo -ne "----\n"
297
	@echo -ne "TEST 2: $(CONFIG)\n"
298
	@echo -ne "----\n"
299
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
300
301
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
302
303
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test2.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
304
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
305
306
307
308
309

test3: $(TESTRESULTDIR)/test3.result 
$(TESTRESULTDIR)/test3.result: $(TESTRESULTDIR)/test3.csbackgen.result \
	$(TESTRESULTDIR)/test3.find.result 
$(TESTRESULTDIR)/test3.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
310
311
	$(eval CONFIG:= $(shell echo "--mtime +1"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime +1"))
312
	@echo -ne "----\n"
313
	@echo -ne "TEST 3: $(CONFIG)\n"
314
	@echo -ne "----\n"
315
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
316
317
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
318
319
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | \
		sort | grep -v -e "checksumfile.cs" > $@
320
$(TESTRESULTDIR)/test3.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
321
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
322
323
324
325
326

test4: $(TESTRESULTDIR)/test4.result 
$(TESTRESULTDIR)/test4.result: $(TESTRESULTDIR)/test4.csbackgen.result \
	$(TESTRESULTDIR)/test4.find.result 
$(TESTRESULTDIR)/test4.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
327
328
	$(eval CONFIG:= $(shell echo "--mtime +1 --mtime -3"))
	$(eval FIND_CONFIG:= $(shell echo "-mtime +1 -mtime -3"))
329
	@echo -ne "----\n"
330
	@echo -ne "TEST 4: $(CONFIG)\n"
331
	@echo -ne "----\n"
332
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
333
334
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
335
336
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
337
$(TESTRESULTDIR)/test4.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
338
	find $(word 2,$^) -type f $(FIND_CONFIG) -printf "%f\n" | sort > $@
339

340
341
342
343
# --daystart related tests
test5: $(TESTRESULTDIR)/test5.result 
$(TESTRESULTDIR)/test5.result: $(TESTRESULTDIR)/test5.csbackgen.result \
	$(TESTRESULTDIR)/test5.find.result 
344
$(TESTRESULTDIR)/test5.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
345
346
	$(eval CONFIG:= $(shell echo "--daystart --mtime 0"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime 0"))
347
	@echo -ne "----\n"
348
	@echo -ne "TEST 5: $(CONFIG)\n"
349
	@echo -ne "----\n"
350
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
351
352
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
353
354
355
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test5.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@
356

357
358
359
test6: $(TESTRESULTDIR)/test6.result 
$(TESTRESULTDIR)/test6.result: $(TESTRESULTDIR)/test6.csbackgen.result \
	$(TESTRESULTDIR)/test6.find.result 
360
$(TESTRESULTDIR)/test6.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
361
362
363
364
365
366
	$(eval CONFIG:= $(shell echo "--daystart --mtime 1"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime 1"))
	@echo -ne "----\n"
	@echo -ne "TEST 6: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
367
368
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test6.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test7: $(TESTRESULTDIR)/test7.result 
$(TESTRESULTDIR)/test7.result: $(TESTRESULTDIR)/test7.csbackgen.result \
	$(TESTRESULTDIR)/test7.find.result 
$(TESTRESULTDIR)/test7.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--daystart --mtime -2"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime -2"))
	@echo -ne "----\n"
	@echo -ne "TEST 7: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
384
385
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
386
387
388
389
390
391
392
393
394
395
396
397
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test7.find.result:  testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test8: $(TESTRESULTDIR)/test8.result 
$(TESTRESULTDIR)/test8.result: $(TESTRESULTDIR)/test8.csbackgen.result \
	$(TESTRESULTDIR)/test8.find.result 
$(TESTRESULTDIR)/test8.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--daystart --mtime +1"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -type f -mtime +1"))
	@echo -ne "----\n"
	@echo -ne "TEST 8: $(CONFIG)\n"
398
	@echo -ne "----\n"
399
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
400
401
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e 'checksumfile.cs' > $@
$(TESTRESULTDIR)/test8.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test9: $(TESTRESULTDIR)/test9.result 
$(TESTRESULTDIR)/test9.result: $(TESTRESULTDIR)/test9.csbackgen.result \
	$(TESTRESULTDIR)/test9.find.result 
$(TESTRESULTDIR)/test9.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--daystart --mtime +1 --mtime -3"))
	$(eval FIND_CONFIG:= $(shell echo "-daystart -mtime +1 -mtime -3"))
	@echo -ne "----\n"
	@echo -ne "TEST 9: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
417
418
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
419
420
421
422
423
424
425
426
427
428
429
430
431
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test9.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test10: $(TESTRESULTDIR)/test10.result 
$(TESTRESULTDIR)/test10.result: $(TESTRESULTDIR)/test10.csbackgen.result \
	$(TESTRESULTDIR)/test10.find.result 
$(TESTRESULTDIR)/test10.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mmin 3"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin 3"))
	@echo -ne "----\n"
	@echo -ne "TEST 10: $(CONFIG)\n"
432
	@echo -ne "----\n"
433
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
434
435
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test10.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test11: $(TESTRESULTDIR)/test11.result 
$(TESTRESULTDIR)/test11.result: $(TESTRESULTDIR)/test11.csbackgen.result \
	$(TESTRESULTDIR)/test11.find.result 
$(TESTRESULTDIR)/test11.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mmin -3"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin -3"))
	@echo -ne "----\n"
	@echo -ne "TEST 11: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
451
452
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
453
454
455
456
457
458
459
460
461
462
463
464
465
466
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test11.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test12: $(TESTRESULTDIR)/test12.result 
$(TESTRESULTDIR)/test12.result: $(TESTRESULTDIR)/test12.csbackgen.result \
	$(TESTRESULTDIR)/test12.find.result 
$(TESTRESULTDIR)/test12.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mmin +2"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin +2"))
	@echo -ne "----\n"
	@echo -ne "TEST 12: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
467
468
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test12.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

test13: $(TESTRESULTDIR)/test13.result 
$(TESTRESULTDIR)/test13.result: $(TESTRESULTDIR)/test13.csbackgen.result \
	$(TESTRESULTDIR)/test13.find.result 
$(TESTRESULTDIR)/test13.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	$(eval CONFIG:= $(shell echo "--mmin +1 --mmin -3"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin +1 -mmin -3"))
	@echo -ne "----\n"
	@echo -ne "TEST 13: $(CONFIG)\n"
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
484
485
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
486
487
488
489
490
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
$(TESTRESULTDIR)/test13.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@

491
492
493
494
test100: $(TESTRESULTDIR)/test100.result 
$(TESTRESULTDIR)/test100.result: $(TESTRESULTDIR)/test100.csbackgen.result \
	$(TESTRESULTDIR)/test100.find.result 
$(TESTRESULTDIR)/test100.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
495
496
497
	$(eval CONFIG:= $(shell echo "--mmin 0"))
	$(eval FIND_CONFIG:= $(shell echo "-type f -mmin 0"))
	@echo -ne "----\n"
498
	@echo -ne "TEST 100: $(CONFIG)\n"
499
500
	@echo -ne "----\n"
	csbackgen -n --debug $(CONFIG) $(word 2,$^) | \
501
502
		sed -n '/List of excluded files:/,/A checksum will be generated/p' | \
		sed -e '1d' -e '$$d' | \
503
504
		awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort | \
		grep -v -e "checksumfile.cs" > $@
505
$(TESTRESULTDIR)/test100.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR) 
506
	find $(word 2,$^) $(FIND_CONFIG) -printf "%f\n" | sort > $@
507

508
# ----- END OF Makefile -----