4 # checkKeys.pl testname
5 # testname can be anything satisfying the pattern
6 # '^(keytest\/|.*autotests\/out-home\/)?([^\/]+)(|\-in\.txt|\.log[a-z]\.txt)$/
7 # interesting is only group(2)
9 # Tool to display keystrokes which made it to lyx while tested with
10 # the lyx-session with '-dbg key'
11 # Helpful to check where a 'keytest'-testcase failed because
12 # of some missing/ignored key.
16 my $bindir = "@CMAKE_BINARY_DIR@";
17 my $resdir = "@LYX_ABS_TOP_SRCDIR@/development/autotests/keyresults";
18 my $logdir = "$bindir/autotests/out-home";
24 if ($arg =~ /^([^=]+)=([^=]+)$/) {
25 my ($par, $val) = ($1, $2);
40 $pattern =~ s/^(keytest\/|.*autotests\/out-home\/)//;
41 $pattern =~ s/(\-in\.txt|\.log[a-z]\.txt)$//;
42 return if ($pattern =~ /\//);
43 if (opendir(DI, $logdir)) {
44 while (my $f = readdir(DI)) {
45 if ($f =~ /$pattern.*\.log([a-z])\.txt$/) {
63 if (defined($exp[$line])) {
80 my $log = "$logdir/$e";
81 my $expected = "$resdir/$e.expected";
84 if (open(FE, $expected)) {
85 while (my $l = <FE>) {
92 print "Not found file $expected\n";
98 while (my $l = <FI>) {
99 if ($l =~ /:\s+(KeySym\s+is\s+.*)$/) {
101 $errors += &checkPrint($out);
103 elsif ($l =~ /:\s+(Key\s+\(queried\)\s+\[action=.*)$/) {
105 $errors += &checkPrint($out);
108 $errors += 1 if (defined($exp[$line]));
112 print "Diff -u $e:\n";
113 open(FX, "| diff -u $expected -");
114 for (my $i=0; $i < $line; $i++) {
115 print FX "$exp[$i]\n";
119 print "Overwriting file $expected\n";
120 if (open(FO, '>', $expected)) {
121 for (my $i=0; $i < $line; $i++) {
122 print FO "$exp[$i]\n";