Subversion Repositories vgwhois

Rev

Rev 3 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
#!/bin/bash
2
 
3
#
4
#  generic Whois - Maintenance Framework: Testcases
5
#
6
#  (c) 2012-2014 Daniel Marschall, ViaThinkSoft [www.viathinksoft.de]
7
#
8
#  Distribution, usage etc. pp. regulated by the current version of GPL.
9
#
10
#
11
#  Version 2014-08-19
12
#
13
 
14
DIR=$( dirname "$0" )
15
 
16
. "$DIR/../../config/testcases.conf"
17
 
4 daniel-mar 18
CACHE_DIR="$DIR/../../.cache"
19
TESTCASES_LIST="$DIR/../../config/testcases.list"
20
 
2 daniel-mar 21
count=0
22
 
23
while read f; do
24
	if [ -z "$f" ]; then
25
		continue;
26
	fi
27
 
28
	echo "$f" | grep -E "\s*^#" > /dev/null
29
	if [ $? -eq 0 ]; then
30
		continue;
31
	fi
32
 
33
	# Warum? "tld jp" wird dann zu "tld"
34
	# query="$( basename $f )"
35
	query="$f";
36
 
4 daniel-mar 37
	if [ ! -d "$CACHE_DIR/testcases/checktimestamps" ]; then
38
		mkdir -p "$CACHE_DIR/testcases/checktimestamps"
3 daniel-mar 39
	fi
4 daniel-mar 40
	tsfile="$CACHE_DIR/testcases/checktimestamps/$query"
3 daniel-mar 41
 
4 daniel-mar 42
	if [ ! -d "$CACHE_DIR/testcases/problems" ]; then
43
		mkdir -p "$CACHE_DIR/testcases/problems"
3 daniel-mar 44
	fi
4 daniel-mar 45
	errfile="$CACHE_DIR/testcases/problems/$query"
2 daniel-mar 46
 
47
	if [ ! -f "$tsfile" ]; then
48
		((count++));
49
	elif [ ! -f "$tsfile" ] || [ $( stat --format=%Y "$tsfile" ) -le $(( $( date +%s ) - $recheck_time )) ]; then
50
		((count++));
51
	elif [ -f "$errfile" ]; then
52
		((count++));
53
	fi
54
 
4 daniel-mar 55
done < "$TESTCASES_LIST"
2 daniel-mar 56
 
57
if [ $count -eq 0 ]; then
58
	echo "[ OK ]"
59
	exit 0
60
else
61
	echo "[ !! ] $count testcases require attention"
62
	exit 1
63
fi