Skip to content

Commit

Permalink
Find Xorg binary in PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
knixeur committed May 22, 2019
1 parent 253f994 commit df8db78
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions test/integration/runtests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,34 @@ function getTests(testset)
return (io.popen("ls " .. testset .. "/*.lua"):lines())
end

local function file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end

local function find_in_path(file)
local env_path = os.getenv("PATH")
local paths = string.gmatch(env_path, "[^:]+")
for path in paths do
local fullfilename = path .. '/' .. file
if file_exists(fullfilename) then
return fullfilename
end
end
return false
end

print('Running tests against ' .. basedir .. 'notion/notion')
print 'Starting Xorg dummy...'

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

Expand Down

0 comments on commit df8db78

Please sign in to comment.