From: Ján Tomko Date: Sat, 4 Sep 2021 20:40:20 +0000 (+0200) Subject: tests: nwfilter: remove pointless labels X-Git-Tag: v7.8.0-rc1~228 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=99318ad945250464a7c60c0b72ca4eeb5af7baeb;p=thirdparty%2Flibvirt.git tests: nwfilter: remove pointless labels Signed-off-by: Ján Tomko Reviewed-by: Laine Stump --- diff --git a/tests/nwfilterebiptablestest.c b/tests/nwfilterebiptablestest.c index 7b32e90d19..9307a10229 100644 --- a/tests/nwfilterebiptablestest.c +++ b/tests/nwfilterebiptablestest.c @@ -102,24 +102,21 @@ testNWFilterEBIPTablesAllTeardown(const void *opaque G_GNUC_UNUSED) "ebtables --concurrent -t nat -F libvirt-O-vnet0\n" "ebtables --concurrent -t nat -X libvirt-O-vnet0\n"; g_autofree char *actual = NULL; - int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.allTeardown("vnet0") < 0) - goto cleanup; + return -1; actual = virBufferContentAndReset(&buf); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); - goto cleanup; + return -1; } - ret = 0; - cleanup: - return ret; + return 0; } @@ -167,24 +164,21 @@ testNWFilterEBIPTablesTearOldRules(const void *opaque G_GNUC_UNUSED) "ebtables --concurrent -t nat -E libvirt-J-vnet0 libvirt-I-vnet0\n" "ebtables --concurrent -t nat -E libvirt-P-vnet0 libvirt-O-vnet0\n"; g_autofree char *actual = NULL; - int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.tearOldRules("vnet0") < 0) - goto cleanup; + return -1; actual = virBufferContentAndReset(&buf); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); - goto cleanup; + return -1; } - ret = 0; - cleanup: - return ret; + return 0; } @@ -210,24 +204,21 @@ testNWFilterEBIPTablesRemoveBasicRules(const void *opaque G_GNUC_UNUSED) "ebtables --concurrent -t nat -F libvirt-P-vnet0\n" "ebtables --concurrent -t nat -X libvirt-P-vnet0\n"; g_autofree char *actual = NULL; - int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.removeBasicRules("vnet0") < 0) - goto cleanup; + return -1; actual = virBufferContentAndReset(&buf); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); - goto cleanup; + return -1; } - ret = 0; - cleanup: - return ret; + return 0; } @@ -238,24 +229,21 @@ testNWFilterEBIPTablesTearNewRules(const void *opaque G_GNUC_UNUSED) const char *expected = VIR_NWFILTER_NEW_RULES_TEARDOWN; g_autofree char *actual = NULL; - int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.tearNewRules("vnet0") < 0) - goto cleanup; + return -1; actual = virBufferContentAndReset(&buf); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); - goto cleanup; + return -1; } - ret = 0; - cleanup: - return ret; + return 0; } @@ -303,25 +291,22 @@ testNWFilterEBIPTablesApplyBasicRules(const void *opaque G_GNUC_UNUSED) "ebtables --concurrent -t nat -A PREROUTING -i vnet0 -j libvirt-J-vnet0\n" "ebtables --concurrent -t nat -E libvirt-J-vnet0 libvirt-I-vnet0\n"; g_autofree char *actual = NULL; - int ret = -1; virMacAddr mac = { .addr = { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 } }; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.applyBasicRules("vnet0", &mac) < 0) - goto cleanup; + return -1; actual = virBufferContentAndReset(&buf); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); - goto cleanup; + return -1; } - ret = 0; - cleanup: - return ret; + return 0; } @@ -377,7 +362,6 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque G_GNUC_UNUSED) "ebtables --concurrent -t nat -E libvirt-J-vnet0 libvirt-I-vnet0\n" "ebtables --concurrent -t nat -E libvirt-P-vnet0 libvirt-O-vnet0\n"; g_autofree char *actual = NULL; - int ret = -1; virMacAddr mac = { .addr = { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 } }; const char *servers[] = { "192.168.122.1", "10.0.0.1", "10.0.0.2" }; virNWFilterVarValue val = { @@ -394,18 +378,16 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque G_GNUC_UNUSED) virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.applyDHCPOnlyRules("vnet0", &mac, &val, false) < 0) - goto cleanup; + return -1; actual = virBufferContentAndReset(&buf); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); - goto cleanup; + return -1; } - ret = 0; - cleanup: - return ret; + return 0; } @@ -455,24 +437,21 @@ testNWFilterEBIPTablesApplyDropAllRules(const void *opaque G_GNUC_UNUSED) "ebtables --concurrent -t nat -E libvirt-J-vnet0 libvirt-I-vnet0\n" "ebtables --concurrent -t nat -E libvirt-P-vnet0 libvirt-O-vnet0\n"; g_autofree char *actual = NULL; - int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.applyDropAllRules("vnet0") < 0) - goto cleanup; + return -1; actual = virBufferContentAndReset(&buf); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); - goto cleanup; + return -1; } - ret = 0; - cleanup: - return ret; + return 0; }