Blame SOURCES/0117-testsuite-do-not-expected-ureport-exiting-on-rhsm-ce.patch

0c9110
From 71b1c4b5322051320574f4de113e139e8aeb4b89 Mon Sep 17 00:00:00 2001
0c9110
From: Jakub Filak <jfilak@redhat.com>
0c9110
Date: Tue, 4 Nov 2014 15:29:06 +0100
0c9110
Subject: [LIBREPORT PATCH 117/118] testsuite: do not expected ureport exiting
0c9110
 on rhsm cert errors
0c9110
0c9110
Related #1140224
0c9110
0c9110
Signed-off-by: Jakub Filak <jfilak@redhat.com>
0c9110
---
0c9110
 tests/Makefile.am |  2 +-
0c9110
 tests/ureport.at  | 66 +++++++++++++++++++++++++++++++++++++++++--------------
0c9110
 2 files changed, 51 insertions(+), 17 deletions(-)
0c9110
0c9110
diff --git a/tests/Makefile.am b/tests/Makefile.am
0c9110
index cda9375..1cfc206 100644
0c9110
--- a/tests/Makefile.am
0c9110
+++ b/tests/Makefile.am
0c9110
@@ -49,7 +49,7 @@ TESTSUITE = $(srcdir)/testsuite
0c9110
 MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
0c9110
 check_DATA = atconfig atlocal $(TESTSUITE)
0c9110
 DISTCLEANFILES = atconfig
0c9110
-EXTRA_DIST += atlocal.in conf
0c9110
+EXTRA_DIST += atlocal.in conf ureport
0c9110
 
0c9110
 atconfig: $(top_builddir)/config.status
0c9110
 	(cd ${top_builddir} && ./config.status ${subdir}/atconfig)
0c9110
diff --git a/tests/ureport.at b/tests/ureport.at
0c9110
index 22d34e9..76e2f7a 100644
0c9110
--- a/tests/ureport.at
0c9110
+++ b/tests/ureport.at
0c9110
@@ -339,12 +339,24 @@ void set_ureport_server_config(struct ureport_server_config *config,
0c9110
 
0c9110
 void my_assert(const char *str1, const char *str2)
0c9110
 {
0c9110
-    if (str1 == NULL || str2 == NULL)
0c9110
-        assert( str1 == NULL && str2 == NULL );
0c9110
-    else
0c9110
-        assert(strcmp(str1, str2) == 0);
0c9110
+    if (str1 == str2)
0c9110
+        return;
0c9110
 
0c9110
-    return;
0c9110
+    if (str1 == NULL && str2 != NULL)
0c9110
+    {
0c9110
+        fprintf(stderr, "Assertion failed: NULL == '%s'\n", str2);
0c9110
+        abort();
0c9110
+    }
0c9110
+    else if (str1 != NULL && str2 == NULL)
0c9110
+    {
0c9110
+        fprintf(stderr, "Assertion failed: '%s' == NULL\n", str1);
0c9110
+        abort();
0c9110
+    }
0c9110
+    else if (strcmp(str1, str2) != 0)
0c9110
+    {
0c9110
+        fprintf(stderr, "Assertion failed: '%s' == '%s'\n", str1, str2);
0c9110
+        abort();
0c9110
+    }
0c9110
 }
0c9110
 
0c9110
 void assert_ureport_server_config(struct ureport_server_config *config,
0c9110
@@ -365,8 +377,10 @@ void assert_ureport_server_config(struct ureport_server_config *config,
0c9110
     return;
0c9110
 }
0c9110
 
0c9110
-int test_ureport_server_config_set_client_auth_exit_code(struct ureport_server_config *config,
0c9110
-                                                         const char *client_auth)
0c9110
+int test_ureport_server_config_set_client_auth_exit_code_ext(struct ureport_server_config *config,
0c9110
+                                                             const char *client_auth,
0c9110
+                                                             const char *cert_file,
0c9110
+                                                             const char *key_file)
0c9110
 {
0c9110
     ureport_server_config_init(config);
0c9110
 
0c9110
@@ -380,6 +394,8 @@ int test_ureport_server_config_set_client_auth_exit_code(struct ureport_server_c
0c9110
     if (pid == 0)
0c9110
     {
0c9110
         ureport_server_config_set_client_auth(config, client_auth);
0c9110
+        assert((cert_file == (void *)-1) || (cert_file == NULL && config->ur_client_cert == NULL) || (strcmp(cert_file, config->ur_client_cert) == 0));
0c9110
+        assert((key_file == (void *)-1) || (key_file == NULL && config->ur_client_cert == NULL) || (strcmp(key_file, config->ur_client_key) == 0));
0c9110
         exit(0);
0c9110
     }
0c9110
     int status;
0c9110
@@ -390,6 +406,12 @@ int test_ureport_server_config_set_client_auth_exit_code(struct ureport_server_c
0c9110
     return status;
0c9110
 }
0c9110
 
0c9110
+int test_ureport_server_config_set_client_auth_exit_code(struct ureport_server_config *config,
0c9110
+                                                         const char *client_auth)
0c9110
+{
0c9110
+    return test_ureport_server_config_set_client_auth_exit_code_ext(config, client_auth, (void *)-1, (void *)-1);
0c9110
+}
0c9110
+
0c9110
 int main(void)
0c9110
 {
0c9110
     g_verbose=3;
0c9110
@@ -418,8 +440,8 @@ int main(void)
0c9110
     assert(empty_cert_dir);
0c9110
     setenv("LIBREPORT_DEBUG_RHSMENT_PEM_DIR_PATH", empty_cert_dir, 1);
0c9110
 
0c9110
-    int status = test_ureport_server_config_set_client_auth_exit_code(&config, "rhsm");
0c9110
-    assert(status != 0 && status != -1);
0c9110
+    int status = test_ureport_server_config_set_client_auth_exit_code_ext(&config, "rhsm", NULL, NULL);
0c9110
+    assert(status == 0);
0c9110
 
0c9110
     assert(rmdir(empty_cert_dir) == 0);
0c9110
 
0c9110
@@ -429,8 +451,8 @@ int main(void)
0c9110
 
0c9110
     setenv("LIBREPORT_DEBUG_RHSMENT_PEM_DIR_PATH", TESTING_CERTS_INCORRECT_CONTENT_DIR_PATH, 1);
0c9110
 
0c9110
-    status = test_ureport_server_config_set_client_auth_exit_code(&config, "rhsm");
0c9110
-    assert(status != 0 && status != -1);
0c9110
+    status = test_ureport_server_config_set_client_auth_exit_code_ext(&config, "rhsm", NULL, NULL);
0c9110
+    assert(status == 0);
0c9110
 
0c9110
     /* client_auth == rhsm */
0c9110
     /* ur_url == NULL */
0c9110
@@ -548,12 +570,24 @@ AT_TESTFUN([ureport_server_config_set_basic_auth],
0c9110
 
0c9110
 void my_assert(const char *str1, const char *str2)
0c9110
 {
0c9110
-    if (str1 == NULL || str2 == NULL)
0c9110
-        assert( str1 == NULL && str2 == NULL );
0c9110
-    else
0c9110
-        assert(strcmp(str1, str2) == 0);
0c9110
+    if (str1 == str2)
0c9110
+        return;
0c9110
 
0c9110
-    return;
0c9110
+    if (str1 == NULL && str2 != NULL)
0c9110
+    {
0c9110
+        fprintf(stderr, "Assertion failed: NULL == '%s'\n", str2);
0c9110
+        abort();
0c9110
+    }
0c9110
+    else if (str1 != NULL && str2 == NULL)
0c9110
+    {
0c9110
+        fprintf(stderr, "Assertion failed: '%s' == NULL\n", str1);
0c9110
+        abort();
0c9110
+    }
0c9110
+    else if (strcmp(str1, str2) != 0)
0c9110
+    {
0c9110
+        fprintf(stderr, "Assertion failed: '%s' == '%s'\n", str1, str2);
0c9110
+        abort();
0c9110
+    }
0c9110
 }
0c9110
 
0c9110
 void assert_ureport_server_config(struct ureport_server_config *config,
0c9110
-- 
0c9110
1.8.3.1
0c9110