From 2899e8e49f9cbab70661e8ddf2c3ff743ffa97c2 Mon Sep 17 00:00:00 2001
From: Pavla Kratochvilova <pkratoch@redhat.com>
Date: Thu, 5 Oct 2023 10:43:16 +0200
Subject: [PATCH] tests: Don't print parsing errors during tests

The tests are unnecessarily chatty and print many errors that are actually
expected. In case of unexpected errors, it wouldn't print all of them
anyway, and would need to be enabled, since there are other parsers
initialized to not print the logs.
---
 libcomps/tests/check_comps.c |  2 +-
 libcomps/tests/check_parse.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libcomps/tests/check_comps.c b/libcomps/tests/check_comps.c
index 1455734..e14fd43 100644
--- a/libcomps/tests/check_comps.c
+++ b/libcomps/tests/check_comps.c
@@ -595,7 +595,7 @@ START_TEST(test_doc_defaults) {
     tmp = comps2xml_str(doc, NULL, NULL);
     //printf("tmp %s\n", tmp);
     parsed = comps_parse_parsed_create();
-    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
+    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
     comps_parse_str(parsed, tmp, NULL);
     doc2 = parsed->comps_doc;
     groups = comps_doc_groups(doc2);
diff --git a/libcomps/tests/check_parse.c b/libcomps/tests/check_parse.c
index e5935e1..cfa721c 100644
--- a/libcomps/tests/check_parse.c
+++ b/libcomps/tests/check_parse.c
@@ -72,7 +72,7 @@ START_TEST(test_comps_parse1)
     fprintf(stderr, "## Running test_parse1\n\n");
 
     parsed = comps_parse_parsed_create();
-    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
+    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
 
 
     fp = fopen("sample-comps.xml", "r");
@@ -171,7 +171,7 @@ START_TEST(test_comps_parse1)
     comps_parse_parsed_destroy(parsed);
 
     parsed = comps_parse_parsed_create();
-    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
+    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
     comps_parse_file(parsed, fp, NULL);
     ret = comps_parse_validate_dtd("sample-bad-elem.xml", "comps.dtd");
     fail_if(ret >0, "XML shouldn't be valid. Validation returned: %d", ret);
@@ -280,7 +280,7 @@ START_TEST(test_comps_parse2)
     //                                         COMPS_ERR_ELEM_REQUIRED, 1201, 2, 0);
 
     parsed = comps_parse_parsed_create();
-    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
+    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
     fp = fopen("sample_comps.xml", "r");
     comps_parse_file(parsed, fp, NULL);
 
@@ -320,7 +320,7 @@ START_TEST(test_comps_parse3)
                                              comps_num(188), comps_num(2));
 
     parsed = comps_parse_parsed_create();
-    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
+    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
     fp = fopen("sample_comps_bad1.xml", "r");
     comps_parse_file(parsed, fp, NULL);
 
@@ -413,7 +413,7 @@ START_TEST(test_comps_parse4)
                                      comps_num(1244), comps_num(4));
 
     parsed = comps_parse_parsed_create();
-    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
+    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
     fp = fopen("sample_comps_bad2.xml", "r");
     comps_parse_file(parsed, fp, NULL);
 
@@ -446,7 +446,7 @@ START_TEST(test_comps_parse5)
                                     comps_num(2));
 
     parsed = comps_parse_parsed_create();
-    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 1) == 0);
+    fail_if(comps_parse_parsed_init(parsed, "UTF-8", 0) == 0);
     fp = fopen("sample_comps_bad3.xml", "r");
     comps_parse_file(parsed, fp, NULL);
     //comps_log_print(parsed->log);
-- 
2.33.0

