blob: 108b7881c264d8e432f87a68ca4fffed6449ba0e (
plain) (
blame)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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
|
#! /bin/sh
#
# Copyright 2014, 2016 Chris Johns <chrisj@rtems.org>
# All rights reserved
#
#
# usage: rtems-test-check <mode> <bsp-test-database> <includes> <bsp> <tests..>
#
if test $# -lt 4; then
echo "error: invalid command line" >&2
echo "INVALID-TEST-DATA"
exit 2
fi
mode="$1"
shift
testdata="$1"
shift
includepath="$1"
shift
bsp="$1"
shift
tests="$*"
test_count=0
for t in ${tests};
do
test_count=$(expr ${test_count} + 1)
done
case ${mode} in
exclude)
if test -f $testdata; then
output=""
else
output="${tests}"
fi
;;
flags)
if [ $test_count != 1 ]; then
echo "error: test count not 1 for ${mode}" 1>&2
exit 1
fi
output=""
;;
*)
echo "error: invalid mode" 1>&2
echo "INVALID-TEST-DATA"
exit 1
;;
esac
#
# If there is no testdata all tests are valid and must pass.
#
if test -f $testdata; then
excluded_tests=""
expected_fails=""
indeterminates=""
while [ ! -z "$testdata" ];
do
for td in $testdata;
do
ntd=""
exec 3<& 0
exec 0<$td
while read line
do
line=$(echo $line | sed -e 's/#.*$//' -e '/^$/d')
if [ ! -z "$line" ]; then
state=$(echo $line | sed -e "s/:.*//g")
case $state in
include)
inf=$(echo $line | sed -e "s/include://g" -e 's/^[ \t]//;s/[ \t]$//')
if test -f $includepath/$inf; then
ntd="$includepath/$inf $ntd"
fi
;;
exclude)
line=$(echo $line | sed -e "s/exclude://g" -e 's/^[ \t]//;s/[ \t]$//')
excluded_tests="${excluded_tests} $line"
;;
expected-fail)
line=$(echo $line | sed -e "s/expected-fail://g" -e 's/^[ \t]//;s/[ \t]$//')
expected_fails="${expected_fails} $line"
;;
indeterminate)
line=$(echo $line | sed -e "s/indeterminate://g" -e 's/^[ \t]//;s/[ \t]$//')
indeterminates="${indeterminates} $line"
;;
*)
echo "error: invalid test state: $state in $td" 1>&2
echo "INVALID-TEST-DATA"
exit 1
;;
esac
fi
done
done
testdata=$ntd
done
for t in ${tests};
do
case ${mode} in
exclude)
allow="yes"
for dt in ${excluded_tests};
do
if test ${t} = ${dt}; then
allow="no"
fi
done
if test ${allow} = yes; then
output="${output} ${t}"
fi
;;
flags)
allow="no"
for et in ${expected_fails};
do
if test ${t} = ${et}; then
allow="yes"
fi
done
if test ${allow} = yes; then
output="-DTEST_STATE_EXPECTED_FAIL=1"
fi
allow="no"
for it in ${indeterminates};
do
if test ${t} = ${it}; then
allow="yes"
fi
done
if test ${allow} = yes; then
output="${output} -DTEST_STATE_INDETERMINATE=1"
fi
;;
*)
echo "error: invalid mode" 1>&2
echo "INVALID-TEST-DATA"
exit 1
;;
esac
done
fi
echo ${output}
exit 0
|