From 077e021e26e695288ad153fea16ba0e2528cef5c Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 4 Aug 2012 00:51:41 +0200 Subject: [PATCH] tests: implement --xtrace in complete-run.pl --- testcases/complete-run.pl | 7 +++++++ testcases/lib/SocketActivation.pm | 8 ++++++++ testcases/lib/TestWorker.pm | 3 ++- testcases/lib/i3test.pm | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/testcases/complete-run.pl b/testcases/complete-run.pl index 020e2f90..f5520603 100755 --- a/testcases/complete-run.pl +++ b/testcases/complete-run.pl @@ -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. Runs i3 under strace to trace system calls. The output will be available in C. +=item B<--xtrace> + +Runs i3 under xtrace to trace X11 requests/replies. The output will be +available in C. + =item B<--coverage-testing> Exits i3 cleanly (instead of kill -9) to make coverage testing work properly. diff --git a/testcases/lib/SocketActivation.pm b/testcases/lib/SocketActivation.pm index 8f52bddc..0a062be4 100644 --- a/testcases/lib/SocketActivation.pm +++ b/testcases/lib/SocketActivation.pm @@ -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; diff --git a/testcases/lib/TestWorker.pm b/testcases/lib/TestWorker.pm index 66f22bc0..a224b718 100644 --- a/testcases/lib/TestWorker.pm +++ b/testcases/lib/TestWorker.pm @@ -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}); diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index 32a17934..aff23009 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -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}, -- 2.39.5