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

Yes, really. :-) We've hit the need for this on occasion in very specific settings and always worked around it via ugly nested loops or similars. This has ample warning that folks normally won't want to use this. Not sure that ZAM btest should baseline the number of BiFs.
21 lines
588 B
Text
21 lines
588 B
Text
# Verifies sleep()'s reported latencies.
|
|
#
|
|
# @TEST-EXEC: zeek -b %INPUT 2>out
|
|
# @TEST-EXEC: btest-diff out
|
|
|
|
function test_sleep(i: interval)
|
|
{
|
|
local start = current_time();
|
|
local sleep_delay = sleep(i);
|
|
local script_delay = current_time() - start;
|
|
|
|
assert script_delay >= i, fmt("sleep() took %s, less than %s", script_delay, i);
|
|
assert sleep_delay >= i, fmt("slept for %s, less than %s", script_delay, i);
|
|
assert sleep_delay <= script_delay, fmt("sleep() claims %s, longer than %s", sleep_delay, script_delay);
|
|
}
|
|
|
|
event zeek_init()
|
|
{
|
|
test_sleep(100msec);
|
|
test_sleep(1sec);
|
|
}
|