[Spice-devel] [PATCH spice-gtk] build: Make usb-acl-helper test work under Meson

Frediano Ziglio fziglio at redhat.com
Mon Sep 3 16:34:47 UTC 2018


Meson waits for pipes (stdout and stderr) to be not readable but
our mocking helper does not close these handles causing Meson
to give some problems.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 tests/usb-acl-helper.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/usb-acl-helper.c b/tests/usb-acl-helper.c
index 06f8036..310bdaf 100644
--- a/tests/usb-acl-helper.c
+++ b/tests/usb-acl-helper.c
@@ -15,6 +15,7 @@
    License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
+#include <stdio.h>
 #include <glib.h>
 #include "usb-acl-helper.h"
 
@@ -198,6 +199,13 @@ static void test_acl_helper_no_response(Fixture *fixture, gconstpointer user_dat
 
 int main(int argc, char* argv[])
 {
+    /* Meson wait for stderr to be not readable so make sure the
+     * helper does not keep the pipe open (this happens with current
+     * mock helper) */
+    if (freopen("usb-acl-helper-error.log", "w", stderr) == NULL) {
+        return 1;
+    }
+
     g_test_init(&argc, &argv, NULL);
 
     g_test_add("/usb-acl-helper/success", Fixture, NULL,
-- 
2.17.1



More information about the Spice-devel mailing list