Commit 0e2ce684 authored by Daniel Armbruster's avatar Daniel Armbruster Committed by thomas.forbriger
Browse files

proceeding with different test cases

This is a legacy commit from before 2015-05-18.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 5314
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent b83b2557
......@@ -153,4 +153,122 @@ package:
/bin/mv -fv $(TMPDIR)/$(PACKAGEGZIPFILE) $(TMPDIR)/$(PACKAGEBZIPFILE) \
$(TF_PUBLICATIONPATH)
# ============================================================================
# tests
# --------------
# generate directory with sample files
TESTDIR=testdir
TESTRESULTDIR=testResults
NOW=$(shell date +"%Y%m%d%H%M")
HALFDAYAGO=$(shell date --date "now 12 hours ago" +"%Y%m%d%H%M")
ONEDAYAGO=$(shell date --date "now 1 days ago" +"%Y%m%d%H%M")
TWODAYSAGO=$(shell date --date "now 2 days ago" +"%Y%m%d%H%M")
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) $@
$(TESTDIR)/oneDayAgo: $(TESTDIR)
touch -t $(ONEDAYAGO) $@
$(TESTDIR)/twoDaysAgo: $(TESTDIR)
touch -t $(TWODAYSAGO) $@
.PHONY: testEnv
testEnv: $(TESTDIR)/now $(TESTDIR)/halfDayAgo $(TESTDIR)/oneDayAgo \
$(TESTDIR)/twoDaysAgo
tests: test1 test2 test3 test4
testlst: $(TESTRESULTDIR)/test1.result $(TESTRESULTDIR)/test2.result \
$(TESTRESULTDIR)/test3.result $(TESTRESULTDIR)/test4.result
@echo -ne "----\n"
@cat $^
%.result: %.csbackgen.result %.find.result
testID="$(shell basename -s .result $@ | tr -d '[:alpha:]')"; \
if [ -z "$(shell diff $^)" ]; then \
echo "TEST $${testID}: OK" > $@; \
else \
echo "TEST $${testID}: ERROR" > $@; \
fi
test1: $(TESTRESULTDIR)/test1.result
$(TESTRESULTDIR)/test1.result: $(TESTRESULTDIR)/test1.csbackgen.result \
$(TESTRESULTDIR)/test1.find.result
$(TESTRESULTDIR)/test1.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
@echo -ne "----\n"
@echo -ne "TEST 1: Excluding files last modified within the last \
24 hs (--mtime 0).\n"
@echo -ne "----\n"
csbackgen -n --debug --mtime 0 $(word 2,$^) | \
sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test1.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
find $(word 2,$^) -type f -mtime 0 -printf "%f\n" | sort > $@
test2: $(TESTRESULTDIR)/test2.result
$(TESTRESULTDIR)/test2.result: $(TESTRESULTDIR)/test2.csbackgen.result \
$(TESTRESULTDIR)/test2.find.result
$(TESTRESULTDIR)/test2.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
@echo -ne "----\n"
@echo -ne "TEST 2: Excluding files last within the last 24 hs (--mtime -1).\n"
@echo -ne "----\n"
csbackgen -n --debug --mtime 0 $(word 2,$^) | \
sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test2.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
find $(word 2,$^) -type f -mtime -1 -printf "%f\n" | sort > $@
test3: $(TESTRESULTDIR)/test3.result
$(TESTRESULTDIR)/test3.result: $(TESTRESULTDIR)/test3.csbackgen.result \
$(TESTRESULTDIR)/test3.find.result
$(TESTRESULTDIR)/test3.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
@echo -ne "----\n"
@echo -ne "TEST 3: Excluding files last modified yesterday \
(--daystart --mtime 1).\n"
@echo -ne "----\n"
csbackgen -n --debug --daystart --mtime 1 $(word 2,$^) | \
sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test3.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
find $(word 2,$^) -daystart -type f -mtime 1 -printf "%f\n" | sort > $@
test4: $(TESTRESULTDIR)/test4.result
$(TESTRESULTDIR)/test4.result: $(TESTRESULTDIR)/test4.csbackgen.result \
$(TESTRESULTDIR)/test4.find.result
$(TESTRESULTDIR)/test4.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
@echo -ne "----\n"
@echo -ne "TEST 4: Excluding files last modified 24 hs ago and earlier \
(--mtime +1).\n"
@echo -ne "----\n"
csbackgen -n --debug --mtime +1 $(word 2,$^) | \
sed -n '/List of excluded files:/,/308/p' | sed -e '1d' -e '$$d' | \
awk '{$$1=$$2=$$3=""; print $$0}' | sed -e 's/^[[:space:]]*//' | sort > $@
$(TESTRESULTDIR)/test4.find.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
find $(word 2,$^) -type f -mtime +1 -printf "%f\n" | sort > $@
$(TESTRESULTDIR)/test5.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
@echo -ne "----\n"
@echo -ne "TEST 5: Excluding files last modified less than 2 days ago.\n"
@echo -ne "----\n"
$(TESTRESULTDIR)/test5.find.result:
$(TESTRESULTDIR)/test6.csbackgen.result: testEnv $(TESTDIR) $(TESTRESULTDIR)
@echo -ne "----\n"
@echo -ne "TEST 6: Excluding files last modified in between \
24h and 48h ago.\n"
@echo -ne "----\n"
$(TESTRESULTDIR)/test6.find.result:
# ----- END OF Makefile -----
......@@ -113,7 +113,7 @@ def help():
--cmin N Exclude files which status was last changed N minutes ago.
--ctime N Exclude files which status was last changed N*24 hours
ago.
--mmin N Exclude files which data was last modified N minutes ago.
--mmin N Exclude files which data was last modified N minutes ago.
--mtime N Exclude files which data was last modified N*24 hours
ago.
PATH Path to generate checksumfile(s) for including its
......@@ -138,14 +138,18 @@ For file selection regarding time numeric arguments can be passed as follows:
-N for less/younger than N,
N for exactly N.
N for exactly N.
a) Notice if several +N (for greater than N) or -N (for less than N) values are
passed with one parameter the last one will overwrite the previous values.
passed with one parameter the last one will overwrite the previous values.
b) --cmin and --ctime arguments are evaluated platform dependent i.e. time of
most recent metadata change on Unix, or the time of creation on Windows.
most recent metadata change on Unix, or the time of creation on Windows.
c) If times for selection file are specified here the files matching were
excluded in contrast to the Unix find command where files were included.\n"""
excluded in contrast to the Unix find command where files were included.
d) The results for time specific exclution of the Unix find command and
csbackgen may differ slightly at dates changing the clocks.
\n"""
sys.stdout.write(help_text)
# -----------------------------------------------------------------------------
......
......@@ -621,6 +621,7 @@ class StandardTimeProcessor(TimeProcessor):
timeMinus = 0
timeFixed = []
# sort times
#FIXME: +0 and -0 problem
for t in self.time:
if '+' == t[0]:
timePlus = int(t)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment