diff mbox

[v2] qtest: fix make check complaint in crypto module

Message ID 1474534599-322216-1-git-send-email-arei.gonglei@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gonglei (Arei) Sept. 22, 2016, 8:56 a.m. UTC
CC    tests/test-crypto-tlscredsx509.o
  CC    tests/crypto-tls-x509-helpers.o
  CC    tests/pkix_asn1_tab.o
tests/pkix_asn1_tab.c:7:22: warning: libtasn1.h: No such file or directory
tests/pkix_asn1_tab.c:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pkix_asn1_tab’
make: *** [tests/pkix_asn1_tab.o] Error 1

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 v2: add condition check for TLS support (Daniel)
---
 tests/pkix_asn1_tab.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Daniel P. Berrangé Sept. 23, 2016, 10:20 a.m. UTC | #1
On Thu, Sep 22, 2016 at 04:56:39PM +0800, Gonglei wrote:
>   CC    tests/test-crypto-tlscredsx509.o
>   CC    tests/crypto-tls-x509-helpers.o
>   CC    tests/pkix_asn1_tab.o
> tests/pkix_asn1_tab.c:7:22: warning: libtasn1.h: No such file or directory
> tests/pkix_asn1_tab.c:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pkix_asn1_tab’
> make: *** [tests/pkix_asn1_tab.o] Error 1
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  v2: add condition check for TLS support (Daniel)
> ---
>  tests/pkix_asn1_tab.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tests/pkix_asn1_tab.c b/tests/pkix_asn1_tab.c
> index 903bc02..036e222b 100644
> --- a/tests/pkix_asn1_tab.c
> +++ b/tests/pkix_asn1_tab.c
> @@ -4,6 +4,14 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#if !(defined WIN32) && \
> +    defined(CONFIG_TASN1) && \
> +    (LIBGNUTLS_VERSION_NUMBER >= 0x020600)
> +#define QCRYPTO_HAVE_TLS_TEST_SUPPORT
> +#endif

This doesn't actually build

tests/pkix_asn1_tab.c:9:6: error: "LIBGNUTLS_VERSION_NUMBER" is not defined [-Werror=undef]
     (LIBGNUTLS_VERSION_NUMBER >= 0x020600)
      ^~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
/home/berrange/src/virt/qemu/rules.mak:60: recipe for target 'tests/pkix_asn1_tab.o' failed
make: *** [tests/pkix_asn1_tab.o] Error 1


This is because you missed the gnutls.h include. Rather than
repeating the condition here, you sould just #include the
existing tests/crypto-tls-x509-helpers.h header

> +
> +#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
> +
>  #include <libtasn1.h>
>  
>  const ASN1_ARRAY_TYPE pkix_asn1_tab[] = {
> @@ -1103,3 +1111,4 @@ const ASN1_ARRAY_TYPE pkix_asn1_tab[] = {
>    {0, 1048586, "2"},
>    {0, 0, 0}
>  };
> +#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */
> -- 

Regards,
Daniel
Gonglei (Arei) Sept. 24, 2016, 12:36 a.m. UTC | #2
> -----Original Message-----

> From: Daniel P. Berrange [mailto:berrange@redhat.com]

> Sent: Friday, September 23, 2016 6:21 PM

> To: Gonglei (Arei)

> Cc: qemu-devel@nongnu.org; Wubin (H)

> Subject: Re: [PATCH v2] qtest: fix make check complaint in crypto module

> 

> On Thu, Sep 22, 2016 at 04:56:39PM +0800, Gonglei wrote:

> >   CC    tests/test-crypto-tlscredsx509.o

> >   CC    tests/crypto-tls-x509-helpers.o

> >   CC    tests/pkix_asn1_tab.o

> > tests/pkix_asn1_tab.c:7:22: warning: libtasn1.h: No such file or directory

> > tests/pkix_asn1_tab.c:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or

> ‘__attribute__’ before ‘pkix_asn1_tab’

> > make: *** [tests/pkix_asn1_tab.o] Error 1

> >

> > Signed-off-by: Gonglei <arei.gonglei@huawei.com>

> > ---

> >  v2: add condition check for TLS support (Daniel)

> > ---

> >  tests/pkix_asn1_tab.c | 9 +++++++++

> >  1 file changed, 9 insertions(+)

> >

> > diff --git a/tests/pkix_asn1_tab.c b/tests/pkix_asn1_tab.c

> > index 903bc02..036e222b 100644

> > --- a/tests/pkix_asn1_tab.c

> > +++ b/tests/pkix_asn1_tab.c

> > @@ -4,6 +4,14 @@

> >   */

> >

> >  #include "qemu/osdep.h"

> > +#if !(defined WIN32) && \

> > +    defined(CONFIG_TASN1) && \

> > +    (LIBGNUTLS_VERSION_NUMBER >= 0x020600)

> > +#define QCRYPTO_HAVE_TLS_TEST_SUPPORT

> > +#endif

> 

> This doesn't actually build

> 

> tests/pkix_asn1_tab.c:9:6: error: "LIBGNUTLS_VERSION_NUMBER" is not

> defined [-Werror=undef]

>      (LIBGNUTLS_VERSION_NUMBER >= 0x020600)

>       ^~~~~~~~~~~~~~~~~~~~~~~~

> cc1: all warnings being treated as errors

> /home/berrange/src/virt/qemu/rules.mak:60: recipe for target

> 'tests/pkix_asn1_tab.o' failed

> make: *** [tests/pkix_asn1_tab.o] Error 1

> 

Oops, I didn't encounter it because CONFIG_TASN1 is not defined in my environment.

> 

> This is because you missed the gnutls.h include. Rather than

> repeating the condition here, you sould just #include the

> existing tests/crypto-tls-x509-helpers.h header

> 

Yes, you are definitely right, thanks! V3 will come. 

Regards,
-Gonglei

> > +

> > +#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT

> > +

> >  #include <libtasn1.h>

> >

> >  const ASN1_ARRAY_TYPE pkix_asn1_tab[] = {

> > @@ -1103,3 +1111,4 @@ const ASN1_ARRAY_TYPE pkix_asn1_tab[] = {

> >    {0, 1048586, "2"},

> >    {0, 0, 0}

> >  };

> > +#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */

> > --

> 

> Regards,

> Daniel

> --

> |: http://berrange.com      -o-

> http://www.flickr.com/photos/dberrange/ :|

> |: http://libvirt.org              -o-

> http://virt-manager.org :|

> |: http://autobuild.org       -o-

> http://search.cpan.org/~danberr/ :|

> |: http://entangle-photo.org       -o-

> http://live.gnome.org/gtk-vnc :|
diff mbox

Patch

diff --git a/tests/pkix_asn1_tab.c b/tests/pkix_asn1_tab.c
index 903bc02..036e222b 100644
--- a/tests/pkix_asn1_tab.c
+++ b/tests/pkix_asn1_tab.c
@@ -4,6 +4,14 @@ 
  */
 
 #include "qemu/osdep.h"
+#if !(defined WIN32) && \
+    defined(CONFIG_TASN1) && \
+    (LIBGNUTLS_VERSION_NUMBER >= 0x020600)
+#define QCRYPTO_HAVE_TLS_TEST_SUPPORT
+#endif
+
+#ifdef QCRYPTO_HAVE_TLS_TEST_SUPPORT
+
 #include <libtasn1.h>
 
 const ASN1_ARRAY_TYPE pkix_asn1_tab[] = {
@@ -1103,3 +1111,4 @@  const ASN1_ARRAY_TYPE pkix_asn1_tab[] = {
   {0, 1048586, "2"},
   {0, 0, 0}
 };
+#endif /* QCRYPTO_HAVE_TLS_TEST_SUPPORT */