testcases: move Xdummy cleanup code to StartXDummy

This commit is contained in:
Maik Fischer 2011-11-27 18:21:41 +01:00
parent 43b8b8356d
commit 55c474d864
2 changed files with 3 additions and 7 deletions

View File

@ -71,12 +71,8 @@ pod2usage(-verbose => 2, -exitcode => 0) if $help;
@displays = map { s/ //g; $_ } @displays; @displays = map { s/ //g; $_ } @displays;
# No displays specified, lets start some Xdummy instances. # No displays specified, lets start some Xdummy instances.
if (@displays == 0) { @displays = start_xdummy($parallel) if @displays == 0;
my ($displays, $pids) = start_xdummy($parallel);
@displays = @$displays;
push our @CLEANUP, sub { kill(15, $_) for @$pids };
}
# connect to all displays for two reasons: # connect to all displays for two reasons:
# 1: check if the display actually works # 1: check if the display actually works

View File

@ -65,7 +65,7 @@ sub start_xdummy {
exec './Xdummy', ":$displaynum", '-config', '/dev/null'; exec './Xdummy', ":$displaynum", '-config', '/dev/null';
exit 1; exit 1;
} }
push(@childpids, $pid); push(@main::CLEANUP, sub { kill(15, $pid) });
push(@displays, ":$displaynum"); push(@displays, ":$displaynum");
push(@sockets_waiting, $x_socketpath . $displaynum); push(@sockets_waiting, $x_socketpath . $displaynum);
$displaynum++; $displaynum++;
@ -79,7 +79,7 @@ sub start_xdummy {
sleep 0.1; sleep 0.1;
} }
return \@displays, \@childpids; return @displays;
} }
1 1