[PATCH 1/2] tests: be consistent about following DO_TEST_*() with a ;

Laine Stump posted 2 patches 10 months ago
[PATCH 1/2] tests: be consistent about following DO_TEST_*() with a ;
Posted by Laine Stump 10 months ago
As is often the case with macros (especially those that resolve to
multiple statements), it isn't technically necessary to end any of the
invocations of the DO_TEST_*() macros with a semicolon (as evidenced
by the lines changed in this path). Having does make some
auto-indenters (e.g. cc-mode in emacs) more likely to do the right
thing, though, and it also looks nicer if all the lines are similar.

Signed-off-by: Laine Stump <laine@redhat.com>
---
 tests/qemuxmlconftest.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
index c271170d25..13a8577aad 100644
--- a/tests/qemuxmlconftest.c
+++ b/tests/qemuxmlconftest.c
@@ -3017,15 +3017,15 @@ mymain(void)
     DO_TEST_CAPS_LATEST("tap-vhost-incorrect");
     DO_TEST_CAPS_LATEST("tap-vhost");
 
-    DO_TEST_CAPS_LATEST("mtp-usb-device")
-    DO_TEST_CAPS_LATEST("net-usb")
-    DO_TEST_CAPS_LATEST("sound-device-virtio")
-    DO_TEST_CAPS_LATEST("pstore-acpi-erst")
-
-    DO_TEST_CAPS_LATEST_FAILURE("disk-network-iscsi-zero-hosts-invalid")
-    DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-scsi-vhost-rawio-invalid")
-    DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-scsi-vhost-sgio-invalid")
-    DO_TEST_CAPS_LATEST("disk-startuppolicy-optional-drop")
+    DO_TEST_CAPS_LATEST("mtp-usb-device");
+    DO_TEST_CAPS_LATEST("net-usb");
+    DO_TEST_CAPS_LATEST("sound-device-virtio");
+    DO_TEST_CAPS_LATEST("pstore-acpi-erst");
+
+    DO_TEST_CAPS_LATEST_FAILURE("disk-network-iscsi-zero-hosts-invalid");
+    DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-scsi-vhost-rawio-invalid");
+    DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-scsi-vhost-sgio-invalid");
+    DO_TEST_CAPS_LATEST("disk-startuppolicy-optional-drop");
 
     /* check that all input files were actually used here */
     if (testConfXMLCheck(existingTestCases) < 0)
-- 
2.48.1
Re: [PATCH 1/2] tests: be consistent about following DO_TEST_*() with a ;
Posted by Daniel P. Berrangé 9 months, 4 weeks ago
On Thu, Feb 20, 2025 at 11:49:43PM -0500, Laine Stump wrote:
> As is often the case with macros (especially those that resolve to
> multiple statements), it isn't technically necessary to end any of the
> invocations of the DO_TEST_*() macros with a semicolon (as evidenced
> by the lines changed in this path). Having does make some
> auto-indenters (e.g. cc-mode in emacs) more likely to do the right
> thing, though, and it also looks nicer if all the lines are similar.

If we want to do this, then also change

# define DO_TEST_FULL(_name, _suffix, ...) \
    testRun(_name, _suffix, &ret, &testConf, __VA_ARGS__);

to remove the trailing ';' so the compiler forces us to include the ';'
in each usage.

> 
> Signed-off-by: Laine Stump <laine@redhat.com>
> ---
>  tests/qemuxmlconftest.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
> index c271170d25..13a8577aad 100644
> --- a/tests/qemuxmlconftest.c
> +++ b/tests/qemuxmlconftest.c
> @@ -3017,15 +3017,15 @@ mymain(void)
>      DO_TEST_CAPS_LATEST("tap-vhost-incorrect");
>      DO_TEST_CAPS_LATEST("tap-vhost");
>  
> -    DO_TEST_CAPS_LATEST("mtp-usb-device")
> -    DO_TEST_CAPS_LATEST("net-usb")
> -    DO_TEST_CAPS_LATEST("sound-device-virtio")
> -    DO_TEST_CAPS_LATEST("pstore-acpi-erst")
> -
> -    DO_TEST_CAPS_LATEST_FAILURE("disk-network-iscsi-zero-hosts-invalid")
> -    DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-scsi-vhost-rawio-invalid")
> -    DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-scsi-vhost-sgio-invalid")
> -    DO_TEST_CAPS_LATEST("disk-startuppolicy-optional-drop")
> +    DO_TEST_CAPS_LATEST("mtp-usb-device");
> +    DO_TEST_CAPS_LATEST("net-usb");
> +    DO_TEST_CAPS_LATEST("sound-device-virtio");
> +    DO_TEST_CAPS_LATEST("pstore-acpi-erst");
> +
> +    DO_TEST_CAPS_LATEST_FAILURE("disk-network-iscsi-zero-hosts-invalid");
> +    DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-scsi-vhost-rawio-invalid");
> +    DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-scsi-vhost-sgio-invalid");
> +    DO_TEST_CAPS_LATEST("disk-startuppolicy-optional-drop");
>  
>      /* check that all input files were actually used here */
>      if (testConfXMLCheck(existingTestCases) < 0)
> -- 
> 2.48.1
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|