Testcases: Use Xephyr instead of XDummy
Patch status: needinfo
Patch by Tony Crisci
Long description:
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 documentation. fixes #1367
To apply this patch, use:
curl http://cr.i3wm.org/patch/648/raw.patch | git am
b/testcases/complete-run.pl
30 |
@@ -43,7 +43,7 @@ sub Log { say $log "@_" } |
31 |
|
32 |
my %timings; |
33 |
my $help = 0; |
34 |
-# Number of tests to run in parallel. Important to know how many Xdummy |
35 |
+# Number of tests to run in parallel. Important to know how many Xephyr |
36 |
# instances we need to start (unless @displays are given). Defaults to |
37 |
# num_cores * 2. |
38 |
my $parallel = undef; |
39 |
@@ -55,11 +55,11 @@ my %options = ( |
40 |
coverage => 0, |
41 |
restart => 0, |
42 |
); |
43 |
-my $keep_xdummy_output = 0; |
44 |
+my $keep_xserver_output = 0; |
45 |
|
46 |
my $result = GetOptions( |
47 |
"coverage-testing" => \$options{coverage}, |
48 |
- "keep-xdummy-output" => \$keep_xdummy_output, |
49 |
+ "keep-xserver-output" => \$keep_xserver_output, |
50 |
"valgrind" => \$options{valgrind}, |
51 |
"strace" => \$options{strace}, |
52 |
"xtrace" => \$options{xtrace}, |
53 |
@@ -79,6 +79,7 @@ my @binaries = qw( |
54 |
../i3-input/i3-input |
55 |
../i3-msg/i3-msg |
56 |
../i3-nagbar/i3-nagbar |
57 |
+ /usr/bin/Xephyr |
58 |
); |
59 |
|
60 |
foreach my $binary (@binaries) { |
61 |
@@ -97,9 +98,9 @@ my @testfiles = @ARGV; |
62 |
|
63 |
my $numtests = scalar @testfiles; |
64 |
|
65 |
-# No displays specified, let’s start some Xdummy instances. |
66 |
+# No displays specified, let’s start some Xephyr instances. |
67 |
if (@displays == 0) { |
68 |
- @displays = start_xdummy($parallel, $numtests, $keep_xdummy_output); |
69 |
+ @displays = start_xserver($parallel, $numtests, $keep_xserver_output); |
70 |
} |
71 |
|
72 |
# 1: create an output directory for this test-run |
73 |
@@ -115,8 +116,7 @@ symlink("$outdir", "latest") or die "Could not symlink latest to $outdir"; |
74 |
# connect to all displays for two reasons: |
75 |
# 1: check if the display actually works |
76 |
# 2: keep the connection open so that i3 is not the only client. this prevents |
77 |
-# the X server from exiting (Xdummy will restart it, but not quick enough |
78 |
-# sometimes) |
79 |
+# the X server from exiting |
80 |
my @single_worker; |
81 |
for my $display (@displays) { |
82 |
my $screen; |
83 |
@@ -346,7 +346,7 @@ complete-run.pl [files...] |
84 |
|
85 |
=head1 EXAMPLE |
86 |
|
87 |
-To run the whole testsuite on a reasonable number of Xdummy instances (your |
88 |
+To run the whole testsuite on a reasonable number of Xephyr instances (your |
89 |
running X11 will not be touched), run: |
90 |
./complete-run.pl |
91 |
|
92 |
@@ -365,11 +365,11 @@ will parallelize the tests: |
93 |
# Run tests on the second X server |
94 |
./complete-run.pl -d :1 |
95 |
|
96 |
- # Run four tests in parallel on some Xdummy servers |
97 |
+ # Run four tests in parallel on some Xephyr servers |
98 |
./complete-run.pl -d :1,:2,:3,:4 |
99 |
|
100 |
Note that it is not necessary to specify this anymore. If omitted, |
101 |
-complete-run.pl will start (num_cores * 2) Xdummy instances. |
102 |
+complete-run.pl will start (num_cores * 2) Xephyr instances. |
103 |
|
104 |
=item B<--valgrind> |
105 |
|
106 |
@@ -392,8 +392,8 @@ Exits i3 cleanly (instead of kill -9) to make coverage testing work properly. |
107 |
|
108 |
=item B<--parallel> |
109 |
|
110 |
-Number of Xdummy instances to start (if you don’t want to start num_cores * 2 |
111 |
+Number of Xephyr instances to start (if you don’t want to start num_cores * 2 |
112 |
instances for some reason). |
113 |
|
114 |
- # Run all tests on a single Xdummy instance |
115 |
+ # Run all tests on a single Xephyr instance |
116 |
./complete-run.pl -p 1 |
b/testcases/lib/StartXDummy.pm
121 |
@@ -7,7 +7,7 @@ use Exporter 'import'; |
122 |
use Time::HiRes qw(sleep); |
123 |
use v5.10; |
124 |
|
125 |
-our @EXPORT = qw(start_xdummy); |
126 |
+our @EXPORT = qw(start_xserver); |
127 |
|
128 |
my @pids; |
129 |
my $x_socketpath = '/tmp/.X11-unix/X'; |
130 |
@@ -19,15 +19,15 @@ sub slurp { |
131 |
<$fh>; |
132 |
} |
133 |
|
134 |
-# forks an Xdummy or Xdmx process |
135 |
+# forks an X server process |
136 |
sub fork_xserver { |
137 |
- my $keep_xdummy_output = shift; |
138 |
+ my $keep_xserver_output = shift; |
139 |
my $displaynum = shift; |
140 |
my $pid = fork(); |
141 |
die "Could not fork: $!" unless defined($pid); |
142 |
if ($pid == 0) { |
143 |
- # Child, close stdout/stderr, then start Xdummy. |
144 |
- if (!$keep_xdummy_output) { |
145 |
+ # Child, close stdout/stderr, then start Xephyr |
146 |
+ if (!$keep_xserver_output) { |
147 |
close STDOUT; |
148 |
close STDERR; |
149 |
} |
150 |
@@ -60,16 +60,17 @@ sub wait_for_x { |
151 |
} |
152 |
} |
153 |
|
154 |
-=head2 start_xdummy($parallel) |
155 |
+=head2 start_xserver($parallel) |
156 |
|
157 |
-Starts C<$parallel> (or number of cores * 2 if undef) Xdummy processes (see |
158 |
-the file ./Xdummy) and returns two arrayrefs: a list of X11 display numbers to |
159 |
-the Xdummy processes and a list of PIDs of the processes. |
160 |
+Starts C<$parallel> (or number of cores * 2 if undef) Xephyr processes (see |
161 |
+http://www.freedesktop.org/wiki/Software/Xephyr/) and returns two arrayrefs: a |
162 |
+list of X11 display numbers to the Xephyr processes and a list of PIDs of the |
163 |
+processes. |
164 |
|
165 |
=cut |
166 |
|
167 |
-sub start_xdummy { |
168 |
- my ($parallel, $numtests, $keep_xdummy_output) = @_; |
169 |
+sub start_xserver { |
170 |
+ my ($parallel, $numtests, $keep_xserver_output) = @_; |
171 |
|
172 |
my @displays = (); |
173 |
my @childpids = (); |
174 |
@@ -78,11 +79,8 @@ sub start_xdummy { |
175 |
my $child = waitpid -1, POSIX::WNOHANG; |
176 |
@pids = grep { $_ != $child } @pids; |
177 |
return unless @pids == 0; |
178 |
- print STDERR "All Xdummy processes died.\n"; |
179 |
- print STDERR "Use ./complete-run.pl --parallel 1 --keep-xdummy-output\n"; |
180 |
- print STDERR ""; |
181 |
- print STDERR "A frequent cause for this is missing the DUMMY Xorg module,\n"; |
182 |
- print STDERR "package xserver-xorg-video-dummy on Debian.\n"; |
183 |
+ print STDERR "All X server processes died.\n"; |
184 |
+ print STDERR "Use ./complete-run.pl --parallel 1 --keep-xserver-output\n"; |
185 |
exit 1; |
186 |
}; |
187 |
|
188 |
@@ -104,16 +102,13 @@ sub start_xdummy { |
189 |
my ($displaynum) = map { /(\d+)$/ } reverse sort glob($x_socketpath . '*'); |
190 |
$displaynum++; |
191 |
|
192 |
- say "Starting $parallel Xdummy instances, starting at :$displaynum..."; |
193 |
+ say "Starting $parallel Xephyr instances, starting at :$displaynum..."; |
194 |
|
195 |
my @sockets_waiting; |
196 |
for (1 .. $parallel) { |
197 |
- # We use -config /dev/null to prevent Xdummy from using the system |
198 |
- # Xorg configuration. The tests should be independant from the |
199 |
- # actual system X configuration. |
200 |
- my $socket = fork_xserver($keep_xdummy_output, $displaynum, |
201 |
- './Xdummy', ":$displaynum", '-config', '/dev/null', |
202 |
- '-configdir', '/dev/null', '-nolisten', 'tcp'); |
203 |
+ my $socket = fork_xserver($keep_xserver_output, $displaynum, |
204 |
+ '/usr/bin/Xephyr', ":$displaynum", '-screen', '1280x800', |
205 |
+ '-nolisten', 'tcp'); |
206 |
push(@displays, ":$displaynum"); |
207 |
push(@sockets_waiting, $socket); |
208 |
$displaynum++; |
b/testcases/t/112-floating-resize.t
213 |
@@ -69,7 +69,7 @@ cmd 'border 1pixel'; |
214 |
test_resize; |
215 |
|
216 |
################################################################################ |
217 |
-# Check if we can position a floating window out of bounds. The XDummy screen |
218 |
+# Check if we can position a floating window out of bounds. The Xephyr screen |
219 |
# is 1280x1024, so x=2864, y=893 is out of bounds. |
220 |
################################################################################ |
221 |
|