From 1f87ee4bff436100278e6ba64fcfea924bfc3447 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sun, 11 Nov 2012 11:35:15 +0100 Subject: [PATCH] test_vt: use a dummy input-object We cannot allocate VT objects without an associated input object. Therefore, allocate a dummy device with no input devices assigned to it and use it for the test-vt object. Note that this makes switching from/to this VT via command-line impossible. Signed-off-by: David Herrmann --- tests/test_vt.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/test_vt.c b/tests/test_vt.c index 9ce7bd0..b601861 100644 --- a/tests/test_vt.c +++ b/tests/test_vt.c @@ -90,6 +90,7 @@ int main(int argc, char **argv) int ret; struct ev_eloop *eloop; struct uterm_vt_master *vtm; + struct uterm_input *input; struct uterm_vt *vt; size_t onum; @@ -102,13 +103,19 @@ int main(int argc, char **argv) if (ret) goto err_exit; - ret = uterm_vt_allocate(vtm, &vt, NULL, NULL, NULL, NULL, NULL); + ret = uterm_input_new(&input, eloop, "", "", "", "", 0, 0); if (ret) goto err_vtm; - ret = uterm_vt_activate(vt); + ret = uterm_vt_allocate(vtm, &vt, "seat0", input, NULL, NULL, NULL); if (ret) - log_warn("Cannot switch to VT"); + goto err_input; + + ret = uterm_vt_activate(vt); + if (ret == -EINPROGRESS) + log_debug("VT switch in progress"); + else if (ret) + log_warn("cannot switch to VT: %d", ret); ev_eloop_run(eloop, -1); @@ -120,6 +127,8 @@ int main(int argc, char **argv) ev_eloop_run(eloop, 50); uterm_vt_unref(vt); +err_input: + uterm_input_unref(input); err_vtm: uterm_vt_master_unref(vtm); err_exit: