diff options
| author | Pranith Kumar K <pkarampu@redhat.com> | 2014-07-04 11:23:12 +0530 | 
|---|---|---|
| committer | Niels de Vos <ndevos@redhat.com> | 2014-07-04 00:44:00 -0700 | 
| commit | bf737d691cf812b40594e64c4c52f3c677a04e35 (patch) | |
| tree | b1170b8bf27435668c4ea59b34e0ad65d54ee512 | |
| parent | f25c549c959e06e70eefc5744dc5f93668411de2 (diff) | |
tests: support regex in EXPECT constructs
            Backport of http://review.gluster.org/6788
Instead of just strings, provide the ability to specify a regex
of the pattern to expect
Change-Id: I288db2290612accd795c3498f74e8b70bab21f2c
BUG: 1115369
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8235
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
| -rw-r--r-- | tests/include.rc | 8 | 
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/include.rc b/tests/include.rc index 41c4f332982..a1713880d84 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -68,10 +68,10 @@ function test_expect_footer()          local a=$2          local err="" -        if [ "x${e}" != "x${a}" ]; then +        if ! [[ "$a" =~ $e ]]; then                  err="Got \"$a\" instead of \"$e\""          fi -        [[ "x${e}" == "x${a}" ]]; +        [[ "$a" =~ $e ]];          test_footer "$err";  } @@ -97,11 +97,11 @@ function test_expect_not_footer()          local a=$2          local err="" -        if [ "x${e}" == "x${a}" ]; then +        if [[ "$a" =~ $e ]]; then                  err="Got \"$a\" when not expecting it"          fi -        [[ "x${e}" != "x${a}" ]]; +        ! [[ "$a" =~ "$e" ]];          test_footer "$err";  }  | 
