diff --git a/CMakeLists.txt b/CMakeLists.txt index 17a5b00..d7dea10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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!" ) diff --git a/ChangeLog b/ChangeLog index c29a0f9..4b0dccc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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' diff --git a/tests/churn-direct.lua b/tests/churn-direct.lua old mode 100755 new mode 100644 index 0a28b8f..c01744c --- a/tests/churn-direct.lua +++ b/tests/churn-direct.lua @@ -21,7 +21,7 @@ local pid = spawn( './lsyncd', '-nodaemon', '-direct', srcdir, trgdir, - unpack( logs ) + table.unpack( logs ) ) cwriteln( 'waiting for Lsyncd to startup' ) diff --git a/tests/churn-rsync.lua b/tests/churn-rsync.lua old mode 100755 new mode 100644 index dfa0614..f7d3025 --- a/tests/churn-rsync.lua +++ b/tests/churn-rsync.lua @@ -20,7 +20,7 @@ local pid = spawn( '-nodaemon', '-delay', '5', '-rsync', srcdir, trgdir, - unpack( logs ) + table.unpack( logs ) ) cwriteln( 'waiting for Lsyncd to startup' ) diff --git a/tests/churn-rsyncssh.lua b/tests/churn-rsyncssh.lua old mode 100755 new mode 100644 index ddb49f8..2633a42 --- a/tests/churn-rsyncssh.lua +++ b/tests/churn-rsyncssh.lua @@ -29,7 +29,7 @@ local pid = spawn( srcdir, 'localhost', trgdir, - unpack(logs) + table.unpack(logs) ) cwriteln( 'waiting for Lsyncd to startup' ) diff --git a/tests/exclude-rsync.lua b/tests/exclude-rsync.lua old mode 100755 new mode 100644 diff --git a/tests/exclude-rsyncssh.lua b/tests/exclude-rsyncssh.lua old mode 100755 new mode 100644 index 45388b5..f79703f --- a/tests/exclude-rsyncssh.lua +++ b/tests/exclude-rsyncssh.lua @@ -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' ) diff --git a/tests/l4rsyncdata.lua b/tests/l4rsyncdata.lua old mode 100755 new mode 100644 index b45db1f..86586c0 --- a/tests/l4rsyncdata.lua +++ b/tests/l4rsyncdata.lua @@ -28,7 +28,7 @@ local pid = '-nodaemon', '-delay', '5', "-rsync", srcdir, trgdir, - unpack( logs ) + table.unpack( logs ) ) cwriteln( 'waiting for lsyncd to start' ) diff --git a/tests/schedule.lua b/tests/schedule.lua old mode 100755 new mode 100644 index 6a638f8..7201e8a --- a/tests/schedule.lua +++ b/tests/schedule.lua @@ -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 ) diff --git a/tests/testlib.lua b/tests/testlib.lua index 7952a7a..1b386e2 100644 --- a/tests/testlib.lua +++ b/tests/testlib.lua @@ -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 = { } --