Projet

Général

Profil

Support #39101

lasso unit tests don't compile with check 0.13.x

Ajouté par Jakub Hrozek il y a environ 4 ans. Mis à jour il y a presque 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
Début:
20 janvier 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Non
Planning:
Non

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.


Fichiers

Révisions associées

Révision 6a0708ed (diff)
Ajouté par Benjamin Dauvergne il y a environ 4 ans

tests: fix compilation with check>0.12 (#39101)

Historique

#1

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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.

#2

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

  • Statut changé de Nouveau à Information nécessaire
  • Assigné à mis à Jakub Hrozek
#3

Mis à jour par Jakub Hrozek il y a environ 4 ans

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).

#4

Mis à jour par Jakub Hrozek il y a environ 4 ans

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);
+

#5

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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.

#6

Mis à jour par Jakub Hrozek il y a environ 4 ans

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

#7

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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 ?

#8

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

  • Statut changé de Information nécessaire à En cours
  • Assigné à changé de Jakub Hrozek à 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.

#9

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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);
        }

#10

Mis à jour par Jakub Hrozek il y a environ 4 ans

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

#11

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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);
        }

#12

Mis à jour par Jakub Hrozek il y a environ 4 ans

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')                        

#13

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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);
        }

#14

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

Still here ?

#15

Mis à jour par Jakub Hrozek il y a environ 4 ans

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                

#16

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

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.

#17

Mis à jour par Benjamin Dauvergne il y a environ 4 ans

  • Statut changé de En cours à 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)

#18

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

  • Version cible mis à 2.6.1
#19

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

  • Statut changé de Résolu (à déployer) à Fermé

Formats disponibles : Atom PDF