Skip to content

Commit 6e16289

Browse files
committed
patchpal: make testing work on linux via Xvfb
Signed-off-by: Jarod Wilson <[email protected]>
1 parent 94eae93 commit 6e16289

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Formula/p/patchpal.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ class Patchpal < Formula
2020
depends_on "llvm"
2121
depends_on "pango"
2222

23+
on_linux do
24+
depends_on "xorg-server" => :test
25+
end
26+
2327
def install
2428
ENV.prepend_path "PATH", Formula["gawk"].bin if OS.mac?
2529
inreplace "tests/run.sh", "readlink -e", "echo"
@@ -35,7 +39,13 @@ def install
3539
ENV["GIT_AUTHOR_EMAIL"] = "[email protected]"
3640
ENV["GIT_COMMITTER_NAME"] = "A Developer"
3741
ENV["GIT_COMMITTER_EMAIL"] = "[email protected]"
38-
ENV["DISPLAY"] = ":0"
42+
43+
if OS.linux?
44+
xvfb_pid = spawn Formula["xorg-server"].bin/"Xvfb", ":1"
45+
ENV["DISPLAY"] = ":1"
46+
sleep 10
47+
end
48+
3949
output = shell_output("#{prefix}/tests/run.sh -v")
4050
assert_match <<~EOS, output
4151
ok 1 test_add_copied.sh
@@ -52,4 +62,8 @@ def install
5262
1..11
5363
EOS
5464
end
65+
66+
ensure
67+
Process.kill("TERM", xvfb_pid) if xvfb_pid
68+
end
5569
end

0 commit comments

Comments
 (0)