From 55c474d8646cef60958b1c6a53ead85f2133b697 Mon Sep 17 00:00:00 2001 From: Maik Fischer Date: Sun, 27 Nov 2011 18:21:41 +0100 Subject: [PATCH] testcases: move Xdummy cleanup code to StartXDummy --- testcases/complete-run.pl | 6 +----- testcases/lib/StartXDummy.pm | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/testcases/complete-run.pl b/testcases/complete-run.pl index 1cb6dab3..d74da831 100755 --- a/testcases/complete-run.pl +++ b/testcases/complete-run.pl @@ -71,12 +71,8 @@ pod2usage(-verbose => 2, -exitcode => 0) if $help; @displays = map { s/ //g; $_ } @displays; # No displays specified, let’s start some Xdummy instances. -if (@displays == 0) { - my ($displays, $pids) = start_xdummy($parallel); - @displays = @$displays; +@displays = start_xdummy($parallel) if @displays == 0; - push our @CLEANUP, sub { kill(15, $_) for @$pids }; -} # connect to all displays for two reasons: # 1: check if the display actually works diff --git a/testcases/lib/StartXDummy.pm b/testcases/lib/StartXDummy.pm index 0e81dd16..2f3cfeb6 100644 --- a/testcases/lib/StartXDummy.pm +++ b/testcases/lib/StartXDummy.pm @@ -65,7 +65,7 @@ sub start_xdummy { exec './Xdummy', ":$displaynum", '-config', '/dev/null'; exit 1; } - push(@childpids, $pid); + push(@main::CLEANUP, sub { kill(15, $pid) }); push(@displays, ":$displaynum"); push(@sockets_waiting, $x_socketpath . $displaynum); $displaynum++; @@ -79,7 +79,7 @@ sub start_xdummy { sleep 0.1; } - return \@displays, \@childpids; + return @displays; } 1