Re: [PATCH spice-common v2] test-region: Create proper test for region from source code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 26, 2018 at 01:42:20PM -0400, Frediano Ziglio wrote:
> Why use GTest API ?

Mostly for consistency.

> I honestly just created a test and I prefer to have at least a first commit
> with a verbatim copy of the old test, in case we found some bugs later.
> For me is more important to have a test than the style of it.
> Was working, why changing it, is just more work (honestly I didn't spend
> much to say with GTest would be better or not... was doing some experiments
> with Meson+Gitlab+coverage output and I found that region.c was not that
> tested... so I found the test code there and I turned into a test
> see https://freddy77.pages.freedesktop.org/spice-common/)

I'm not asking for huge changes to the copied code, just suggesting
this:

diff --git a/tests/test-region.c b/tests/test-region.c
index 38b3203..5a00cce 100644
--- a/tests/test-region.c
+++ b/tests/test-region.c
@@ -127,7 +127,7 @@ enum {
     EXPECT_CONT,
 };

-int main(void)
+static void test_region(void)
 {
     QRegion _r1, _r2, _r3;
     QRegion *r1 = &_r1;
@@ -396,6 +396,13 @@ int main(void)
     region_destroy(r3);
     region_destroy(r1);
     region_destroy(r2);
+}
+
+int main(int argc, char **argv)
+{
+    g_test_init(&argc, &argv, NULL);
+
+    g_test_add_func("/spice-common/region", test_region);

-    return 0;
+    return g_test_run();
 }

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]