modularize X11 tests
[os-autoinst:os-autoinst.git] / inst / consoletest.pm
1 #!/usr/bin/perl -w
2 use strict;
3 use bmwqemu;
4 use autotest;
5
6 sub clear_console()
7 {
8         sendkey "ctrl-c";
9         sleep 1;
10         sendkey "ctrl-c";
11         sendautotype "reset\n";
12         sleep 2;
13 }
14
15
16 # init
17 # log into text console
18 sendkey "ctrl-alt-f2";
19 sleep 2;
20 sendautotype "$username\n";
21 sleep 1;
22 sendautotype "$password\n";
23 sleep 3;
24 sendautotype "PS1=\$\n"; # set constant shell promt
25 #sendautotype 'PS1=\$\ '."\n"; # qemu-0.12.4 can not do backslash yet. http://permalink.gmane.org/gmane.comp.emulators.qemu/71856
26
27
28 sub consoletestrunfunc
29 {
30         my($test)=@_;
31         my $class=ref $test;
32         clear_console; # clear screen to make screen content independent from previous tests
33         diag "starting $class";
34         $test->run();
35         sleep 2;
36         $test->take_screenshot;
37         diag "finished $class";
38 }
39
40
41 autotest::runtestdir("$scriptdir/consoletest.d", \&consoletestrunfunc);
42
43
44 # cleanup
45 script_sudo_logout;
46 sleep 2;
47 sendkey "ctrl-d"; # logout
48 sleep 2;
49
50 sendkey "ctrl-alt-f7"; # go back to X11
51 sleep 2;
52 sendkey "backspace"; # deactivate blanking
53 sleep 2;
54 waitidle;
55
56 do "inst/x11test.pm" or die $@;
57
58 1;