summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-11-11 11:35:15 +0100
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-11-11 11:35:15 +0100
commit1f87ee4bff436100278e6ba64fcfea924bfc3447 (patch)
tree98dfcdb8b554bcef860866a91000bcf9430a51e5 /tests
parentb27b3a9a163ca8be75b968c4de573206ba91c655 (diff)
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 <dh.herrmann@googlemail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_vt.c15
1 files 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: