mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix a long-standing bug in the math around continue_processing
This commit is contained in:
parent
adcaa459c9
commit
95b6069c6e
3 changed files with 40 additions and 2 deletions
|
@ -527,12 +527,13 @@ void continue_processing()
|
|||
detail::current_wallclock = util::current_time(true);
|
||||
}
|
||||
|
||||
if ( _processing_suspended > 0 )
|
||||
--_processing_suspended;
|
||||
}
|
||||
|
||||
bool is_processing_suspended()
|
||||
{
|
||||
return _processing_suspended;
|
||||
return _processing_suspended > 0;
|
||||
}
|
||||
|
||||
} // namespace zeek::run_state
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
F
|
||||
F
|
||||
T
|
||||
F
|
||||
F
|
31
testing/btest/core/suspend_processing/suspension-stack.zeek
Normal file
31
testing/btest/core/suspend_processing/suspension-stack.zeek
Normal file
|
@ -0,0 +1,31 @@
|
|||
# @TEST-DOC: Test that chains of suspend_processing/continue_processing report the correct suspension status
|
||||
# @TEST-EXEC: zeek %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
# Paired suspend/continue should unsuspend.
|
||||
suspend_processing();
|
||||
continue_processing();
|
||||
print is_processing_suspended(); # F
|
||||
|
||||
# Another continue after unsuspending shouldn't cause it to be suspended.
|
||||
continue_processing();
|
||||
print is_processing_suspended(); # F
|
||||
|
||||
# Test suspend "stack" by suspending twice
|
||||
suspend_processing();
|
||||
suspend_processing();
|
||||
|
||||
# First continue should still be suspended
|
||||
continue_processing();
|
||||
print is_processing_suspended(); # T
|
||||
|
||||
# Second continue should break the suspension
|
||||
continue_processing();
|
||||
print is_processing_suspended(); # F
|
||||
|
||||
# Third continue should still be marked as not suspended.
|
||||
continue_processing();
|
||||
print is_processing_suspended(); # F
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue