mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

This allows Zeek execution to continue gracefully in the presence of such errors, particularly at zeek_init() time. Includes a tweak to expand the bifs.directory_operations test to check continuation after errors. Resolves #3595.
30 lines
660 B
Text
30 lines
660 B
Text
#
|
|
# @TEST-EXEC: zeek -b %INPUT >out
|
|
# @TEST-EXEC: btest-diff out
|
|
|
|
event zeek_init()
|
|
{
|
|
# Test successful operations...
|
|
print mkdir("testdir");
|
|
print mkdir("testdir");
|
|
local a = open("testdir/testfile");
|
|
close(a);
|
|
print rename("testdir/testfile", "testdir/testfile2");
|
|
print rename("testdir", "testdir2");
|
|
print unlink("testdir2/testfile2");
|
|
print rmdir("testdir2");
|
|
|
|
# ... and failing ones.
|
|
print unlink("nonexisting");
|
|
print rename("a", "b");
|
|
print rmdir("nonexisting");
|
|
a = open("testfile");
|
|
close(a);
|
|
print mkdir("testfile");
|
|
}
|
|
|
|
event zeek_done()
|
|
{
|
|
# Only reached when above failures don't cause Zeek to exit.
|
|
print "Shutting down.";
|
|
}
|