mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-08 09:18:30 +00:00
beautified some tests
This commit is contained in:
parent
ca3d3eca59
commit
824797645b
@ -1,12 +1,12 @@
|
|||||||
#!/usr/bin/lua
|
#!/usr/bin/lua
|
||||||
-- a heavy duty test.
|
-- a heavy duty test.
|
||||||
-- makes thousends of random changes to the source tree
|
-- makes thousends of random changes to the source tree
|
||||||
require( "posix" )
|
require( 'posix' )
|
||||||
dofile( "tests/testlib.lua" )
|
dofile( 'tests/testlib.lua' )
|
||||||
|
|
||||||
cwriteln( "****************************************************************" )
|
cwriteln( '****************************************************************' )
|
||||||
cwriteln( " Testing default.rsync with random data activity" )
|
cwriteln( ' Testing default.rsync with random data activity' )
|
||||||
cwriteln( "****************************************************************" )
|
cwriteln( '****************************************************************' )
|
||||||
|
|
||||||
local tdir, srcdir, trgdir = mktemps( )
|
local tdir, srcdir, trgdir = mktemps( )
|
||||||
|
|
||||||
@ -16,35 +16,35 @@ churn( srcdir, 100 )
|
|||||||
local logs = { }
|
local logs = { }
|
||||||
-- logs = { "-log", "Delay", "-log", "Fsevents" }
|
-- logs = { "-log", "Delay", "-log", "Fsevents" }
|
||||||
local pid = spawn(
|
local pid = spawn(
|
||||||
"./lsyncd",
|
'./lsyncd',
|
||||||
"-nodaemon",
|
'-nodaemon',
|
||||||
"-delay", "5",
|
'-delay', '5',
|
||||||
"-rsync", srcdir, trgdir,
|
'-rsync', srcdir, trgdir,
|
||||||
unpack( logs )
|
unpack( logs )
|
||||||
)
|
)
|
||||||
|
|
||||||
cwriteln( "waiting for Lsyncd to startup" )
|
cwriteln( 'waiting for Lsyncd to startup' )
|
||||||
|
|
||||||
posix.sleep( 1 )
|
posix.sleep( 1 )
|
||||||
|
|
||||||
churn( srcdir, 500 )
|
churn( srcdir, 500 )
|
||||||
|
|
||||||
cwriteln( "waiting for Lsyncd to finish its jobs." )
|
cwriteln( 'waiting for Lsyncd to finish its jobs.' )
|
||||||
|
|
||||||
posix.sleep( 10 )
|
posix.sleep( 10 )
|
||||||
|
|
||||||
cwriteln( "killing the Lsyncd daemon" )
|
cwriteln( 'killing the Lsyncd daemon' )
|
||||||
|
|
||||||
posix.kill(pid)
|
posix.kill( pid )
|
||||||
local _, exitmsg, lexitcode = posix.wait( lpid )
|
local _, exitmsg, lexitcode = posix.wait( lpid )
|
||||||
cwriteln("Exitcode of Lsyncd = ", exitmsg, " ", lexitcode)
|
cwriteln( 'Exitcode of Lsyncd = ', exitmsg, ' ', lexitcode )
|
||||||
|
|
||||||
exitcode = os.execute( "diff -r "..srcdir.." "..trgdir )
|
exitcode = os.execute( 'diff -r '..srcdir..' '..trgdir )
|
||||||
cwriteln( "Exitcode of diff = '", exitcode, "'" )
|
cwriteln( 'Exitcode of diff = "', exitcode, '"' )
|
||||||
|
|
||||||
if exitcode ~= 0 then
|
if exitcode ~= 0 then
|
||||||
os.exit(1)
|
os.exit( 1 )
|
||||||
else
|
else
|
||||||
os.exit(0)
|
os.exit( 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,47 +1,56 @@
|
|||||||
#!/usr/bin/lua
|
#!/usr/bin/lua
|
||||||
-- a heavy duty test.
|
-- a heavy duty test.
|
||||||
-- makes thousends of random changes to the source tree
|
-- makes thousends of random changes to the source tree
|
||||||
require("posix")
|
|
||||||
dofile("tests/testlib.lua")
|
|
||||||
|
|
||||||
cwriteln("****************************************************************");
|
require( 'posix' )
|
||||||
cwriteln(" Testing default.rsyncssh with random data activity");
|
|
||||||
cwriteln("****************************************************************");
|
dofile( 'tests/testlib.lua' )
|
||||||
cwriteln("( this test needs passwordless ssh localhost access )");
|
|
||||||
cwriteln("( for current user )");
|
cwriteln( '****************************************************************' )
|
||||||
|
cwriteln( ' Testing default.rsyncssh with random data activity ' )
|
||||||
|
cwriteln( '****************************************************************' )
|
||||||
|
cwriteln( '( this test needs passwordless ssh localhost access )' )
|
||||||
|
cwriteln( '( for current user )' )
|
||||||
|
|
||||||
local tdir, srcdir, trgdir = mktemps()
|
local tdir, srcdir, trgdir = mktemps()
|
||||||
|
|
||||||
-- makes some startup data
|
-- makes some startup data
|
||||||
churn(srcdir, 100)
|
churn( srcdir, 100 )
|
||||||
|
|
||||||
local logs = {}
|
local logs = {}
|
||||||
logs = {"-log", "Delay" }
|
logs = { '-log', 'Delay' }
|
||||||
|
|
||||||
local pid = spawn("./lsyncd", "-nodaemon", "-delay", "5",
|
local pid = spawn(
|
||||||
"-rsyncssh", srcdir, "localhost", trgdir,
|
'./lsyncd',
|
||||||
unpack(logs))
|
'-nodaemon',
|
||||||
|
'-delay',
|
||||||
|
'5',
|
||||||
|
'-rsyncssh',
|
||||||
|
srcdir,
|
||||||
|
'localhost',
|
||||||
|
trgdir,
|
||||||
|
unpack(logs)
|
||||||
|
)
|
||||||
|
|
||||||
cwriteln("waiting for Lsyncd to startup")
|
cwriteln( 'waiting for Lsyncd to startup' )
|
||||||
posix.sleep(1)
|
posix.sleep( 1 )
|
||||||
|
|
||||||
churn(srcdir, 100)
|
churn( srcdir, 100 )
|
||||||
|
|
||||||
cwriteln("waiting for Lsyncd to finish its jobs.")
|
cwriteln( 'waiting for Lsyncd to finish its jobs.' )
|
||||||
posix.sleep(10)
|
posix.sleep( 10 )
|
||||||
|
|
||||||
cwriteln("killing the Lsyncd daemon")
|
cwriteln( 'killing the Lsyncd daemon' )
|
||||||
posix.kill(pid)
|
posix.kill(pid)
|
||||||
local _, exitmsg, lexitcode = posix.wait(lpid)
|
local _, exitmsg, lexitcode = posix.wait(lpid)
|
||||||
cwriteln("Exitcode of Lsyncd = ", exitmsg, " ", lexitcode)
|
cwriteln( 'Exitcode of Lsyncd = ', exitmsg, ' ', lexitcode )
|
||||||
|
|
||||||
exitcode = os.execute("diff -r "..srcdir.." "..trgdir)
|
exitcode = os.execute( 'diff -r ' .. srcdir .. ' ' .. trgdir )
|
||||||
cwriteln("Exitcode of diff = '", exitcode, "'")
|
cwriteln( 'Exitcode of diff = "', exitcode, '"' )
|
||||||
|
|
||||||
if exitcode ~= 0 then
|
if exitcode ~= 0 then
|
||||||
os.exit(1)
|
os.exit( 1 )
|
||||||
else
|
else
|
||||||
os.exit(0)
|
os.exit( 0 )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user