Testcases: Use Xephyr instead of XDummy

Replace the XDummy script with Xephyr. This is done because of some
changes in the Xorg server that make XDummy difficult to use.

Rename library internal variables and function names to replace "xdummy"
with "xserver" to show this change (except for renaming the package and
lib file for better git history).

Rename the switch `--keep-xdummy-output` to `--keep-xserver-output`.
This switch should now be rarely used because Xephyr requires less set
up.

Replace "xdummy" with "xephyr" in comments and utility help
information. Update docs to show the new dependency.

fixes #1367
This commit is contained in:
Tony Crisci
2014-10-01 19:26:52 -04:00
committed by Michael Stapelberg
parent ea2552e852
commit 2ddbc71e2b
6 changed files with 43 additions and 1977 deletions

View File

@ -7,7 +7,7 @@ use Exporter 'import';
use Time::HiRes qw(sleep);
use v5.10;
our @EXPORT = qw(start_xdummy);
our @EXPORT = qw(start_xserver);
my @pids;
my $x_socketpath = '/tmp/.X11-unix/X';
@ -19,15 +19,15 @@ sub slurp {
<$fh>;
}
# forks an Xdummy or Xdmx process
# forks an X server process
sub fork_xserver {
my $keep_xdummy_output = shift;
my $keep_xserver_output = shift;
my $displaynum = shift;
my $pid = fork();
die "Could not fork: $!" unless defined($pid);
if ($pid == 0) {
# Child, close stdout/stderr, then start Xdummy.
if (!$keep_xdummy_output) {
# Child, close stdout/stderr, then start Xephyr
if (!$keep_xserver_output) {
close STDOUT;
close STDERR;
}
@ -60,16 +60,17 @@ sub wait_for_x {
}
}
=head2 start_xdummy($parallel)
=head2 start_xserver($parallel)
Starts C<$parallel> (or number of cores * 2 if undef) Xdummy processes (see
the file ./Xdummy) and returns two arrayrefs: a list of X11 display numbers to
the Xdummy processes and a list of PIDs of the processes.
Starts C<$parallel> (or number of cores * 2 if undef) Xephyr processes (see
http://www.freedesktop.org/wiki/Software/Xephyr/) and returns two arrayrefs: a
list of X11 display numbers to the Xephyr processes and a list of PIDs of the
processes.
=cut
sub start_xdummy {
my ($parallel, $numtests, $keep_xdummy_output) = @_;
sub start_xserver {
my ($parallel, $numtests, $keep_xserver_output) = @_;
my @displays = ();
my @childpids = ();
@ -78,11 +79,8 @@ sub start_xdummy {
my $child = waitpid -1, POSIX::WNOHANG;
@pids = grep { $_ != $child } @pids;
return unless @pids == 0;
print STDERR "All Xdummy processes died.\n";
print STDERR "Use ./complete-run.pl --parallel 1 --keep-xdummy-output\n";
print STDERR "";
print STDERR "A frequent cause for this is missing the DUMMY Xorg module,\n";
print STDERR "package xserver-xorg-video-dummy on Debian.\n";
print STDERR "All X server processes died.\n";
print STDERR "Use ./complete-run.pl --parallel 1 --keep-xserver-output\n";
exit 1;
};
@ -104,16 +102,13 @@ sub start_xdummy {
my ($displaynum) = map { /(\d+)$/ } reverse sort glob($x_socketpath . '*');
$displaynum++;
say "Starting $parallel Xdummy instances, starting at :$displaynum...";
say "Starting $parallel Xephyr instances, starting at :$displaynum...";
my @sockets_waiting;
for (1 .. $parallel) {
# We use -config /dev/null to prevent Xdummy from using the system
# Xorg configuration. The tests should be independant from the
# actual system X configuration.
my $socket = fork_xserver($keep_xdummy_output, $displaynum,
'./Xdummy', ":$displaynum", '-config', '/dev/null',
'-configdir', '/dev/null', '-nolisten', 'tcp');
my $socket = fork_xserver($keep_xserver_output, $displaynum,
'Xephyr', ":$displaynum", '-screen', '1280x800',
'-nolisten', 'tcp');
push(@displays, ":$displaynum");
push(@sockets_waiting, $socket);
$displaynum++;