btests for new --optimize-funcs and --optimize-files

This commit is contained in:
Vern Paxson 2021-12-10 13:02:52 -08:00
parent 267f5461d8
commit a0e7feda6f
18 changed files with 198 additions and 0 deletions

View 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

View 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

View 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

View 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!;
}

View 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

View 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

View 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

View 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

View 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

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}

View 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;
}