From 70cdfa0313de112f45f07f7fe1a986a21ca0e81a Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sun, 11 Nov 2012 11:39:38 +0100 Subject: test_vt: add --switchvt option This has the same effect as for kmscon but is disabled by default. Signed-off-by: David Herrmann --- tests/test_vt.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/test_vt.c b/tests/test_vt.c index 3cca8c7..dd6ee67 100644 --- a/tests/test_vt.c +++ b/tests/test_vt.c @@ -72,7 +72,8 @@ static void print_help() TEST_HELP "\n" "VT Options:\n" - "\t --vt [-] Path to VT to use\n", + "\t --vt [-] Path to VT to use\n" + "\t-s, --switchvt [off] Switch automatically to the new VT\n", "test_vt"); /* * 80 char line: @@ -85,10 +86,12 @@ static void print_help() } static const char *vtpath = NULL; +static bool switchvt = false; struct conf_option options[] = { TEST_OPTIONS, CONF_OPTION_STRING(0, "vt", &vtpath, NULL), + CONF_OPTION_BOOL('s', "switchvt", &switchvt, false), }; int main(int argc, char **argv) @@ -117,20 +120,24 @@ int main(int argc, char **argv) if (ret) 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); + if (switchvt) { + 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); log_debug("Terminating"); /* switch back to previous VT but wait for eloop to process SIGUSR0 */ - ret = uterm_vt_deactivate(vt); - if (ret == -EINPROGRESS) - ev_eloop_run(eloop, 50); + if (switchvt) { + ret = uterm_vt_deactivate(vt); + if (ret == -EINPROGRESS) + ev_eloop_run(eloop, 50); + } uterm_vt_unref(vt); err_input: -- cgit v1.2.3