summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2012-11-11 11:39:38 +0100
committerDavid Herrmann <dh.herrmann@googlemail.com>2012-11-11 11:39:38 +0100
commit70cdfa0313de112f45f07f7fe1a986a21ca0e81a (patch)
tree9d6434b23dbecd2c71dc2a8761dead46b99af6f2
parent7eae29e5cb36cc6a738702eff7de69ec98e41af0 (diff)
test_vt: add --switchvt option
This has the same effect as for kmscon but is disabled by default. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
-rw-r--r--tests/test_vt.c25
1 files 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 <vt> [-] Path to VT to use\n",
+ "\t --vt <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: