Bug in EXPECT family of macros in test framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
_______________________________________________
Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
http://www.gluster.org/mailman/listinfo/gluster-devel




[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux