lsyncd/tests/churn-rsyncssh.lua

66 lines
1.3 KiB
Lua
Raw Normal View History

2010-11-18 16:33:48 +00:00
-- a heavy duty test.
-- makes thousends of random changes to the source tree
2012-11-23 15:04:43 +00:00
require( 'posix' )
dofile( 'tests/testlib.lua' )
cwriteln( '****************************************************************' )
cwriteln( ' Testing default.rsyncssh with random data activity ' )
cwriteln( '****************************************************************' )
2011-01-26 11:05:53 +00:00
2010-11-30 20:08:20 +00:00
local tdir, srcdir, trgdir = mktemps()
2010-11-24 19:21:43 +00:00
2012-02-17 08:12:01 +00:00
-- makes some startup data
churn( srcdir, 5, true )
2010-11-24 21:26:41 +00:00
2010-11-24 19:21:43 +00:00
local logs = {}
2012-11-23 15:04:43 +00:00
logs = { '-log', 'Delay' }
2010-11-24 20:34:56 +00:00
2012-11-23 15:04:43 +00:00
local pid = spawn(
'./lsyncd',
'-nodaemon',
'-delay',
'5',
2021-12-08 17:26:11 +00:00
'-sshopts',
'-i tests/ssh/id_rsa -p 2468 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null',
2012-11-23 15:04:43 +00:00
'-rsyncssh',
srcdir,
'localhost',
trgdir,
2018-03-09 10:07:53 +00:00
table.unpack(logs)
2012-11-23 15:04:43 +00:00
)
2010-11-18 16:33:48 +00:00
2012-11-23 15:04:43 +00:00
cwriteln( 'waiting for Lsyncd to startup' )
posix.sleep( 1 )
2010-11-18 16:33:48 +00:00
2017-01-05 09:10:55 +00:00
churn( srcdir, 150, false )
2010-11-18 16:33:48 +00:00
2012-11-23 15:04:43 +00:00
cwriteln( 'waiting for Lsyncd to finish its jobs.' )
posix.sleep( 10 )
2010-11-18 16:33:48 +00:00
2012-11-23 15:04:43 +00:00
cwriteln( 'killing the Lsyncd daemon' )
2010-11-20 22:51:53 +00:00
posix.kill(pid)
local _, exitmsg, lexitcode = posix.wait( pid )
2012-11-23 15:04:43 +00:00
cwriteln( 'Exitcode of Lsyncd = ', exitmsg, ' ', lexitcode )
2010-11-18 16:33:48 +00:00
local result, code = execute( 'diff -r ' .. srcdir .. ' ' .. trgdir )
2012-10-07 18:48:09 +00:00
if result == 'exit'
then
cwriteln( 'Exitcode of diff = ', code )
else
cwriteln( 'Signal terminating diff = ', code )
end
if code ~= 0
then
2012-11-23 15:04:43 +00:00
os.exit( 1 )
2010-11-20 22:51:53 +00:00
else
2012-11-23 15:04:43 +00:00
os.exit( 0 )
2010-11-20 22:51:53 +00:00
end
2010-11-18 16:33:48 +00:00