]> git.sur5r.net Git - i3/i3/commitdiff
tests: implement --xtrace in complete-run.pl
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 3 Aug 2012 22:51:41 +0000 (00:51 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 4 Aug 2012 01:12:06 +0000 (03:12 +0200)
testcases/complete-run.pl
testcases/lib/SocketActivation.pm
testcases/lib/TestWorker.pm
testcases/lib/i3test.pm

index 020e2f90b737ab3499be140f58af4c6fb6c95c44..f55206034038ed968ee03b8c0085360dfc5756a6 100755 (executable)
@@ -46,6 +46,7 @@ my @displays = ();
 my %options = (
     valgrind => 0,
     strace => 0,
+    xtrace => 0,
     coverage => 0,
     restart => 0,
 );
@@ -54,6 +55,7 @@ my $result = GetOptions(
     "coverage-testing" => \$options{coverage},
     "valgrind" => \$options{valgrind},
     "strace" => \$options{strace},
+    "xtrace" => \$options{xtrace},
     "display=s" => \@displays,
     "parallel=i" => \$parallel,
     "help|?" => \$help,
@@ -342,6 +344,11 @@ C<latest/valgrind-for-$test.log>.
 Runs i3 under strace to trace system calls. The output will be available in
 C<latest/strace-for-$test.log>.
 
+=item B<--xtrace>
+
+Runs i3 under xtrace to trace X11 requests/replies. The output will be
+available in C<latest/xtrace-for-$test.log>.
+
 =item B<--coverage-testing>
 
 Exits i3 cleanly (instead of kill -9) to make coverage testing work properly.
index 8f52bddc4a3eb8a92a3ba37ae8363a29cfd9b779..0a062be48199f0e705f08b536749dbf256ef42a8 100644 (file)
@@ -124,6 +124,14 @@ sub activate_i3 {
                      'sh -c "export LISTEN_PID=\$\$; ' . $cmd . '"';
         }
 
+        if ($args{xtrace}) {
+            my $out = "$outdir/xtrace-for-$test.log";
+
+            # See comment in $args{strace} branch.
+            $cmd = qq|xtrace -n -o "$out" -- | .
+                     'sh -c "export LISTEN_PID=\$\$; ' . $cmd . '"';
+        }
+
         # We need to use the shell due to using output redirections.
         exec '/bin/sh', '-c', $cmd;
 
index 66f22bc03a7bee785012f901399898e68c72b001..a224b718a90f245c954bba1cfa20a05e94d0a479 100644 (file)
@@ -105,12 +105,13 @@ sub worker_wait {
             $test->failure_output(\*STDERR);
             $test->todo_output(\*STDOUT);
 
-            @ENV{qw(DISPLAY TESTNAME OUTDIR VALGRIND STRACE COVERAGE RESTART)}
+            @ENV{qw(DISPLAY TESTNAME OUTDIR VALGRIND STRACE XTRACE COVERAGE RESTART)}
                 = ($self->{display},
                    basename($file),
                    $outdir,
                    $options->{valgrind},
                    $options->{strace},
+                   $options->{xtrace},
                    $options->{coverage},
                    $options->{restart});
 
index 32a17934d8e23d6e91cfb9645dcee68faeecf432..aff23009986ff19730c42a252d0ce6e999aac3de 100644 (file)
@@ -547,6 +547,7 @@ sub launch_with_config {
         testname => $ENV{TESTNAME},
         valgrind => $ENV{VALGRIND},
         strace => $ENV{STRACE},
+        xtrace => $ENV{XTRACE},
         restart => $ENV{RESTART},
         cv => $cv,
         dont_create_temp_dir => $args{dont_create_temp_dir},