mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
tests: use VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
Some test rely too much on declaring variables in the middle of the function. Use the macro to locally suppress the warning Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
93d8ce7f74
commit
fd7644cba9
@ -287,6 +287,7 @@ doTestQemuInternal(const char *version,
|
|||||||
capsName = g_strdup_printf("caps_%s", version);
|
capsName = g_strdup_printf("caps_%s", version);
|
||||||
emulator = g_strdup_printf("/usr/bin/qemu-system-%s", arch);
|
emulator = g_strdup_printf("/usr/bin/qemu-system-%s", arch);
|
||||||
|
|
||||||
|
VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
|
||||||
struct testData data = {
|
struct testData data = {
|
||||||
.name = name,
|
.name = name,
|
||||||
.emulator = emulator,
|
.emulator = emulator,
|
||||||
@ -297,6 +298,7 @@ doTestQemuInternal(const char *version,
|
|||||||
.capsName = capsName,
|
.capsName = capsName,
|
||||||
.capsOpaque = opaque,
|
.capsOpaque = opaque,
|
||||||
};
|
};
|
||||||
|
VIR_WARNINGS_RESET
|
||||||
|
|
||||||
if (virTestRun(name, test_virDomainCapsFormat, &data) < 0)
|
if (virTestRun(name, test_virDomainCapsFormat, &data) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -572,6 +572,7 @@ mymain(void)
|
|||||||
if (virTestRun("Socket External Command /dev/does-not-exist", testSocketCommandFail, NULL) < 0)
|
if (virTestRun("Socket External Command /dev/does-not-exist", testSocketCommandFail, NULL) < 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
|
VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
|
||||||
struct testSSHData sshData1 = {
|
struct testSSHData sshData1 = {
|
||||||
.nodename = "somehost",
|
.nodename = "somehost",
|
||||||
.path = "/tmp/socket",
|
.path = "/tmp/socket",
|
||||||
@ -675,6 +676,7 @@ mymain(void)
|
|||||||
"fi;"
|
"fi;"
|
||||||
"'''\\''/tmp/fo o/nc'\\'''' $ARG -U /tmp/socket'\n",
|
"'''\\''/tmp/fo o/nc'\\'''' $ARG -U /tmp/socket'\n",
|
||||||
};
|
};
|
||||||
|
VIR_WARNINGS_RESET
|
||||||
if (virTestRun("SSH test 7", testSocketSSH, &sshData7) < 0)
|
if (virTestRun("SSH test 7", testSocketSSH, &sshData7) < 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
||||||
|
@ -136,6 +136,7 @@ mymain(void)
|
|||||||
}; \
|
}; \
|
||||||
testTLSGenerateCert(&varname, cavarname.crt)
|
testTLSGenerateCert(&varname, cavarname.crt)
|
||||||
|
|
||||||
|
VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
|
||||||
# define TLS_ROOT_REQ(varname, \
|
# define TLS_ROOT_REQ(varname, \
|
||||||
co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \
|
co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \
|
||||||
kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \
|
kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \
|
||||||
@ -563,6 +564,8 @@ mymain(void)
|
|||||||
certchain,
|
certchain,
|
||||||
G_N_ELEMENTS(certchain));
|
G_N_ELEMENTS(certchain));
|
||||||
|
|
||||||
|
VIR_WARNINGS_RESET
|
||||||
|
|
||||||
DO_CTX_TEST(true, "cacertchain-ctx.pem", servercertlevel3areq.filename, false);
|
DO_CTX_TEST(true, "cacertchain-ctx.pem", servercertlevel3areq.filename, false);
|
||||||
DO_CTX_TEST(false, "cacertchain-ctx.pem", clientcertlevel2breq.filename, false);
|
DO_CTX_TEST(false, "cacertchain-ctx.pem", clientcertlevel2breq.filename, false);
|
||||||
|
|
||||||
|
@ -277,6 +277,7 @@ mymain(void)
|
|||||||
ret = -1; \
|
ret = -1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
|
||||||
# define TLS_CERT_REQ(varname, cavarname, \
|
# define TLS_CERT_REQ(varname, cavarname, \
|
||||||
co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \
|
co, cn, an1, an2, ia1, ia2, bce, bcc, bci, \
|
||||||
kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \
|
kue, kuc, kuv, kpe, kpc, kpo1, kpo2, so, eo) \
|
||||||
@ -460,6 +461,8 @@ mymain(void)
|
|||||||
DO_SESS_TEST("cacertchain-sess.pem", servercertlevel3areq.filename, clientcertlevel2breq.filename,
|
DO_SESS_TEST("cacertchain-sess.pem", servercertlevel3areq.filename, clientcertlevel2breq.filename,
|
||||||
false, false, "libvirt.org", NULL);
|
false, false, "libvirt.org", NULL);
|
||||||
|
|
||||||
|
VIR_WARNINGS_RESET
|
||||||
|
|
||||||
testTLSDiscardCert(&clientcertreq);
|
testTLSDiscardCert(&clientcertreq);
|
||||||
testTLSDiscardCert(&clientcertaltreq);
|
testTLSDiscardCert(&clientcertaltreq);
|
||||||
|
|
||||||
|
@ -682,6 +682,7 @@ mymain(void)
|
|||||||
/* Missing file */
|
/* Missing file */
|
||||||
TEST_ONE_CHAIN("bogus", VIR_STORAGE_FILE_RAW, EXP_FAIL);
|
TEST_ONE_CHAIN("bogus", VIR_STORAGE_FILE_RAW, EXP_FAIL);
|
||||||
|
|
||||||
|
VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
|
||||||
/* Raw image, whether with right format or no specified format */
|
/* Raw image, whether with right format or no specified format */
|
||||||
testFileData raw = {
|
testFileData raw = {
|
||||||
.path = absraw,
|
.path = absraw,
|
||||||
@ -963,6 +964,7 @@ mymain(void)
|
|||||||
};
|
};
|
||||||
TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &rbd2), EXP_PASS);
|
TEST_CHAIN(absqcow2, VIR_STORAGE_FILE_QCOW2, (&qcow2, &rbd2), EXP_PASS);
|
||||||
|
|
||||||
|
VIR_WARNINGS_RESET
|
||||||
|
|
||||||
/* Rewrite wrap and qcow2 back to 3-deep chain, absolute backing */
|
/* Rewrite wrap and qcow2 back to 3-deep chain, absolute backing */
|
||||||
virCommandFree(cmd);
|
virCommandFree(cmd);
|
||||||
|
@ -691,6 +691,7 @@ mymain(void)
|
|||||||
ret = -1; \
|
ret = -1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
|
||||||
const char *tokens1[] = { NULL };
|
const char *tokens1[] = { NULL };
|
||||||
TEST_SPLIT("", " ", 0, tokens1);
|
TEST_SPLIT("", " ", 0, tokens1);
|
||||||
|
|
||||||
@ -714,6 +715,7 @@ mymain(void)
|
|||||||
|
|
||||||
const char *tokens8[] = { "gluster", "rdma", NULL };
|
const char *tokens8[] = { "gluster", "rdma", NULL };
|
||||||
TEST_SPLIT("gluster+rdma", "+", 2, tokens8);
|
TEST_SPLIT("gluster+rdma", "+", 2, tokens8);
|
||||||
|
VIR_WARNINGS_RESET
|
||||||
|
|
||||||
if (virTestRun("virStringSortCompare", testStringSortCompare, NULL) < 0)
|
if (virTestRun("virStringSortCompare", testStringSortCompare, NULL) < 0)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
@ -741,6 +743,7 @@ mymain(void)
|
|||||||
/* None matching */
|
/* None matching */
|
||||||
TEST_SEARCH("foo", "(bar)", 10, 0, NULL, false);
|
TEST_SEARCH("foo", "(bar)", 10, 0, NULL, false);
|
||||||
|
|
||||||
|
VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
|
||||||
/* Full match */
|
/* Full match */
|
||||||
const char *matches1[] = { "foo" };
|
const char *matches1[] = { "foo" };
|
||||||
TEST_SEARCH("foo", "(foo)", 10, 1, matches1, false);
|
TEST_SEARCH("foo", "(foo)", 10, 1, matches1, false);
|
||||||
@ -752,6 +755,7 @@ mymain(void)
|
|||||||
/* Multi matches, limited returns */
|
/* Multi matches, limited returns */
|
||||||
const char *matches3[] = { "foo", "bar" };
|
const char *matches3[] = { "foo", "bar" };
|
||||||
TEST_SEARCH("1foo2bar3eek", "([a-z]+)", 2, 2, matches3, false);
|
TEST_SEARCH("1foo2bar3eek", "([a-z]+)", 2, 2, matches3, false);
|
||||||
|
VIR_WARNINGS_RESET
|
||||||
|
|
||||||
#define TEST_MATCH(s, r, m) \
|
#define TEST_MATCH(s, r, m) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -166,6 +166,7 @@ mymain(void)
|
|||||||
*query_out ? "test://example.com/?" query_out : NULL, \
|
*query_out ? "test://example.com/?" query_out : NULL, \
|
||||||
"test", "example.com", 0, "/", query_in, NULL, NULL, params)
|
"test", "example.com", 0, "/", query_in, NULL, NULL, params)
|
||||||
|
|
||||||
|
VIR_WARNINGS_NO_DECLARATION_AFTER_STATEMENT
|
||||||
virURIParam params[] = {
|
virURIParam params[] = {
|
||||||
{ (char*)"name", (char*)"value", false },
|
{ (char*)"name", (char*)"value", false },
|
||||||
{ NULL, NULL, false },
|
{ NULL, NULL, false },
|
||||||
@ -216,6 +217,7 @@ mymain(void)
|
|||||||
{ (char*)"foo", (char*)"one", false },
|
{ (char*)"foo", (char*)"one", false },
|
||||||
{ NULL, NULL, false },
|
{ NULL, NULL, false },
|
||||||
};
|
};
|
||||||
|
VIR_WARNINGS_RESET
|
||||||
|
|
||||||
TEST_PARAMS("foo=one&bar=two", "", params1);
|
TEST_PARAMS("foo=one&bar=two", "", params1);
|
||||||
TEST_PARAMS("foo=one&foo=two", "", params2);
|
TEST_PARAMS("foo=one&foo=two", "", params2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user