forked from mboot-github/python-whois
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·42 lines (34 loc) · 824 Bytes
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /usr/bin/bash
# signal whois module that we are testing, this reads data from testdata/<domain>/in
prepPath()
{
local xpath="$1"
TestDataDir=$( realpath "$xpath" )
export TEST_WHOIS_PYTHON="$TestDataDir"
}
get_testdomains()
{
ls "$TestDataDir" |
grep -v ".sh"
}
testOneDomain()
{
domain="$1"
[ ! -d "$TestDataDir/$domain" ] && return
echo "testing: $domain"
./test2.py -d "$domain" >"$TestDataDir/$domain/test.out"
diff "$TestDataDir/$domain/output" "$TestDataDir/$domain/test.out" | tee "$TestDataDir/$domain/out"
}
main()
{
prepPath "testdata" # set a default
[ -d "$1" ] && { # if a argument and is a dir use that for testing
prepPath "$1"
}
get_testdomains |
while read line
do
testOneDomain $(basename $line)
done
}
main $*