Re: Did check 0.15.x in rawhide break packages' test suites?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Aug 2, 2020 at 9:55 AM Fabio Valentini <decathorpe@xxxxxxxxx> wrote:
> I'm looking through F33 FTBFS issues, and I see an increasing number
> of packages that fail to build because their test suites (using check)
> fail to build with errors like this:
>
> /usr/include/check.h:502:27: note: declared here
>   502 | CK_DLL_EXP void CK_EXPORT _ck_assert_failed(const char *file, int line,
>       |                           ^~~~~~~~~~~~~~~~~
> path_utils/path_utils_ut.c:698:3: error: too few arguments to function
> '_ck_assert_failed'
>
> For example, gsignond-plugin-oauth, gsignond-plugin-sasl,
> libaccounts-glib, signon-glib, ding-libs fail with these issues.
>
> Any idea if that's a problem with the "check" 0.15.x builds
> themselves, or if packages need to adapt to changed API here?

You can point the finger of blame at least partly at me for this.
Version 0.15.0 of check introduced the use of
__attribute__((printf....)) to check the arguments to some of the
calls.  However, upstream didn't do it right, with the result that gcc
warned on pretty much every use of the check macros.  I submitted a
patch upstream to fix that, which upstream applied and included in
version 0.15.1.  That patch, however, broke other things, such as the
ability to call fail_if() with only one argument.

I've been working on another patch to fix *that*.  It's not too hard
to do for gcc, which makes __VA_OPT__ available to the C compiler, but
not so easy for the Microsoft compiler.  I'll attach what I have so
far.  Comments or suggestions on how to make it better are much
appreciated.  I would like to submit something upstream by tomorrow.
If upstream likes the idea, I'll do another build of check that
includes the patch.
-- 
Jerry James
http://www.jamezone.org/
diff --git a/src/check.h.in b/src/check.h.in
index 56187fb..000a31e 100644
--- a/src/check.h.in
+++ b/src/check.h.in
@@ -92,6 +92,17 @@ CK_CPPSTART
 
 #undef GCC_VERSION_AT_LEAST
 
+#define CK_THIRD_ARG(x,y,z,...) z
+#define CK_HAS_VA_OPT_I(...) CK_THIRD_ARG(__VA_OPT__(,),1,0,)
+#define CK_HAS_VA_OPT CK_HAS_VA_OPT_I(?)
+
+#if CK_HAS_VA_OPT
+#define CK_CALL(...)    NULL
+#define CK_CALL_ARGS(...) __VA_ARGS__
+#define CK_CHOOSE_CALLER(...) CK_CALL ## __VA_OPT__(_ARGS)
+#define CK_ARGS(...) CK_CHOOSE_CALLER(__VA_ARGS__)(__VA_ARGS__)
+#endif
+
 #include <sys/types.h>
 
 #if defined(_MSC_VER)
@@ -478,10 +489,17 @@ static void __testname ## _fn (int _i CK_ATTRIBUTE_UNUSED)
  * FIXME: these macros may conflict with C89 if expr is
  * FIXME:   strcmp (str1, str2) due to excessive string length.
  */
+#if CK_HAS_VA_OPT
 #define fail_if(expr, ...)\
   (expr) ? \
-     _ck_assert_failed(__FILE__, __LINE__, "Failure '"#expr"' occurred" , ## __VA_ARGS__) \
+     _ck_assert_failed(__FILE__, __LINE__, "Failure '"#expr"' occurred", CK_ARGS(__VA_ARGS__)) \
      : _mark_point(__FILE__, __LINE__)
+#else
+#define fail_if(expr, ...)\
+  (expr) ? \
+     _ck_assert_failed(__FILE__, __LINE__, "Failure '"#expr"' occurred" , ## __VA_ARGS__, NULL) \
+     : _mark_point(__FILE__, __LINE__)
+#endif
 
 /*
  * Fail the test
@@ -532,10 +550,17 @@ CK_DLL_EXP void CK_EXPORT _ck_assert_failed(const char *file, int line,
  *
  * @since 0.9.6
  */
+#if CK_HAS_VA_OPT
 #define ck_assert_msg(expr, ...) \
   (expr) ? \
      _mark_point(__FILE__, __LINE__) : \
-     _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__)
+     _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed", CK_ARGS(__VA_ARGS__))
+#else
+#define ck_assert_msg(expr, ...) \
+  (expr) ? \
+     _mark_point(__FILE__, __LINE__) : \
+     _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)
+#endif
 
 /**
  * Unconditionally fail the test
@@ -554,7 +579,11 @@ CK_DLL_EXP void CK_EXPORT _ck_assert_failed(const char *file, int line,
  *
  * @since 0.9.6
  */
-#define ck_abort_msg(...) _ck_assert_failed(__FILE__, __LINE__, "Failed" , ## __VA_ARGS__)
+#if CK_HAS_VA_OPT
+#define ck_abort_msg(...) _ck_assert_failed(__FILE__, __LINE__, "Failed", CK_ARGS(__VA_ARGS__))
+#else
+#define ck_abort_msg(...) _ck_assert_failed(__FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL)
+#endif
 
 /* Signed and unsigned integer comparison macros with improved output compared to ck_assert(). */
 /* OP may be any comparison operator. */
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux