mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
Fix parallel runs of TLS test suites
Use a separate keyfile name for the two TLS test suites so that they don't clash when running tests in parallel Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
be7a89e8ca
commit
eaa99a17db
@ -40,6 +40,8 @@
|
|||||||
|
|
||||||
# define VIR_FROM_THIS VIR_FROM_RPC
|
# define VIR_FROM_THIS VIR_FROM_RPC
|
||||||
|
|
||||||
|
# define KEYFILE "key-ctx.pem"
|
||||||
|
|
||||||
struct testTLSContextData {
|
struct testTLSContextData {
|
||||||
bool isServer;
|
bool isServer;
|
||||||
const char *cacrt;
|
const char *cacrt;
|
||||||
@ -66,7 +68,7 @@ static int testTLSContextInit(const void *opaque)
|
|||||||
ctxt = virNetTLSContextNewServer(data->cacrt,
|
ctxt = virNetTLSContextNewServer(data->cacrt,
|
||||||
NULL,
|
NULL,
|
||||||
data->crt,
|
data->crt,
|
||||||
keyfile,
|
KEYFILE,
|
||||||
NULL,
|
NULL,
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
@ -74,7 +76,7 @@ static int testTLSContextInit(const void *opaque)
|
|||||||
ctxt = virNetTLSContextNewClient(data->cacrt,
|
ctxt = virNetTLSContextNewClient(data->cacrt,
|
||||||
NULL,
|
NULL,
|
||||||
data->crt,
|
data->crt,
|
||||||
keyfile,
|
KEYFILE,
|
||||||
true,
|
true,
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
@ -109,7 +111,7 @@ mymain(void)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
testTLSInit();
|
testTLSInit(KEYFILE);
|
||||||
|
|
||||||
# define DO_CTX_TEST(_isServer, _caCrt, _crt, _expectFail) \
|
# define DO_CTX_TEST(_isServer, _caCrt, _crt, _expectFail) \
|
||||||
do { \
|
do { \
|
||||||
@ -617,7 +619,7 @@ mymain(void)
|
|||||||
testTLSDiscardCert(&clientcertlevel2breq);
|
testTLSDiscardCert(&clientcertlevel2breq);
|
||||||
unlink("cacertchain.pem");
|
unlink("cacertchain.pem");
|
||||||
|
|
||||||
testTLSCleanup();
|
testTLSCleanup(KEYFILE);
|
||||||
|
|
||||||
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
|
|
||||||
# define VIR_FROM_THIS VIR_FROM_RPC
|
# define VIR_FROM_THIS VIR_FROM_RPC
|
||||||
|
|
||||||
const char *keyfile = abs_builddir "/virnettlscontexttest-key.pem";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These store some static data that is needed when
|
* These store some static data that is needed when
|
||||||
* encoding extensions in the x509 certs
|
* encoding extensions in the x509 certs
|
||||||
@ -99,7 +97,7 @@ static gnutls_x509_privkey_t testTLSLoadKey(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void testTLSInit(void)
|
void testTLSInit(const char *keyfile)
|
||||||
{
|
{
|
||||||
gnutls_global_init();
|
gnutls_global_init();
|
||||||
|
|
||||||
@ -112,7 +110,7 @@ void testTLSInit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void testTLSCleanup(void)
|
void testTLSCleanup(const char *keyfile)
|
||||||
{
|
{
|
||||||
asn1_delete_structure(&pkix_asn1);
|
asn1_delete_structure(&pkix_asn1);
|
||||||
unlink(keyfile);
|
unlink(keyfile);
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
|
|
||||||
# include "rpc/virnettlscontext.h"
|
# include "rpc/virnettlscontext.h"
|
||||||
|
|
||||||
extern const char *keyfile;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This contains parameter about how to generate
|
* This contains parameter about how to generate
|
||||||
* certificates.
|
* certificates.
|
||||||
@ -76,7 +74,7 @@ void testTLSWriteCertChain(const char *filename,
|
|||||||
size_t ncerts);
|
size_t ncerts);
|
||||||
void testTLSDiscardCert(struct testTLSCertReq *req);
|
void testTLSDiscardCert(struct testTLSCertReq *req);
|
||||||
|
|
||||||
void testTLSInit(void);
|
void testTLSInit(const char *keyfile);
|
||||||
void testTLSCleanup(void);
|
void testTLSCleanup(const char *keyfile);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
# define VIR_FROM_THIS VIR_FROM_RPC
|
# define VIR_FROM_THIS VIR_FROM_RPC
|
||||||
|
|
||||||
|
# define KEYFILE "key-sess.pem"
|
||||||
|
|
||||||
struct testTLSSessionData {
|
struct testTLSSessionData {
|
||||||
const char *servercacrt;
|
const char *servercacrt;
|
||||||
const char *clientcacrt;
|
const char *clientcacrt;
|
||||||
@ -107,7 +109,7 @@ static int testTLSSessionInit(const void *opaque)
|
|||||||
serverCtxt = virNetTLSContextNewServer(data->servercacrt,
|
serverCtxt = virNetTLSContextNewServer(data->servercacrt,
|
||||||
NULL,
|
NULL,
|
||||||
data->servercrt,
|
data->servercrt,
|
||||||
keyfile,
|
KEYFILE,
|
||||||
data->wildcards,
|
data->wildcards,
|
||||||
false,
|
false,
|
||||||
true);
|
true);
|
||||||
@ -115,7 +117,7 @@ static int testTLSSessionInit(const void *opaque)
|
|||||||
clientCtxt = virNetTLSContextNewClient(data->clientcacrt,
|
clientCtxt = virNetTLSContextNewClient(data->clientcacrt,
|
||||||
NULL,
|
NULL,
|
||||||
data->clientcrt,
|
data->clientcrt,
|
||||||
keyfile,
|
KEYFILE,
|
||||||
false,
|
false,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
@ -236,7 +238,7 @@ mymain(void)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
testTLSInit();
|
testTLSInit(KEYFILE);
|
||||||
|
|
||||||
# define DO_SESS_TEST(_caCrt, _serverCrt, _clientCrt, _expectServerFail, \
|
# define DO_SESS_TEST(_caCrt, _serverCrt, _clientCrt, _expectServerFail, \
|
||||||
_expectClientFail, _hostname, _wildcards) \
|
_expectClientFail, _hostname, _wildcards) \
|
||||||
@ -474,7 +476,7 @@ mymain(void)
|
|||||||
testTLSDiscardCert(&clientcertlevel2breq);
|
testTLSDiscardCert(&clientcertlevel2breq);
|
||||||
unlink("cacertchain.pem");
|
unlink("cacertchain.pem");
|
||||||
|
|
||||||
testTLSCleanup();
|
testTLSCleanup(KEYFILE);
|
||||||
|
|
||||||
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user