Revision 79e40ab1 tests/qemu-iotests/common.filter
b/tests/qemu-iotests/common.filter | ||
---|---|---|
25 | 25 |
# Outputs suitable message to stdout if it's not in range. |
26 | 26 |
# |
27 | 27 |
# A verbose option, -v, may be used as the LAST argument |
28 |
#
|
|
29 |
# e.g.
|
|
28 |
# |
|
29 |
# e.g. |
|
30 | 30 |
# foo: 0.0298 = 0.03 +/- 5% |
31 |
# _within_tolerance "foo" 0.0298 0.03 5%
|
|
32 |
#
|
|
31 |
# _within_tolerance "foo" 0.0298 0.03 5% |
|
32 |
# |
|
33 | 33 |
# foo: 0.0298 = 0.03 +/- 0.01 |
34 | 34 |
# _within_tolerance "foo" 0.0298 0.03 0.01 |
35 | 35 |
# |
36 | 36 |
# foo: 0.0298 = 0.03 -0.01 +0.002 |
37 | 37 |
# _within_tolerance "foo" 0.0298 0.03 0.01 0.002 |
38 | 38 |
# |
39 |
# foo: verbose output of 0.0298 = 0.03 +/- 5%
|
|
40 |
# _within_tolerance "foo" 0.0298 0.03 5% -v
|
|
39 |
# foo: verbose output of 0.0298 = 0.03 +/- 5% |
|
40 |
# _within_tolerance "foo" 0.0298 0.03 5% -v |
|
41 | 41 |
_within_tolerance() |
42 | 42 |
{ |
43 | 43 |
_name=$1 |
... | ... | |
51 | 51 |
# maxtol arg is optional |
52 | 52 |
# verbose arg is optional |
53 | 53 |
if [ $# -ge 5 ] |
54 |
then
|
|
54 |
then |
|
55 | 55 |
if [ "$5" = "-v" ] |
56 | 56 |
then |
57 |
_verbose=1
|
|
57 |
_verbose=1
|
|
58 | 58 |
else |
59 | 59 |
_maxtol=$5 |
60 | 60 |
fi |
... | ... | |
65 | 65 |
fi |
66 | 66 |
|
67 | 67 |
# find min with or without % |
68 |
_mintolerance=`echo $_mintol | sed -e 's/%//'`
|
|
68 |
_mintolerance=`echo $_mintol | sed -e 's/%//'` |
|
69 | 69 |
if [ $_mintol = $_mintolerance ] |
70 |
then
|
|
70 |
then |
|
71 | 71 |
_min=`echo "scale=5; $_correct_val-$_mintolerance" | bc` |
72 | 72 |
else |
73 | 73 |
_min=`echo "scale=5; $_correct_val-$_mintolerance*0.01*$_correct_val" | bc` |
74 | 74 |
fi |
75 | 75 |
|
76 | 76 |
# find max with or without % |
77 |
_maxtolerance=`echo $_maxtol | sed -e 's/%//'`
|
|
77 |
_maxtolerance=`echo $_maxtol | sed -e 's/%//'` |
|
78 | 78 |
if [ $_maxtol = $_maxtolerance ] |
79 |
then
|
|
79 |
then |
|
80 | 80 |
_max=`echo "scale=5; $_correct_val+$_maxtolerance" | bc` |
81 | 81 |
else |
82 | 82 |
_max=`echo "scale=5; $_correct_val+$_maxtolerance*0.01*$_correct_val" | bc` |
... | ... | |
88 | 88 |
cat <<EOF >$tmp.bc.1 |
89 | 89 |
scale=5; |
90 | 90 |
if ($_min <= $_given_val) 1; |
91 |
if ($_min > $_given_val) 0;
|
|
91 |
if ($_min > $_given_val) 0; |
|
92 | 92 |
EOF |
93 | 93 |
|
94 | 94 |
cat <<EOF >$tmp.bc.2 |
... | ... | |
102 | 102 |
|
103 | 103 |
rm -f $tmp.bc.[12] |
104 | 104 |
|
105 |
_in_range=`expr $_above_min \& $_below_max`
|
|
105 |
_in_range=`expr $_above_min \& $_below_max` |
|
106 | 106 |
|
107 | 107 |
# fix up min, max precision for output |
108 | 108 |
# can vary for 5.3, 6.2 |
109 | 109 |
_min=`echo $_min | sed -e 's/0*$//'` # get rid of trailling zeroes |
110 | 110 |
_max=`echo $_max | sed -e 's/0*$//'` # get rid of trailling zeroes |
111 | 111 |
|
112 |
if [ $_in_range -eq 1 ]
|
|
112 |
if [ $_in_range -eq 1 ] |
|
113 | 113 |
then |
114 |
[ $_verbose -eq 1 ] && echo $_name is in range
|
|
115 |
return 0
|
|
114 |
[ $_verbose -eq 1 ] && echo $_name is in range
|
|
115 |
return 0
|
|
116 | 116 |
else |
117 |
[ $_verbose -eq 1 ] && echo $_name has value of $_given_val
|
|
118 |
[ $_verbose -eq 1 ] && echo $_name is NOT in range $_min .. $_max
|
|
119 |
return 1
|
|
117 |
[ $_verbose -eq 1 ] && echo $_name has value of $_given_val
|
|
118 |
[ $_verbose -eq 1 ] && echo $_name is NOT in range $_min .. $_max
|
|
119 |
return 1
|
|
120 | 120 |
fi |
121 | 121 |
} |
122 | 122 |
|
... | ... | |
125 | 125 |
_filter_date() |
126 | 126 |
{ |
127 | 127 |
sed \ |
128 |
-e 's/[A-Z][a-z][a-z] [A-z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/'
|
|
128 |
-e 's/[A-Z][a-z][a-z] [A-z][a-z][a-z] *[0-9][0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9][0-9][0-9][0-9]$/DATE/'
|
|
129 | 129 |
} |
130 | 130 |
|
131 | 131 |
# replace occurrences of the actual TEST_DIR value with TEST_DIR |
Also available in: Unified diff