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