Support #39101
lasso unit tests don't compile with check 0.13.x
0%
Description
With the update of the "check" unit test library to 0.13 we're seeing compilation errors on Fedora. A proposed patch is attached.
Files
Associated revisions
History
Updated by Benjamin Dauvergne about 5 years ago
Could you report the compiler errors here ? Problem does not seem to be related with the version of check but more with the version of gcc.
Updated by Benjamin Dauvergne about 5 years ago
- Status changed from Nouveau to Information nécessaire
- Assignee set to Jakub Hrozek
Updated by Jakub Hrozek about 5 years ago
Benjamin Dauvergne a écrit :
Could you report the compiler errors here ? Problem does not seem to be related with the version of check but more with the version of gcc.
It is possible, the reason I was suspecting check was that on my Fedora-30 machine, I was initially unable to reproduce the error, but then after upgrading to check and check-devel from Fedora-32, the error appeared. All the details are here:
https://bugzilla.redhat.com/show_bug.cgi?id=1778645 (I hope all the information are visible even if you don't have a RH bugzilla account).
Updated by Jakub Hrozek about 5 years ago
Jakub Hrozek a écrit :
Benjamin Dauvergne a écrit :
Could you report the compiler errors here ? Problem does not seem to be related with the version of check but more with the version of gcc.
It is possible, the reason I was suspecting check was that on my Fedora-30 machine, I was initially unable to reproduce the error, but then after upgrading to check and check-devel from Fedora-32, the error appeared. All the details are here:
https://bugzilla.redhat.com/show_bug.cgi?id=1778645 (I hope all the information are visible even if you don't have a RH bugzilla account).
Aaaand of course I screwed up and copy-pasted the same TestCase all over. Sorry, I'll fix that:
+ tcase_add_test(tc_googleapps_27092010, test01_googleapps_27092010);
+ tcase_add_test(tc_googleapps_27092010, indexed_endpoints_20101008);
+ tcase_add_test(tc_googleapps_27092010, remove_warning_when_parssing_unknown_SNIPPET_LIST_NODES_20111007);
+ tcase_add_test(tc_googleapps_27092010, wrong_endpoint_index_in_artifacts);
+ tcase_add_test(tc_googleapps_27092010, malformed_logout_request);
+
Updated by Benjamin Dauvergne about 5 years ago
Looking at the error I'm pretty it's related to gcc 10 which seems used in Fedora 32 and the specific compiler flags used. I looked at the build error (https://koschei.fedoraproject.org/build/7108742) but it does not report difference in GCC version.
Updated by Jakub Hrozek about 5 years ago
Benjamin Dauvergne a écrit :
Looking at the error I'm pretty it's related to gcc 10 which seems used in Fedora 32 and the specific compiler flags used. I looked at the build error (https://koschei.fedoraproject.org/build/7108742) but it does not report difference in GCC version.
Perhaps, but I saw the error also locally with the combination of gcc-9.2.1-1.fc30.x86_64 and check-devel-0.13.0-2.fc32.x86_64
Updated by Benjamin Dauvergne about 5 years ago
Jakub Hrozek a écrit :
Benjamin Dauvergne a écrit :
Looking at the error I'm pretty it's related to gcc 10 which seems used in Fedora 32 and the specific compiler flags used. I looked at the build error (https://koschei.fedoraproject.org/build/7108742) but it does not report difference in GCC version.
Perhaps, but I saw the error also locally with the combination of gcc-9.2.1-1.fc30.x86_64 and check-devel-0.13.0-2.fc32.x86_64
Ok, I'm going to look what changed between 0.12 and 0.13, in the meantime could you report here flags between a working compilation and a failing one for the same file ?
Updated by Benjamin Dauvergne about 5 years ago
- Status changed from Information nécessaire to En cours
- Assignee changed from Jakub Hrozek to Benjamin Dauvergne
Ok don't bother I found the breaking change :
#define START_TEST(__testname)\ -static void __testname (int _i CK_ATTRIBUTE_UNUSED)\ -{\ - tcase_fn_start (""# __testname, __FILE__, __LINE__); +static void __testname ## _fn (int _i CK_ATTRIBUTE_UNUSED);\ +static const TTest __testname ## _ttest = {""# __testname, __testname ## _fn, __FILE__, __LINE__};\ +static const TTest * __testname = & __testname ## _ttest;\ +static void __testname ## _fn (int _i CK_ATTRIBUTE_UNUSED)
__testname is not a function anymore, it's a struct referencing the test function.
Updated by Benjamin Dauvergne about 5 years ago
Could you test the following patch on Fedora32 ?
diff --git tests/non_regression_tests.c tests/non_regression_tests.c index d2993ecd..0f9070a1 100644 --- tests/non_regression_tests.c +++ tests/non_regression_tests.c @@ -235,7 +235,11 @@ END_TEST struct { char *name; - void *function; +#if (CHECK_MAJOR_VERSION > 0) || (CHECK_MINOR_VERSION > 12) + TTest *test; +#else + void *test; +#endif } tests[] = { { "Googleapps error from coudot@ on 27-09-2010", test01_googleapps_27092010}, { "Wrong assertionConsumer ordering on 08-10-2010", indexed_endpoints_20101008}, @@ -252,8 +256,7 @@ non_regression_suite() for (i = 0 ; i < G_N_ELEMENTS(tests); i++) { TCase *c = tcase_create(tests[i].name); - void *f = tests[i].function; - tcase_add_test(c, f); + tcase_add_test(c, tests[i].test); suite_add_tcase(s, c); }
Updated by Jakub Hrozek about 5 years ago
Benjamin Dauvergne a écrit :
Could you test the following patch on Fedora32 ?
[...]
I'm sorry, but this doesn't seem to be working. I'm getting:
make[3]: Nothing to be done for 'all'. non_regression_tests.c:244:51: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 244 | { "Googleapps error from coudot@ on 27-09-2010", test01_googleapps_27092010}, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:244:51: error: initializer element is not constant non_regression_tests.c:244:51: note: (near initialization for 'tests[0].test') non_regression_tests.c:245:54: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 245 | { "Wrong assertionConsumer ordering on 08-10-2010", indexed_endpoints_20101008}, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:245:54: error: initializer element is not constant non_regression_tests.c:245:54: note: (near initialization for 'tests[1].test') non_regression_tests.c:246:83: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 246 | { "Warning when parsing AttributeValue node containing unknown namespace nodes", remove_warning_when_parssing_unknown_SNIPPET_LIST_NODES_20111007 }, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:246:83: error: initializer element is not constant non_regression_tests.c:246:83: note: (near initialization for 'tests[2].test') non_regression_tests.c:247:41: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 247 | { "Wrong endpoint index in artifacts", wrong_endpoint_index_in_artifacts }, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:247:41: error: initializer element is not constant non_regression_tests.c:247:41: note: (near initialization for 'tests[3].test') non_regression_tests.c:248:32: warning: initialization discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] 248 | { "Malformed logout request", malformed_logout_request }, | ^~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:248:32: error: initializer element is not constant non_regression_tests.c:248:32: note: (near initialization for 'tests[4].test') make[3]: *** [Makefile:815: non_regression_tests.o] Error 1
Updated by Benjamin Dauvergne about 5 years ago
My bad I forgot the test qualifier, and with this one ?
diff --git tests/non_regression_tests.c tests/non_regression_tests.c index d2993ecd..a6bd88fe 100644 --- tests/non_regression_tests.c +++ tests/non_regression_tests.c @@ -235,7 +235,11 @@ END_TEST struct { char *name; - void *function; +#if (CHECK_MAJOR_VERSION > 0) || (CHECK_MINOR_VERSION > 12) + const TTest *test; +#else + void *test; +#endif } tests[] = { { "Googleapps error from coudot@ on 27-09-2010", test01_googleapps_27092010}, { "Wrong assertionConsumer ordering on 08-10-2010", indexed_endpoints_20101008}, @@ -252,8 +256,7 @@ non_regression_suite() for (i = 0 ; i < G_N_ELEMENTS(tests); i++) { TCase *c = tcase_create(tests[i].name); - void *f = tests[i].function; - tcase_add_test(c, f); + tcase_add_test(c, tests[i].test); suite_add_tcase(s, c); }
Updated by Jakub Hrozek about 5 years ago
Benjamin Dauvergne a écrit :
My bad I forgot the test qualifier, and with this one ?
[...]
I'm getting a different error now:
make[3]: Entering directory '/home/jhrozek/devel/dist-git/lasso/lasso-2.6.0/tests' non_regression_tests.c:244:51: error: initializer element is not constant 244 | { "Googleapps error from coudot@ on 27-09-2010", test01_googleapps_27092010}, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:244:51: note: (near initialization for 'tests[0].test') non_regression_tests.c:245:54: error: initializer element is not constant 245 | { "Wrong assertionConsumer ordering on 08-10-2010", indexed_endpoints_20101008}, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:245:54: note: (near initialization for 'tests[1].test') non_regression_tests.c:246:83: error: initializer element is not constant 246 | { "Warning when parsing AttributeValue node containing unknown namespace nodes", remove_warning_when_parssing_unknown_SNIPPET_LIST_NODES_20111007 }, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:246:83: note: (near initialization for 'tests[2].test') non_regression_tests.c:247:41: error: initializer element is not constant 247 | { "Wrong endpoint index in artifacts", wrong_endpoint_index_in_artifacts }, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:247:41: note: (near initialization for 'tests[3].test') non_regression_tests.c:248:32: error: initializer element is not constant 248 | { "Malformed logout request", malformed_logout_request }, | ^~~~~~~~~~~~~~~~~~~~~~~~ non_regression_tests.c:248:32: note: (near initialization for 'tests[4].test')
Updated by Benjamin Dauvergne about 5 years ago
Ok the problem is the global declaration, and this one :
diff --git tests/non_regression_tests.c tests/non_regression_tests.c index d2993ecd..d6ceffd3 100644 --- tests/non_regression_tests.c +++ tests/non_regression_tests.c @@ -233,27 +233,26 @@ START_TEST(malformed_logout_request) } END_TEST -struct { - char *name; - void *function; -} tests[] = { - { "Googleapps error from coudot@ on 27-09-2010", test01_googleapps_27092010}, - { "Wrong assertionConsumer ordering on 08-10-2010", indexed_endpoints_20101008}, - { "Warning when parsing AttributeValue node containing unknown namespace nodes", remove_warning_when_parssing_unknown_SNIPPET_LIST_NODES_20111007 }, - { "Wrong endpoint index in artifacts", wrong_endpoint_index_in_artifacts }, - { "Malformed logout request", malformed_logout_request }, -}; - Suite* non_regression_suite() { + + struct { + char *name; + const void *test; + } tests[] = { + { "Googleapps error from coudot@ on 27-09-2010", test01_googleapps_27092010}, + { "Wrong assertionConsumer ordering on 08-10-2010", indexed_endpoints_20101008}, + { "Warning when parsing AttributeValue node containing unknown namespace nodes", remove_warning_when_parssing_unknown_SNIPPET_LIST_NODES_20111007 }, + { "Wrong endpoint index in artifacts", wrong_endpoint_index_in_artifacts }, + { "Malformed logout request", malformed_logout_request }, + }; Suite *s = suite_create("Non regression tests"); unsigned int i = 0; for (i = 0 ; i < G_N_ELEMENTS(tests); i++) { TCase *c = tcase_create(tests[i].name); - void *f = tests[i].function; - tcase_add_test(c, f); + tcase_add_test(c, tests[i].test); suite_add_tcase(s, c); }
Updated by Jakub Hrozek about 5 years ago
Benjamin Dauvergne a écrit :
Still here ?
I'm sorry for the delay. I was attending a conference for most of the week and forgot to reply here.
Nonetheless, I'm afraid even the last version of the patch does not help. I'm still getting:
non_regression_tests.c: In function 'non_regression_suite':
non_regression_tests.c:254:1: error: invalid use of void expression 254 | + tcase_add_test(c, tests[i].test); | ^ make[3]: *** [Makefile:815: non_regression_tests.o] Error 1 make[3]: Entering directory '/home/jhrozek/devel/dist-git/lasso/lasso-2.6.0/tests' CC non_regression_tests.o
Updated by Benjamin Dauvergne about 5 years ago
I'm developping under Debian and that's my only target, check 0.13 is not available on this platform, I'm not sure I will be able to finish this patch without it.
Updated by Benjamin Dauvergne almost 5 years ago
- Status changed from En cours to Résolu (à déployer)
commit 6a0708ed5c663fc07f9df5079ec09c0eb35c2689 Author: Benjamin Dauvergne <bdauvergne@entrouvert.com> Date: Thu Mar 26 20:19:25 2020 +0100 tests: fix compilation with check>0.12 (#39101)
Updated by Benjamin Dauvergne almost 5 years ago
- Status changed from Résolu (à déployer) to Fermé
tests: fix compilation with check>0.12 (#39101)