From 311b9e24df9ba139497b673a07d2322b0d022516 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Wed, 21 Dec 2011 23:15:06 +0000 Subject: [PATCH] tests: implement restart testing (actual option still missing) --- testcases/lib/SocketActivation.pm | 4 ++++ testcases/lib/TestWorker.pm | 4 ++-- testcases/lib/i3test.pm | 1 + testcases/restart-state.golden | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 testcases/restart-state.golden diff --git a/testcases/lib/SocketActivation.pm b/testcases/lib/SocketActivation.pm index 36197794..0dadad75 100644 --- a/testcases/lib/SocketActivation.pm +++ b/testcases/lib/SocketActivation.pm @@ -92,6 +92,10 @@ sub activate_i3 { my $outdir = $args{outdir}; my $test = $args{testname}; + if ($args{restart}) { + $i3cmd .= ' -L ' . abs_path('restart-state.golden'); + } + if ($args{valgrind}) { $i3cmd = qq|valgrind -v --log-file="$outdir/valgrind-for-$test.log" | . diff --git a/testcases/lib/TestWorker.pm b/testcases/lib/TestWorker.pm index 85539626..dcb39ebc 100644 --- a/testcases/lib/TestWorker.pm +++ b/testcases/lib/TestWorker.pm @@ -101,8 +101,8 @@ sub worker_wait { $test->failure_output(\*STDERR); $test->todo_output(\*STDOUT); - @ENV{qw(DISPLAY TESTNAME OUTDIR VALGRIND STRACE COVERAGE)} - = ($self->{display}, basename($file), $outdir, 0, 0, 0); + @ENV{qw(DISPLAY TESTNAME OUTDIR VALGRIND STRACE COVERAGE RESTART)} + = ($self->{display}, basename($file), $outdir, 0, 0, 0, 0); package main; local $@; diff --git a/testcases/lib/i3test.pm b/testcases/lib/i3test.pm index aecec534..0f4b97c6 100644 --- a/testcases/lib/i3test.pm +++ b/testcases/lib/i3test.pm @@ -505,6 +505,7 @@ sub launch_with_config { testname => $ENV{TESTNAME}, valgrind => $ENV{VALGRIND}, strace => $ENV{STRACE}, + restart => $ENV{RESTART}, cv => $cv, ); diff --git a/testcases/restart-state.golden b/testcases/restart-state.golden new file mode 100644 index 00000000..bca44959 --- /dev/null +++ b/testcases/restart-state.golden @@ -0,0 +1 @@ +{"id":6752976,"type":0,"orientation":"none","percent":null,"urgent":false,"focused":false,"layout":"default","border":"none","rect":{"x":0,"y":0,"width":1280,"height":1024},"window_rect":{"x":0,"y":0,"width":0,"height":0},"geometry":{"x":0,"y":0,"width":0,"height":0},"name":"root","window":null,"nodes":[{"id":6809472,"type":1,"orientation":"none","percent":1,"urgent":false,"focused":false,"layout":"output","border":"none","rect":{"x":0,"y":0,"width":1280,"height":1024},"window_rect":{"x":0,"y":0,"width":0,"height":0},"geometry":{"x":0,"y":0,"width":0,"height":0},"name":"xroot-0","window":null,"nodes":[{"id":6810064,"type":5,"orientation":"vertical","percent":null,"urgent":false,"focused":false,"layout":"dockarea","border":"none","rect":{"x":0,"y":0,"width":1280,"height":0},"window_rect":{"x":0,"y":0,"width":0,"height":0},"geometry":{"x":0,"y":0,"width":0,"height":0},"name":"topdock","window":null,"nodes":[],"floating_nodes":[],"focus":[],"fullscreen_mode":0,"swallows":[{"dock":2,"insert_where":2}]},{"id":6831664,"type":2,"orientation":"none","percent":null,"urgent":false,"focused":false,"layout":"default","border":"none","rect":{"x":0,"y":0,"width":1280,"height":1024},"window_rect":{"x":0,"y":0,"width":0,"height":0},"geometry":{"x":0,"y":0,"width":0,"height":0},"name":"content","window":null,"nodes":[{"id":6832880,"type":4,"orientation":"horizontal","percent":null,"urgent":false,"focused":true,"layout":"default","border":"none","rect":{"x":0,"y":0,"width":1280,"height":1024},"window_rect":{"x":0,"y":0,"width":0,"height":0},"geometry":{"x":0,"y":0,"width":0,"height":0},"name":"1","num":1,"window":null,"nodes":[],"floating_nodes":[],"focus":[],"fullscreen_mode":1,"swallows":[]}],"floating_nodes":[],"focus":[6832880],"fullscreen_mode":0,"swallows":[]},{"id":6832224,"type":5,"orientation":"vertical","percent":null,"urgent":false,"focused":false,"layout":"dockarea","border":"none","rect":{"x":0,"y":1024,"width":1280,"height":0},"window_rect":{"x":0,"y":0,"width":0,"height":0},"geometry":{"x":0,"y":0,"width":0,"height":0},"name":"bottomdock","window":null,"nodes":[],"floating_nodes":[],"focus":[],"fullscreen_mode":0,"swallows":[{"dock":3,"insert_where":2}]}],"floating_nodes":[],"focus":[6831664,6810064,6832224],"fullscreen_mode":0,"swallows":[]}],"floating_nodes":[],"focus":[6809472],"fullscreen_mode":0,"swallows":[]} \ No newline at end of file