11-- # on Debian in lua-posix
2- local basedir = " ../../"
32
43print (" [TESTING] Integration" )
54
5+ local running_on_travis = os.getenv (' TRAVIS' )
6+ local notion_binary = " ../../notion/notion"
7+ local notionflux_binary = " ../../mod_notionflux/notionflux/notionflux"
8+ if running_on_travis then
9+ print (' TRAVIS detected' )
10+ -- notion_binary = "/usr/local/bin/notion"
11+ -- notionflux_binary = "/usr/local/bin/notionflux"
12+ end
13+
614local success , posix = pcall (require , " posix" )
715if not success then
816 print (" [ERROR] posix module not found" )
@@ -34,16 +42,20 @@ local function find_in_path(file)
3442 return false
3543end
3644
37- print (' Running tests against ' .. basedir .. ' notion/notion ' )
45+ print (' Running tests against ' .. notion_binary )
3846
3947local xpid = posix .fork ()
4048if (xpid == 0 ) then
49+ if running_on_travis then
50+ print (' TRAVIS should have Xfvb running' )
51+ os.exit (1 )
52+ end
4153 local xorg_binary = find_in_path (" Xorg" )
4254 if xorg_binary == false then
4355 print (' Error launching Xorg dummy, Xorg binary not found' )
4456 end
4557 print (' Starting Xorg dummy: ' .. xorg_binary )
46- local result ,errstr ,errno = posix .exec (xorg_binary , " -noreset" , " +extension" , " GLX" , " +extension" , " RANDR" , " +extension" , " RENDER" , " -logfile" , " ./10 .log" , " -config" , " ./xorg.conf" , " :7 " )
58+ local result ,errstr ,errno = posix .exec (xorg_binary , " -noreset" , " +extension" , " GLX" , " +extension" , " RANDR" , " +extension" , " RENDER" , " -logfile" , " ./99 .log" , " -config" , " ./xorg.conf" , " :99 " )
4759 print (' Error replacing current process with Xorg dummy: ' .. errstr )
4860 os.exit (1 )
4961end
@@ -56,13 +68,13 @@ local errors = 0
5668for i ,testset in ipairs (testsets ) do
5769 posix .setenv (' HOME' , testset );
5870
59- os.execute (" rm -rf " .. testset .. " /.notion/default-session--7 " )
71+ os.execute (" rm -rf " .. testset .. " /.notion/default-session--99 " )
6072
6173 print (' Starting notion in ./' .. testset .. ' ...' )
6274
6375 local notionpid = posix .fork ()
6476 if (notionpid == 0 ) then
65- local result ,errstr ,errno = posix .exec (basedir .. " notion/notion " , " -noerrorlog" , " -display" , " :7 " )
77+ local result ,errstr ,errno = posix .exec (notion_binary , " -noerrorlog" , " -display" , " :99 " )
6678 print (' Error replacing current process with notion: ' .. errstr )
6779 os.exit (1 )
6880 end
@@ -71,7 +83,7 @@ for i,testset in ipairs(testsets) do
7183
7284 for test in getTests (testset ) do
7385 print (' [TEST] ' .. test )
74- local testoutputpipe = io.popen (" cat " .. test .. " | DISPLAY=:7 " .. basedir .. " mod_notionflux/notionflux/notionflux " )
86+ local testoutputpipe = io.popen (" cat " .. test .. " | DISPLAY=:99 " .. notionflux_binary )
7587 local testoutput = testoutputpipe :read (" *a" )
7688 local okend = " \" ok\"\n "
7789 if (testoutput == " " or testoutput :sub (-# okend ) ~= okend ) then
0 commit comments