From f4c15496dcd08b94076d3bbc5ceb5072e7050e1e Mon Sep 17 00:00:00 2001 From: Daniel Poelzleithner Date: Fri, 11 Nov 2022 18:26:57 +0100 Subject: [PATCH] fix cron test --- .gitignore | 2 +- tests/cron-rsync.lua | 27 +-------------------------- tests/testlib.lua | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index eb31fd1..96c623f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ lsyncd AdditionalInfo.txt config.h Makefile -build/ +build*/ CMakeCache.txt CMakeFiles/ cmake_install.cmake diff --git a/tests/cron-rsync.lua b/tests/cron-rsync.lua index 3981a8f..7be751f 100644 --- a/tests/cron-rsync.lua +++ b/tests/cron-rsync.lua @@ -64,31 +64,6 @@ local function writefiles writefile( srcdir .. 'xcx/x', 'xcxx' ) end --- --- Tests if the filename exists --- fails if this is different to expect. --- -local function testfile -( - filename, - expect -) - local stat, err = posix.stat( filename ) - - if stat and not expect - then - cwriteln( 'failure: ', filename, ' should be filtered') - - os.exit( 1 ) - end - - if not stat and expect - then - cwriteln( 'failure: ', filename, ' should not be filtered' ) - os.exit( 1 ) - end -end - -- test all files local function testfiles ( ) @@ -148,7 +123,7 @@ writefiles( ) cwriteln( 'waiting for Lsyncd to transmit changes' ) -posix.sleep( 5 ) +posix.sleep( 20 ) testfiles( ) diff --git a/tests/testlib.lua b/tests/testlib.lua index ead349c..9dac61d 100644 --- a/tests/testlib.lua +++ b/tests/testlib.lua @@ -674,3 +674,27 @@ function isTableEqual(o1, o2, ignore_mt) return true end +-- +-- Tests if the filename exists +-- fails if this is different to expect. +-- +function testfile + ( + filename, + expect + ) + local stat, err = posix.stat( filename ) + + if stat and not expect + then + cwriteln( 'failure: ', filename, ' should be filtered') + + os.exit( 1 ) + end + + if not stat and expect + then + cwriteln( 'failure: ', filename, ' should not be filtered' ) + os.exit( 1 ) + end +end \ No newline at end of file