Blob Blame History Raw
From 9f9a3ded23cc2bb917468939b745cc498cec523a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michal=20=C5=BDidek?= <mzidek@redhat.com>
Date: Wed, 1 Aug 2018 17:48:10 +0200
Subject: [PATCH] validators_ut_check: Fix fail with new glibc

Error message was slightly change from previous version
of glibc which caused fails in validators unit tests.

Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
---
 ini/ini_validators_ut_check.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/ini/ini_validators_ut_check.c b/ini/ini_validators_ut_check.c
index 9ecde75..3af8551 100644
--- a/ini/ini_validators_ut_check.c
+++ b/ini/ini_validators_ut_check.c
@@ -602,6 +602,8 @@ START_TEST(test_ini_allowed_options_wrong_regex)
     fail_unless(ret == 0, "Got msg: [%s]", errmsg);
     ini_errobj_next(errobj);
 
+    /* Different versions of libc produce slightly different error strings
+     * in this case. For simplicity compare against all of them. */
     errmsg = ini_errobj_get_msg(errobj);
     ret = strcmp(errmsg,
                  "[rule/options_for_foo]: Cannot compile regular expression "
@@ -609,10 +611,17 @@ START_TEST(test_ini_allowed_options_wrong_regex)
                  "Error: 'Unmatched [ or [^'");
     if (ret != 0) {
         ret = strcmp(errmsg,
-                     "[rule/options_for_foo]: Cannot compile regular expression "
-                     "from option 'section_re'. "
+                     "[rule/options_for_foo]: Cannot compile regular "
+		     "expression from option 'section_re'. "
                      "Error: 'brackets ([ ]) not balanced'");
     }
+
+    if (ret != 0) {
+         ret = strcmp(errmsg,
+                     "[rule/options_for_foo]: Cannot compile regular "
+		     "expression from option 'section_re'. "
+		     "Error: 'Unmatched [, [^, [:, [., or [='");
+    }
     fail_unless(ret == 0, "Got msg: [%s]", errmsg);
     ini_errobj_next(errobj);
 
-- 
2.9.5