-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·78 lines (60 loc) · 1.47 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
ROOT="../reference/domains ../device ../browser ../os"
DOMAINS=`find $ROOT -maxdepth 1 -type d | grep -v "domains$" | sort | xargs echo`
function error
{
echo "Please pass in a valid reference domain root"
exit 1
}
if [ "$1" != "" ]
then
DOMAINS=$@
fi
if [ "$DOMAINS" = "" ]
then
error
fi
FAIL=
PASS=
for DROOT in $DOMAINS
do
DOMAIN=`basename $DROOT`
if [ "$DOMAIN" = "domain" ]
then
DOMAINP=`dirname $DROOT`
DOMAIN=`basename $DOMAINP`
fi
if [ ! -d $DROOT -o "`ls $DROOT 2> /dev/null | grep pattern`" = "" ]
then
continue
fi
echo
echo "Testing domain: $DOMAIN"
P=`find $DROOT -type f | grep pattern | grep -v patch | sort | sed "s/^/-p /" | xargs echo`
PP=`find $DROOT -type f | grep pattern | grep patch | sort | sed "s/^/-pp /" | xargs echo`
A=`find $DROOT -type f | grep attribute | grep -v patch | sort | sed "s/^/-a /" | xargs echo`
AP=`find $DROOT -type f | grep attribute | grep patch | sort | sed "s/^/-ap /" | xargs echo`
T=`find $DROOT -type f | grep test | sort | sed "s/^/-t /" | xargs echo`
CMD="`echo ./run.sh $P $PP $A $AP $T -q`"
echo "CMD: $CMD"
$CMD
if [ "$?" != "0" ]
then
FAIL="$FAIL $DOMAIN"
else
PASS="$PASS $DOMAIN"
fi
done
if [ "$FAIL" != "" ]
then
echo
echo "The following tests have failed:$FAIL"
exit 1
fi
if [ "$PASS" != "" ]
then
echo
echo "All tests have passed:$PASS"
exit 0
fi
error