2 * test_console - Test VT Layer
4 * Copyright (c) 2011-2012 David Herrmann <dh.herrmann@googlemail.com>
5 * Copyright (c) 2011 University of Tuebingen
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files
9 * (the "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 * This opens a new VT and prints some text on it. You can then change the VT
30 * and change back. This is only to test the VT subsystem and event engine.
31 * This automatically switches to the new VT. Currently, the display gets
32 * frozen because we aren't painting to the framebuffer yet. Use
33 * ctrl+alt+FX (or some equivalent) to switch back to X/VT.
36 static void print_help();
48 #include "test_include.h"
50 static void print_help()
53 * Usage/Help information
54 * This should be scaled to a maximum of 80 characters per line:
57 * | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 |
58 * "12345678901234567890123456789012345678901234567890123456789012345678901234567890\n"
59 * 80 char line starting with tab:
60 * |10| 20 | 30 | 40 | 50 | 60 | 70 | 80 |
61 * "\t901234567890123456789012345678901234567890123456789012345678901234567890\n"
66 "\t%1$s -h [options]\n"
68 "You can prefix boolean options with \"no-\" to negate it. If an argument is\n"
69 "given multiple times, only the last argument matters if not otherwise stated.\n"
76 * | 10 | 20 | 30 | 40 | 50 | 60 | 70 | 80 |
77 * "12345678901234567890123456789012345678901234567890123456789012345678901234567890\n"
78 * 80 char line starting with tab:
79 * |10| 20 | 30 | 40 | 50 | 60 | 70 | 80 |
80 * "\t901234567890123456789012345678901234567890123456789012345678901234567890\n"
84 struct conf_option options[] = {
88 int main(int argc, char **argv)
91 struct ev_eloop *eloop;
92 struct uterm_vt_master *vtm;
96 onum = sizeof(options) / sizeof(*options);
97 ret = test_prepare(options, onum, argc, argv, &eloop);
101 ret = uterm_vt_master_new(&vtm, eloop);
105 ret = uterm_vt_allocate(vtm, &vt, NULL, NULL, NULL);
109 ret = uterm_vt_activate(vt);
111 log_warn("Cannot switch to VT");
113 ev_eloop_run(eloop, -1);
115 log_debug("Terminating\n");
117 /* switch back to previous VT but wait for eloop to process SIGUSR0 */
118 ret = uterm_vt_deactivate(vt);
119 if (ret == -EINPROGRESS)
120 ev_eloop_run(eloop, 50);
124 uterm_vt_master_unref(vtm);
126 test_exit(options, onum, eloop);
128 if (ret != -ECANCELED)