[Gluster-devel] Bug in EXPECT family of macros in test framework
Xavier Hernandez
xhernandez at datalab.es
Tue Jan 27 11:35:35 UTC 2015
Hi,
I've just discovered that EXPECT, EXPECT_WITHIN and others have a bug
that can hide some failures.
The problem is that the test is made using a regular expression
comparison. For example, EXPECT checks this:
if ! [[ "$a" =~ $e ]]; then
There are some tests that use a regular expression as the first argument
to EXPECT, however there are many other tests that simply use a number
or a text.
This can cause problems. For example if the test is:
EXPECT "0" <test>
And the test returns 10, the regular expression "0" *will* match with
"10", so the test will be considered successful when it shouldn't.
It will also report success for test cases that check for an empty result:
EXPECT "" <test>
This will always succeed, even if the test returns something.
What would be the best approach to solve this ?
Xavi
More information about the Gluster-devel
mailing list