Blame SOURCES/0151-test_config_check-Fix-few-issues.patch

bb7cd1
From 15f997c22228f4b87a841148bf05c6911107879c Mon Sep 17 00:00:00 2001
bb7cd1
From: Lukas Slebodnik <lslebodn@redhat.com>
bb7cd1
Date: Wed, 31 May 2017 17:16:47 +0200
bb7cd1
Subject: [PATCH 151/152] test_config_check: Fix few issues
bb7cd1
MIME-Version: 1.0
bb7cd1
Content-Type: text/plain; charset=UTF-8
bb7cd1
Content-Transfer-Encoding: 8bit
bb7cd1
bb7cd1
* enable few tests
bb7cd1
* malformed configuration file due to missing closing ']'
bb7cd1
* fix few expected failures
bb7cd1
* add few sections into whitelist test
bb7cd1
* crash in test if count of expected failures is different then real
bb7cd1
  value
bb7cd1
bb7cd1
[ RUN      ] config_check_test_bad_subdom_option_name
bb7cd1
[rule/allowed_domain_options]: Attribute 'debug_leTYPOvel' is not allowed in section 'domain/A.test/B.A.test'. Check for typos.
bb7cd1
[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not allowed in section 'domain/A.test/B.A.test'. Check for typos.
bb7cd1
[  ERROR   ] --- Test failed with exception: Segmentation fault(11)
bb7cd1
bb7cd1
Reviewed-by: Michal Židek <mzidek@redhat.com>
bb7cd1
---
bb7cd1
 src/tests/cmocka/test_config_check.c | 14 ++++++++++----
bb7cd1
 1 file changed, 10 insertions(+), 4 deletions(-)
bb7cd1
bb7cd1
diff --git a/src/tests/cmocka/test_config_check.c b/src/tests/cmocka/test_config_check.c
bb7cd1
index bab3226c004fb9495471af7c7d3f6861552d8a86..0066ebe77e9f174449461caebdb3359380bc19b5 100644
bb7cd1
--- a/src/tests/cmocka/test_config_check.c
bb7cd1
+++ b/src/tests/cmocka/test_config_check.c
bb7cd1
@@ -81,6 +81,7 @@ void config_check_test_common(const char *cfg_string,
bb7cd1
         /* Keep this printf loop for faster debugging */
bb7cd1
         printf("%s\n", strs[i]);
bb7cd1
     }
bb7cd1
+    assert_int_equal(num_errors, num_errors_expected);
bb7cd1
 
bb7cd1
     for (int i = 0; i < num_errors && i <= num_errors_expected; i++) {
bb7cd1
         assert_string_equal(strs[i], errors_expected[i]);
bb7cd1
@@ -167,7 +168,7 @@ void config_check_test_bad_ifp_option_name(void **state)
bb7cd1
 
bb7cd1
 void config_check_test_bad_domain_option_name(void **state)
bb7cd1
 {
bb7cd1
-    char cfg_str[] = "[domain/A.test\n"
bb7cd1
+    char cfg_str[] = "[domain/A.test]\n"
bb7cd1
                      "debug_leTYPOvel = 10\n";
bb7cd1
     const char *expected_errors[] = {
bb7cd1
         "[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not "
bb7cd1
@@ -179,10 +180,10 @@ void config_check_test_bad_domain_option_name(void **state)
bb7cd1
 
bb7cd1
 void config_check_test_bad_appdomain_option_name(void **state)
bb7cd1
 {
bb7cd1
-    char cfg_str[] = "[application/myapp\n"
bb7cd1
+    char cfg_str[] = "[application/myapp]\n"
bb7cd1
                      "debug_leTYPOvel = 10\n";
bb7cd1
     const char *expected_errors[] = {
bb7cd1
-        "[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not "
bb7cd1
+        "[rule/allowed_domain_options]: Attribute 'debug_leTYPOvel' is not "
bb7cd1
         "allowed in section 'application/myapp'. Check for typos.",
bb7cd1
     };
bb7cd1
 
bb7cd1
@@ -194,7 +195,7 @@ void config_check_test_bad_subdom_option_name(void **state)
bb7cd1
     char cfg_str[] = "[domain/A.test/B.A.test]\n"
bb7cd1
                      "debug_leTYPOvel = 10\n";
bb7cd1
     const char *expected_errors[] = {
bb7cd1
-        "[rule/allowed_sssd_options]: Attribute 'debug_leTYPOvel' is not "
bb7cd1
+        "[rule/allowed_subdomain_options]: Attribute 'debug_leTYPOvel' is not "
bb7cd1
         "allowed in section 'domain/A.test/B.A.test'. Check for typos.",
bb7cd1
     };
bb7cd1
 
bb7cd1
@@ -210,6 +211,8 @@ void config_check_test_good_sections(void **state)
bb7cd1
                      "[domain/testdom.test/testsubdom.testdom.test]\n"
bb7cd1
                      "[application/myapp]\n"
bb7cd1
                      "[secrets]\n"
bb7cd1
+                     "[secrets/users/1000]\n"
bb7cd1
+                     "[ssh]\n"
bb7cd1
                      "[ifp]\n"
bb7cd1
                      "[pac]\n";
bb7cd1
     const char *expected_errors[] = { NULL };
bb7cd1
@@ -255,8 +258,11 @@ int main(int argc, const char *argv[])
bb7cd1
         cmocka_unit_test(config_check_test_bad_nss_option_name),
bb7cd1
         cmocka_unit_test(config_check_test_bad_pac_option_name),
bb7cd1
         cmocka_unit_test(config_check_test_bad_ifp_option_name),
bb7cd1
+        cmocka_unit_test(config_check_test_bad_appdomain_option_name),
bb7cd1
+        cmocka_unit_test(config_check_test_bad_subdom_option_name),
bb7cd1
         cmocka_unit_test(config_check_test_good_sections),
bb7cd1
         cmocka_unit_test(config_check_test_inherit_from_in_normal_dom),
bb7cd1
+        cmocka_unit_test(config_check_test_inherit_from_in_app_dom),
bb7cd1
     };
bb7cd1
 
bb7cd1
     /* Set debug level to invalid value so we can decide if -d 0 was used. */
bb7cd1
-- 
bb7cd1
2.9.4
bb7cd1