From df8db78f0a07f1e4fc805d24edb37a10f81f61c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Bonveh=C3=AD?= Date: Wed, 22 May 2019 06:56:56 -0300 Subject: [PATCH] Find Xorg binary in PATH --- test/integration/runtests.lua | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/test/integration/runtests.lua b/test/integration/runtests.lua index fef6f12c4..1957c6efd 100644 --- a/test/integration/runtests.lua +++ b/test/integration/runtests.lua @@ -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