Skip to content

Commit df8db78

Browse files
committed
Find Xorg binary in PATH
1 parent 253f994 commit df8db78

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

test/integration/runtests.lua

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,34 @@ function getTests(testset)
1717
return (io.popen("ls " .. testset .. "/*.lua"):lines())
1818
end
1919

20+
local function file_exists(name)
21+
local f=io.open(name,"r")
22+
if f~=nil then io.close(f) return true else return false end
23+
end
24+
25+
local function find_in_path(file)
26+
local env_path = os.getenv("PATH")
27+
local paths = string.gmatch(env_path, "[^:]+")
28+
for path in paths do
29+
local fullfilename = path .. '/' .. file
30+
if file_exists(fullfilename) then
31+
return fullfilename
32+
end
33+
end
34+
return false
35+
end
36+
2037
print('Running tests against ' .. basedir .. 'notion/notion')
21-
print 'Starting Xorg dummy...'
2238

2339
local xpid = posix.fork()
2440
if (xpid == 0) then
41+
local xorg_binary = find_in_path("Xorg")
42+
if xorg_binary == false then
43+
print('Error launching Xorg dummy, Xorg binary not found')
44+
end
45+
print('Starting Xorg dummy: ' .. xorg_binary)
2546
local result,errstr,errno = posix.exec("/usr/bin/Xorg", "-noreset", "+extension", "GLX", "+extension", "RANDR", "+extension", "RENDER", "-logfile", "./10.log", "-config", "./xorg.conf", ":7")
26-
print('Error replacing current process with Xorg dummy: ' .. errstr);
47+
print('Error replacing current process with Xorg dummy: ' .. errstr)
2748
os.exit(1)
2849
end
2950

0 commit comments

Comments
 (0)