[Spice-devel] [PATCH spice-common 2/2] test: Add a test for subject_to_x509_name function

Frediano Ziglio fziglio at redhat.com
Tue Dec 18 17:19:28 UTC 2018


> On Thu, Dec 13, 2018 at 02:20:25PM +0000, Frediano Ziglio wrote:
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> >  common/ssl_verify.c     |   5 +-
> >  common/ssl_verify.h     |   4 ++
> >  tests/Makefile.am       |  20 ++++++
> >  tests/test-ssl-verify.c | 141 ++++++++++++++++++++++++++++++++++++++++
> >  4 files changed, 169 insertions(+), 1 deletion(-)
> >  create mode 100644 tests/test-ssl-verify.c
> > 
> > diff --git a/common/ssl_verify.c b/common/ssl_verify.c
> > index 74f95bb..3ccb52d 100644
> > --- a/common/ssl_verify.c
> > +++ b/common/ssl_verify.c
> > @@ -278,7 +278,10 @@ static int verify_hostname(X509* cert, const char
> > *hostname)
> >      return cn_match;
> >  }
> >  
> > -static X509_NAME* subject_to_x509_name(const char *subject, int *nentries)
> > +#if !ENABLE_EXTRA_CHECKS
> > +static
> > +#endif
> > +X509_NAME* subject_to_x509_name(const char *subject, int *nentries)
> 
> I'd prefer we don't go down that road...
> 
> Christophe
> 

Any alternative suggestion?
Adding the test at the end of the module?
#Include the source module into the test program?

All are quite hacky but mocking/testing in C is often hacky.

Frediano


More information about the Spice-devel mailing list