mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
btests for new --optimize-funcs and --optimize-files
This commit is contained in:
parent
267f5461d8
commit
a0e7feda6f
18 changed files with 198 additions and 0 deletions
4
testing/btest/Baseline/opt.opt-files/output
Normal file
4
testing/btest/Baseline/opt.opt-files/output
Normal file
|
@ -0,0 +1,4 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
I should be ZAM code!
|
||||
my_test
|
||||
ZAM-code my_test
|
8
testing/btest/Baseline/opt.opt-files2/output
Normal file
8
testing/btest/Baseline/opt.opt-files2/output
Normal file
|
@ -0,0 +1,8 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
I shouldn't be ZAM code!
|
||||
my_test
|
||||
{
|
||||
print I shouldn't be ZAM code!;
|
||||
}
|
||||
set_to_regex
|
||||
ZAM-code set_to_regex
|
6
testing/btest/Baseline/opt.opt-files3/output
Normal file
6
testing/btest/Baseline/opt.opt-files3/output
Normal file
|
@ -0,0 +1,6 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
I should be ZAM code!
|
||||
my_test
|
||||
ZAM-code my_test
|
||||
set_to_regex
|
||||
ZAM-code set_to_regex
|
9
testing/btest/Baseline/opt.opt-func/output
Normal file
9
testing/btest/Baseline/opt.opt-func/output
Normal file
|
@ -0,0 +1,9 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
I should be ZAM code!
|
||||
I shouldn't be ZAM code!
|
||||
my_test
|
||||
ZAM-code my_test
|
||||
another_test
|
||||
{
|
||||
print I shouldn't be ZAM code!;
|
||||
}
|
9
testing/btest/Baseline/opt.opt-func2/output
Normal file
9
testing/btest/Baseline/opt.opt-func2/output
Normal file
|
@ -0,0 +1,9 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
I shouldn't be ZAM code!
|
||||
I should be ZAM code!
|
||||
my_test
|
||||
{
|
||||
print I shouldn't be ZAM code!;
|
||||
}
|
||||
another_test
|
||||
ZAM-code another_test
|
7
testing/btest/Baseline/opt.opt-func3/output
Normal file
7
testing/btest/Baseline/opt.opt-func3/output
Normal file
|
@ -0,0 +1,7 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
Me and my buds should be ZAM code!
|
||||
that includes me!
|
||||
my_test
|
||||
ZAM-code my_test
|
||||
another_test
|
||||
ZAM-code another_test
|
2
testing/btest/Baseline/opt.opt-no-files/.stderr
Normal file
2
testing/btest/Baseline/opt.opt-no-files/.stderr
Normal file
|
@ -0,0 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
fatal error: no matching functions/files for C++ compilation
|
2
testing/btest/Baseline/opt.opt-no-func/.stderr
Normal file
2
testing/btest/Baseline/opt.opt-no-func/.stderr
Normal file
|
@ -0,0 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
fatal error: no matching functions/files for C++ compilation
|
2
testing/btest/Baseline/opt.opt-no-func2/.stderr
Normal file
2
testing/btest/Baseline/opt.opt-no-func2/.stderr
Normal file
|
@ -0,0 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
fatal error: no matching functions/files for C++ compilation
|
15
testing/btest/opt/opt-files.zeek
Normal file
15
testing/btest/opt/opt-files.zeek
Normal file
|
@ -0,0 +1,15 @@
|
|||
# @TEST-EXEC: zeek -b -O ZAM --optimize-files='opt-files' %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Tests that we can selectively pick this file.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
print "I should be ZAM code!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
my_test();
|
||||
print my_test;
|
||||
}
|
16
testing/btest/opt/opt-files2.zeek
Normal file
16
testing/btest/opt/opt-files2.zeek
Normal file
|
@ -0,0 +1,16 @@
|
|||
# @TEST-EXEC: zeek -b -O ZAM --optimize-files='base/utils' %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Tests that we can selectively pick a group of files but not this one.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
print "I shouldn't be ZAM code!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
my_test();
|
||||
print my_test;
|
||||
print set_to_regex;
|
||||
}
|
16
testing/btest/opt/opt-files3.zeek
Normal file
16
testing/btest/opt/opt-files3.zeek
Normal file
|
@ -0,0 +1,16 @@
|
|||
# @TEST-EXEC: zeek -b -O ZAM --optimize-files='base/utils' --optimize-files='opt-files3' %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Tests that we can selectively pick a group of files *and* this one.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
print "I should be ZAM code!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
my_test();
|
||||
print my_test;
|
||||
print set_to_regex;
|
||||
}
|
22
testing/btest/opt/opt-func.zeek
Normal file
22
testing/btest/opt/opt-func.zeek
Normal file
|
@ -0,0 +1,22 @@
|
|||
# @TEST-EXEC: zeek -b -O ZAM --optimize-func='my_test' %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Tests that we can selectively a given function.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
print "I should be ZAM code!";
|
||||
}
|
||||
|
||||
function another_test()
|
||||
{
|
||||
print "I shouldn't be ZAM code!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
my_test();
|
||||
another_test();
|
||||
print my_test;
|
||||
print another_test;
|
||||
}
|
23
testing/btest/opt/opt-func2.zeek
Normal file
23
testing/btest/opt/opt-func2.zeek
Normal file
|
@ -0,0 +1,23 @@
|
|||
# @TEST-EXEC: zeek -b -O ZAM --optimize-func='another_test' %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Tests that we can selectively a bunch of functions (event handlers),
|
||||
# but not every function.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
print "I shouldn't be ZAM code!";
|
||||
}
|
||||
|
||||
function another_test()
|
||||
{
|
||||
print "I should be ZAM code!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
my_test();
|
||||
another_test();
|
||||
print my_test;
|
||||
print another_test;
|
||||
}
|
23
testing/btest/opt/opt-func3.zeek
Normal file
23
testing/btest/opt/opt-func3.zeek
Normal file
|
@ -0,0 +1,23 @@
|
|||
# @TEST-EXEC: zeek -b -O ZAM --optimize-func='my_test' --optimize-func='another_test' %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Tests that we can selectively a bunch of functions (event handlers),
|
||||
# and also call out an additional function.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
print "Me and my buds should be ZAM code!";
|
||||
}
|
||||
|
||||
function another_test()
|
||||
{
|
||||
print "that includes me!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
my_test();
|
||||
another_test();
|
||||
print my_test;
|
||||
print another_test;
|
||||
}
|
10
testing/btest/opt/opt-no-files.zeek
Normal file
10
testing/btest/opt/opt-no-files.zeek
Normal file
|
@ -0,0 +1,10 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b -O ZAM --optimize-files='Xopt-files' %INPUT
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
||||
|
||||
# Make sure that if --optimize-files is specified but there are no matching
|
||||
# files, that's caught as an error.
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
print zeek_init;
|
||||
}
|
10
testing/btest/opt/opt-no-func.zeek
Normal file
10
testing/btest/opt/opt-no-func.zeek
Normal file
|
@ -0,0 +1,10 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b -O ZAM --optimize-files='my_func' %INPUT
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
||||
|
||||
# Make sure that if --optimize-func is specified but there are no matching
|
||||
# functions, that's caught as an error.
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
print zeek_init;
|
||||
}
|
14
testing/btest/opt/opt-no-func2.zeek
Normal file
14
testing/btest/opt/opt-no-func2.zeek
Normal file
|
@ -0,0 +1,14 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b -O ZAM --optimize-files='my_func' %INPUT
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
||||
|
||||
# Make sure that --optimize-func anchors the regex.
|
||||
|
||||
function my_func2()
|
||||
{
|
||||
print "I shouldn't match!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
print zeek_init;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue