mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Fix code format of various reporter btests
This commit is contained in:
parent
e896846752
commit
11d8b8c040
8 changed files with 64 additions and 60 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
|
3.2.0-dev.46 | 2020-02-14 22:02:50 -0800
|
||||||
|
|
||||||
|
* Fix code format of various reporter btests (Jon Siwek, Corelight)
|
||||||
|
|
||||||
3.2.0-dev.45 | 2020-02-14 21:14:49 -0800
|
3.2.0-dev.45 | 2020-02-14 21:14:49 -0800
|
||||||
|
|
||||||
* Update libkqueue for a linux bugfix (Jon Siwek, Corelight)
|
* Update libkqueue for a linux bugfix (Jon Siwek, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
3.2.0-dev.45
|
3.2.0-dev.46
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# than looping indefinitly, the error inside the handler should reported to stderr.
|
# than looping indefinitly, the error inside the handler should reported to stderr.
|
||||||
#
|
#
|
||||||
# TODO: interpreter exceptions currently may cause memory leaks, so disable leak checks
|
# TODO: interpreter exceptions currently may cause memory leaks, so disable leak checks
|
||||||
# @TEST-EXEC: ASAN_OPTIONS="$ASAN_OPTIONS,detect_leaks=0" zeek %INPUT >output 2>&1
|
# @TEST-EXEC: ASAN_OPTIONS="$ASAN_OPTIONS,detect_leaks=0" zeek -b %INPUT >output 2>&1
|
||||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
||||||
|
|
||||||
global a: table[count] of count;
|
global a: table[count] of count;
|
||||||
|
@ -11,20 +11,20 @@ global a: table[count] of count;
|
||||||
global c = 0;
|
global c = 0;
|
||||||
|
|
||||||
event reporter_error(t: time, msg: string, location: string)
|
event reporter_error(t: time, msg: string, location: string)
|
||||||
{
|
{
|
||||||
c += 1;
|
c += 1;
|
||||||
|
|
||||||
if ( c > 1 )
|
if ( c > 1 )
|
||||||
print "FAILED: 2nd error reported to script as well.";
|
print "FAILED: 2nd error reported to script as well.";
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print "1st error printed on script level";
|
print "1st error printed on script level";
|
||||||
print a[2];
|
print a[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
print a[1];
|
print a[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
# The format string below should end up as a literal part of the reporter's
|
# The format string below should end up as a literal part of the reporter's
|
||||||
# error message to stderr and shouldn't be replaced internally.
|
# error message to stderr and shouldn't be replaced internally.
|
||||||
#
|
#
|
||||||
# @TEST-EXEC-FAIL: zeek %INPUT >output 2>&1
|
# @TEST-EXEC-FAIL: zeek -b %INPUT >output 2>&1
|
||||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
event dont_interpret_this("%s");
|
event dont_interpret_this("%s");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#
|
#
|
||||||
# @TEST-EXEC-FAIL: zeek %INPUT >output 2>&1
|
# @TEST-EXEC-FAIL: zeek -b %INPUT >output 2>&1
|
||||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
print TESTFAILURE;
|
print TESTFAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
#
|
#
|
||||||
# @TEST-EXEC-FAIL: zeek %INPUT >output 2>&1
|
# @TEST-EXEC-FAIL: zeek -b %INPUT >output 2>&1
|
||||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
||||||
|
|
||||||
global a: table[count] of count;
|
global a: table[count] of count;
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
print a[2];
|
print a[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
print a[1];
|
print a[1];
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#
|
#
|
||||||
# @TEST-EXEC-FAIL: zeek %INPUT >output 2>&1
|
# @TEST-EXEC-FAIL: zeek -b %INPUT >output 2>&1
|
||||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
||||||
|
|
||||||
event foo(a: string)
|
event foo(a: string)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
event foo(42);
|
event foo(42);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,50 +4,50 @@
|
||||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER="$SCRIPTS/diff-remove-abspath | $SCRIPTS/diff-remove-timestamps" btest-diff logger-test.log
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER="$SCRIPTS/diff-remove-abspath | $SCRIPTS/diff-remove-timestamps" btest-diff logger-test.log
|
||||||
|
|
||||||
event zeek_init()
|
event zeek_init()
|
||||||
{
|
{
|
||||||
Reporter::info("init test-info");
|
Reporter::info("init test-info");
|
||||||
Reporter::warning("init test-warning");
|
Reporter::warning("init test-warning");
|
||||||
Reporter::error("init test-error");
|
Reporter::error("init test-error");
|
||||||
}
|
}
|
||||||
|
|
||||||
event zeek_done()
|
event zeek_done()
|
||||||
{
|
{
|
||||||
Reporter::info("done test-info");
|
Reporter::info("done test-info");
|
||||||
Reporter::warning("done test-warning");
|
Reporter::warning("done test-warning");
|
||||||
Reporter::error("done test-error");
|
Reporter::error("done test-error");
|
||||||
}
|
}
|
||||||
|
|
||||||
global first = 1;
|
global first = 1;
|
||||||
|
|
||||||
event connection_established(c: connection)
|
event connection_established(c: connection)
|
||||||
{
|
{
|
||||||
if ( ! first )
|
if ( ! first )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
print "established";
|
print "established";
|
||||||
|
|
||||||
Reporter::info("processing test-info");
|
Reporter::info("processing test-info");
|
||||||
Reporter::warning("processing test-warning");
|
Reporter::warning("processing test-warning");
|
||||||
Reporter::error("processing test-error");
|
Reporter::error("processing test-error");
|
||||||
first = 0;
|
first = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
global f = open("logger-test.log");
|
global f = open("logger-test.log");
|
||||||
|
|
||||||
event reporter_info(t: time, msg: string, location: string)
|
event reporter_info(t: time, msg: string, location: string)
|
||||||
{
|
{
|
||||||
print f, fmt("reporter_info|%s|%s|%.6f", msg, location, t);
|
print f, fmt("reporter_info|%s|%s|%.6f", msg, location, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
event reporter_warning(t: time, msg: string, location: string)
|
event reporter_warning(t: time, msg: string, location: string)
|
||||||
{
|
{
|
||||||
print f, fmt("reporter_warning|%s|%s|%.6f", msg, location, t);
|
print f, fmt("reporter_warning|%s|%s|%.6f", msg, location, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
event reporter_error(t: time, msg: string, location: string)
|
event reporter_error(t: time, msg: string, location: string)
|
||||||
{
|
{
|
||||||
print f, fmt("reporter_error|%s|%s|%.6f", msg, location, t);
|
print f, fmt("reporter_error|%s|%s|%.6f", msg, location, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
Reporter::info("pre test-info");
|
Reporter::info("pre test-info");
|
||||||
Reporter::warning("pre test-warning");
|
Reporter::warning("pre test-warning");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue