zeek/testing/btest/scripts/base/utils/dir.test
Robin Sommer 789cb376fd GH-239: Rename bro to zeek, bro-config to zeek-config, and bro-path-dev to zeek-path-dev.
This also installs symlinks from "zeek" and "bro-config" to a wrapper
script that prints a deprecation warning.

The btests pass, but this is still WIP. broctl renaming is still
missing.

#239
2019-05-01 21:43:45 +00:00

67 lines
1.3 KiB
Text

# @TEST-EXEC: btest-bg-run zeek zeek -b ../dirtest.zeek
# @TEST-EXEC: $SCRIPTS/wait-for-file zeek/next1 10 || (btest-bg-wait -k 1 && false)
# @TEST-EXEC: touch testdir/newone
# @TEST-EXEC: rm testdir/bye
# @TEST-EXEC: $SCRIPTS/wait-for-file zeek/next2 10 || (btest-bg-wait -k 1 && false)
# @TEST-EXEC: touch testdir/bye
# @TEST-EXEC: btest-bg-wait 20
# @TEST-EXEC: touch testdir/newone
# @TEST-EXEC: btest-diff zeek/.stdout
@TEST-START-FILE dirtest.zeek
@load base/utils/dir
redef exit_only_after_terminate = T;
global c: count = 0;
global initial_files: set[string] = set();
function check_initial_file(s: string)
{
if ( s in initial_files )
print "initial file", s;
else
print "didn't see initial file", s;
}
function new_file(fname: string)
{
++c;
if ( c <= 3 )
add initial_files[fname];
else
print "new_file", fname;
if ( c == 3 )
{
check_initial_file("../testdir/hi");
check_initial_file("../testdir/howsitgoing");
check_initial_file("../testdir/bye");
system("touch next1");
}
else if ( c == 4 )
system("touch next2");
else if ( c == 5 )
terminate();
}
event zeek_init()
{
Dir::monitor("../testdir", new_file, .25sec);
}
@TEST-END-FILE
@TEST-START-FILE testdir/hi
123
@TEST-END-FILE
@TEST-START-FILE testdir/howsitgoing
abc
@TEST-END-FILE
@TEST-START-FILE testdir/bye
!@#
@TEST-END-FILE