backport patch from upstream

This commit is contained in:
zhangruifang2020 2024-08-01 20:18:02 +08:00
parent ba528fe723
commit ed5622c590
2 changed files with 94 additions and 1 deletions

View File

@ -0,0 +1,88 @@
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

View File

@ -1,11 +1,13 @@
Name: libcomps
Version: 0.1.19
Release: 1
Release: 2
Summary: Comps XML file manipulation library
License: GPLv2+
URL: https://github.com/rpm-software-management/libcomps
Source0: %{url}/archive/refs/tags/%{version}.tar.gz
Patch6000: backport-tests-Don-t-print-parsing-errors-during-tests.patch
BuildRequires: gcc gcc-c++ cmake zlib-devel libxml2-devel check-devel expat-devel
%description
@ -89,6 +91,9 @@ popd
%{python3_sitearch}/%{name}-%{version}-py%{python3_version}.egg-info
%changelog
* Thu Aug 01 2024 zhangruifang <zhangruifang@h-partners.com> - 0.1.19-2
- backport patch from upstream
* Sat Jan 28 2023 fuanan <fuanan3@h-partners.com> - 0.1.19-1
- Type:update
- ID:NA