11-- # on Debian in lua-posix
22local basedir = " ../../"
3- local posix = require " posix"
3+
4+ print (" [TESTING] Integration" )
5+
6+ local success , posix = pcall (require , " posix" )
7+ if not success then
8+ print (" [SKIP] posix module not found" )
9+ os.exit (0 )
10+ end
411
512function sleep (sec )
613 os.execute (" sleep " .. tonumber (sec ))
2229
2330sleep (1 )
2431
25- print ' (Hopefully) started Xorg dummy.'
26-
2732local testsets = { ' basic_test' , ' xinerama' , ' xrandr' }
2833local errors = 0
2934
3035for i ,testset in ipairs (testsets ) do
31-
3236 posix .setenv (' HOME' , testset );
3337
34- os.execute (" rm -r " .. testset .. " /.notion/default-session--7" )
38+ os.execute (" rm -rf " .. testset .. " /.notion/default-session--7" )
3539
3640 print (' Starting notion in ./' .. testset .. ' ...' )
3741
@@ -44,18 +48,15 @@ for i,testset in ipairs(testsets) do
4448
4549 sleep (2 )
4650
47- print ' Running tests...'
48-
4951 for test in getTests (testset ) do
50- print (' Running test ' .. test )
52+ print (' [TEST] ' .. test )
5153 local testoutputpipe = io.popen (" cat " .. test .. " | DISPLAY=:7 " .. basedir .. " mod_notionflux/notionflux/notionflux" )
5254 local testoutput = testoutputpipe :read (" *a" )
53- print ' Evaluating result...'
5455 if (testoutput ~= " \" ok\"\n " ) then
55- print (' ** ERROR ** ' .. testoutput )
56+ print (' [ ERROR] ' .. testoutput )
5657 errors = errors + 1
5758 else
58- print ' ** OK ** '
59+ print ' [OK] '
5960 end
6061 end
6162
@@ -69,7 +70,8 @@ print 'Killing X process...'
6970posix .kill (xpid )
7071
7172if errors == 0 then
72- print ' OK! '
73+ print ' [OK] '
7374else
74- print (errors .. " errors ." )
75+ print (' [ERROR] ' .. errors .. " tests failed ." )
7576end
77+ os.exit (errors )
0 commit comments