commit:     195e1a3fde15d42f068a398f95c1211ff1f2fa09
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 19 04:12:04 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Nov 19 04:14:08 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=195e1a3f

x11-libs/libxcb: Fix tests with dev-libs/check >= 0.15

Closes: https://bugs.gentoo.org/746884
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 ...on-t-use-deprecated-fail_unless-check-API.patch | 86 ++++++++++++++++++++++
 x11-libs/libxcb/libxcb-1.14.ebuild                 |  4 +
 2 files changed, 90 insertions(+)

diff --git 
a/x11-libs/libxcb/files/libxcb-1.14-tests-don-t-use-deprecated-fail_unless-check-API.patch
 
b/x11-libs/libxcb/files/libxcb-1.14-tests-don-t-use-deprecated-fail_unless-check-API.patch
new file mode 100644
index 00000000000..cc7f22ba4e9
--- /dev/null
+++ 
b/x11-libs/libxcb/files/libxcb-1.14-tests-don-t-use-deprecated-fail_unless-check-API.patch
@@ -0,0 +1,86 @@
+From f01f3c378eb0168fbb055c7be1c2d08a7acd3752 Mon Sep 17 00:00:00 2001
+From: Ran Benita <[email protected]>
+Date: Tue, 17 Nov 2020 23:43:06 +0200
+Subject: [PATCH] tests: don't use deprecated fail_unless check API
+
+It causes errors like this when running make check:
+
+check_public.c:40:24: error: too many arguments for format 
[-Werror=format-extra-args]
+   40 |   fail_unless(success, "unexpected parse failure %sfor '%s'", 
test_string[test_type], name);
+
+Closes: https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/49
+Tested-by: Matt Turner <[email protected]>
+Signed-off-by: Ran Benita <[email protected]>
+---
+ configure.ac         |  2 +-
+ tests/check_public.c | 30 +++++++++++++++---------------
+ 2 files changed, 16 insertions(+), 16 deletions(-)
+
+diff --git a/tests/check_public.c b/tests/check_public.c
+index 2094bfe..aed40c8 100644
+--- a/tests/check_public.c
++++ b/tests/check_public.c
+@@ -37,18 +37,18 @@ static void parse_display_pass(const char *name, const 
char *host, const int dis
+               got_display = got_screen = -42;
+               mark_point();
+               success = xcb_parse_display(argument, &got_host, &got_display, 
&got_screen);
+-              fail_unless(success, "unexpected parse failure %sfor '%s'", 
test_string[test_type], name);
+-              fail_unless(strcmp(host, got_host) == 0, "parse %sproduced 
unexpected hostname '%s' for '%s': expected '%s'", test_string[test_type], 
got_host, name, host);
+-              fail_unless(display == got_display, "parse %sproduced 
unexpected display '%d' for '%s': expected '%d'", test_string[test_type], 
got_display, name, display);
+-              fail_unless(screen == got_screen, "parse %sproduced unexpected 
screen '%d' for '%s': expected '%d'", test_string[test_type], got_screen, name, 
screen);
++              ck_assert_msg(success, "unexpected parse failure %sfor '%s'", 
test_string[test_type], name);
++              ck_assert_msg(strcmp(host, got_host) == 0, "parse %sproduced 
unexpected hostname '%s' for '%s': expected '%s'", test_string[test_type], 
got_host, name, host);
++              ck_assert_msg(display == got_display, "parse %sproduced 
unexpected display '%d' for '%s': expected '%d'", test_string[test_type], 
got_display, name, display);
++              ck_assert_msg(screen == got_screen, "parse %sproduced 
unexpected screen '%d' for '%s': expected '%d'", test_string[test_type], 
got_screen, name, screen);
+ 
+               got_host = (char *) -1;
+               got_display = got_screen = -42;
+               mark_point();
+               success = xcb_parse_display(argument, &got_host, &got_display, 
0);
+-              fail_unless(success, "unexpected screenless parse failure %sfor 
'%s'", test_string[test_type], name);
+-              fail_unless(strcmp(host, got_host) == 0, "screenless parse 
%sproduced unexpected hostname '%s' for '%s': expected '%s'", 
test_string[test_type], got_host, name, host);
+-              fail_unless(display == got_display, "screenless parse 
%sproduced unexpected display '%d' for '%s': expected '%d'", 
test_string[test_type], got_display, name, display);
++              ck_assert_msg(success, "unexpected screenless parse failure 
%sfor '%s'", test_string[test_type], name);
++              ck_assert_msg(strcmp(host, got_host) == 0, "screenless parse 
%sproduced unexpected hostname '%s' for '%s': expected '%s'", 
test_string[test_type], got_host, name, host);
++              ck_assert_msg(display == got_display, "screenless parse 
%sproduced unexpected display '%d' for '%s': expected '%d'", 
test_string[test_type], got_display, name, display);
+       }
+       putenv("DISPLAY=");
+ }
+@@ -79,18 +79,18 @@ static void parse_display_fail(const char *name)
+               got_display = got_screen = -42;
+               mark_point();
+               success = xcb_parse_display(argument, &got_host, &got_display, 
&got_screen);
+-              fail_unless(!success, "unexpected parse success %sfor '%s'", 
test_string[test_type], name);
+-              fail_unless(got_host == (char *) -1, "host changed on parse 
failure %sfor '%s': got %p", test_string[test_type], name, got_host);
+-              fail_unless(got_display == -42, "display changed on parse 
failure %sfor '%s': got %d", test_string[test_type], name, got_display);
+-              fail_unless(got_screen == -42, "screen changed on parse failure 
%sfor '%s': got %d", test_string[test_type], name, got_screen);
++              ck_assert_msg(!success, "unexpected parse success %sfor '%s'", 
test_string[test_type], name);
++              ck_assert_msg(got_host == (char *) -1, "host changed on parse 
failure %sfor '%s': got %p", test_string[test_type], name, got_host);
++              ck_assert_msg(got_display == -42, "display changed on parse 
failure %sfor '%s': got %d", test_string[test_type], name, got_display);
++              ck_assert_msg(got_screen == -42, "screen changed on parse 
failure %sfor '%s': got %d", test_string[test_type], name, got_screen);
+ 
+               got_host = (char *) -1;
+               got_display = got_screen = -42;
+               mark_point();
+               success = xcb_parse_display(argument, &got_host, &got_display, 
0);
+-              fail_unless(!success, "unexpected screenless parse success 
%sfor '%s'", test_string[test_type], name);
+-              fail_unless(got_host == (char *) -1, "host changed on parse 
failure %sfor '%s': got %p", test_string[test_type], name, got_host);
+-              fail_unless(got_display == -42, "display changed on parse 
failure %sfor '%s': got %d", test_string[test_type], name, got_display);
++              ck_assert_msg(!success, "unexpected screenless parse success 
%sfor '%s'", test_string[test_type], name);
++              ck_assert_msg(got_host == (char *) -1, "host changed on parse 
failure %sfor '%s': got %p", test_string[test_type], name, got_host);
++              ck_assert_msg(got_display == -42, "display changed on parse 
failure %sfor '%s': got %d", test_string[test_type], name, got_display);
+       }
+       putenv("DISPLAY=");
+ }
+@@ -183,7 +183,7 @@ END_TEST
+ 
+ static void popcount_eq(uint32_t bits, int count)
+ {
+-      fail_unless(xcb_popcount(bits) == count, "unexpected popcount(%08x) != 
%d", bits, count);
++      ck_assert_msg(xcb_popcount(bits) == count, "unexpected popcount(%08x) 
!= %d", bits, count);
+ }
+ 
+ START_TEST(popcount)
+-- 
+2.26.2
+

diff --git a/x11-libs/libxcb/libxcb-1.14.ebuild 
b/x11-libs/libxcb/libxcb-1.14.ebuild
index fce6c58c9a1..979e3d9e189 100644
--- a/x11-libs/libxcb/libxcb-1.14.ebuild
+++ b/x11-libs/libxcb/libxcb-1.14.ebuild
@@ -34,6 +34,10 @@ BDEPEND="${PYTHON_DEPS}
        $(python_gen_any_dep '>=x11-base/xcb-proto-1.14[${PYTHON_USEDEP}]')
 "
 
+PATCHES=(
+       
"${FILESDIR}"/${P}-tests-don-t-use-deprecated-fail_unless-check-API.patch
+)
+
 python_check_deps() {
        has_version -b ">=x11-base/xcb-proto-1.14[${PYTHON_USEDEP}]"
 }

Reply via email to