fixing table.unpack issue in testsuite

This commit is contained in:
Axel Kittenberger 2018-03-09 11:07:53 +01:00
parent c0a31c215d
commit ff0f4fbd7a
10 changed files with 43 additions and 48 deletions

View File

@ -91,13 +91,13 @@ add_custom_target( tests
COMMAND echo "Note you are expected to:"
COMMAND echo " * have lua-posix installed"
COMMAND echo " * have a passwordless ssh access to localhost"
COMMAND tests/schedule.lua
COMMAND tests/l4rsyncdata.lua
COMMAND tests/exclude-rsync.lua
COMMAND tests/exclude-rsyncssh.lua
COMMAND tests/churn-rsync.lua
COMMAND tests/churn-rsyncssh.lua
COMMAND tests/churn-direct.lua
COMMAND ${LUA_EXECUTABLE} tests/schedule.lua
COMMAND ${LUA_EXECUTABLE} tests/l4rsyncdata.lua
COMMAND ${LUA_EXECUTABLE} tests/exclude-rsync.lua
COMMAND ${LUA_EXECUTABLE} tests/exclude-rsyncssh.lua
COMMAND ${LUA_EXECUTABLE} tests/churn-rsync.lua
COMMAND ${LUA_EXECUTABLE} tests/churn-rsyncssh.lua
COMMAND ${LUA_EXECUTABLE} tests/churn-direct.lua
COMMAND echo "Finished all successfull!"
)

View File

@ -1,14 +1,14 @@
2018-??-??: 2.2.3
enhaencement: supporting includes with new filter and filterFrom options
change: needing at least Lua 5.2 (was 5.1)
change: needing now at least Lua 5.2 (Lua 5.1 no longer supported, Lua5.3 supported)
change: if the target/targetdir ands with a ':' do not append
a trailing '/' to it, since that would change it from homedir to rootdir!
add: example for Amazon S3 Bucket (Daniel Miranda)
fix: setting stdout/stderr to linebuffer mode.
fix: Lua5.3 compatiblity, using load() instead of loadstring()
Lua5.1 support was thus dropped
fix: cmake lua detection, will resort to "lua" and "luac" binaries only if
more specific suffixes (e.g. luac5.3) are not available
fix: test suit, Lua5.3 compatibility (table.unpack)
2017-02-16: 2.2.2
fix: checkgauge 'insist'

2
tests/churn-direct.lua Executable file → Normal file
View File

@ -21,7 +21,7 @@ local pid = spawn(
'./lsyncd',
'-nodaemon',
'-direct', srcdir, trgdir,
unpack( logs )
table.unpack( logs )
)
cwriteln( 'waiting for Lsyncd to startup' )

2
tests/churn-rsync.lua Executable file → Normal file
View File

@ -20,7 +20,7 @@ local pid = spawn(
'-nodaemon',
'-delay', '5',
'-rsync', srcdir, trgdir,
unpack( logs )
table.unpack( logs )
)
cwriteln( 'waiting for Lsyncd to startup' )

2
tests/churn-rsyncssh.lua Executable file → Normal file
View File

@ -29,7 +29,7 @@ local pid = spawn(
srcdir,
'localhost',
trgdir,
unpack(logs)
table.unpack(logs)
)
cwriteln( 'waiting for Lsyncd to startup' )

0
tests/exclude-rsync.lua Executable file → Normal file
View File

2
tests/exclude-rsyncssh.lua Executable file → Normal file
View File

@ -88,7 +88,7 @@ end
cwriteln( 'testing startup excludes' )
writefiles( )
cwriteln( 'starting Lsyncd' )
local pid = spawn( './lsyncd', cfgfile, unpack( log ) )
local pid = spawn( './lsyncd', cfgfile, table.unpack( log ) )
cwriteln( 'waiting for Lsyncd to start' )
posix.sleep( 10 )
cwriteln( 'testing excludes after startup' )

2
tests/l4rsyncdata.lua Executable file → Normal file
View File

@ -28,7 +28,7 @@ local pid =
'-nodaemon',
'-delay', '5',
"-rsync", srcdir, trgdir,
unpack( logs )
table.unpack( logs )
)
cwriteln( 'waiting for lsyncd to start' )

52
tests/schedule.lua Executable file → Normal file
View File

@ -1,10 +1,10 @@
#!/usr/bin/lua
require("posix")
dofile("tests/testlib.lua")
require( 'posix' )
dofile( 'tests/testlib.lua' )
cwriteln("****************************************************************")
cwriteln(" Testing Lsyncd scheduler ")
cwriteln("****************************************************************")
cwriteln( '****************************************************************' )
cwriteln( ' Testing Lsyncd scheduler ' )
cwriteln( '****************************************************************' )
local tdir, srcdir, trgdir = mktemps()
local logfile = tdir .. "log"
@ -47,30 +47,36 @@ sync {ccircuit, source ="]]..srcdir..[[", target = "]]..trgdir..[["}
-- test if the filename exists, fails if this is different to expect
local function testfile(filename)
local function testfile
(
filename
)
local stat, err = posix.stat(filename)
if not stat then
cwriteln("failure: ",filename," missing")
os.exit(1)
if not stat
then
cwriteln( 'failure: ', filename, ' missing' )
os.exit( 1 )
end
end
cwriteln("starting Lsyncd")
local pid = spawn("./lsyncd", cfgfile, unpack(logs))
cwriteln("waiting for Lsyncd to do a few cycles")
posix.sleep(30)
cwriteln("look if every circle got a chance to run")
testfile(srcdir.."a")
testfile(srcdir.."b")
testfile(srcdir.."c")
cwriteln("killing started Lsyncd")
posix.kill(pid)
local _, exitmsg, lexitcode = posix.wait(lpid)
cwriteln("Exitcode of Lsyncd = ", exitmsg, " ", lexitcode)
cwriteln( 'starting Lsyncd' )
local pid = spawn( './lsyncd', cfgfile, table.unpack( logs ) )
cwriteln( 'waiting for Lsyncd to do a few cycles' )
posix.sleep( 30 )
cwriteln( 'look if every circle got a chance to run' )
testfile( srcdir..'a' )
testfile( srcdir..'b' )
testfile( srcdir..'c' )
cwriteln( 'killing started Lsyncd' )
posix.kill( pid )
local _, exitmsg, lexitcode = posix.wait( lpid )
cwriteln( 'Exitcode of Lsyncd = ', exitmsg, ' ', lexitcode)
posix.sleep(1);
if lexitcode == 143 then
cwriteln("OK")
if lexitcode == 143
then
cwriteln( 'OK' )
os.exit( 0 )
else
os.exit( 1 )

View File

@ -58,17 +58,11 @@ end
function mktemps
( )
local tdir = mktempd() .. '/'
cwriteln( 'using ', tdir, ' as test root' )
local srcdir = tdir..'src/'
local trgdir = tdir..'trg/'
posix.mkdir( srcdir )
posix.mkdir( trgdir )
return tdir, srcdir, trgdir
end
@ -90,9 +84,7 @@ function writefile
end
f:write( text )
f:write( '\n' )
f:close( )
return true
@ -143,11 +135,8 @@ function churn
)
-- all dirs created, indexed by integer and path
root = { name = '' }
alldirs = { root }
dirsWithFileI = { }
dirsWithFileD = { }
--