mirror of
https://github.com/zeek/zeek.git
synced 2025-10-01 22:28:20 +00:00
BTests & baselines for testing selective skipping of script optimization
This commit is contained in:
parent
441baaf2c1
commit
dc7f4dca1c
27 changed files with 246 additions and 10 deletions
9
testing/btest/Baseline.cpp/language.skip-opt1/out
Normal file
9
testing/btest/Baseline.cpp/language.skip-opt1/out
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.
|
||||
always: function() : void
|
||||
compiled-C++
|
||||
no_ZAM: function() : void
|
||||
compiled-C++
|
||||
no_CPP: function() : void
|
||||
{
|
||||
print no CPP;
|
||||
}
|
11
testing/btest/Baseline.cpp/language.skip-opt2/out
Normal file
11
testing/btest/Baseline.cpp/language.skip-opt2/out
Normal file
|
@ -0,0 +1,11 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
always: function() : void
|
||||
{
|
||||
print always;
|
||||
}
|
||||
no_ZAM: function() : void
|
||||
compiled-C++
|
||||
no_CPP: function() : void
|
||||
{
|
||||
print no CPP;
|
||||
}
|
9
testing/btest/Baseline.zam/language.skip-opt1/out
Normal file
9
testing/btest/Baseline.zam/language.skip-opt1/out
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.
|
||||
always: function() : void
|
||||
ZAM-code always
|
||||
no_ZAM: function() : void
|
||||
{
|
||||
print no ZAM;
|
||||
}
|
||||
no_CPP: function() : void
|
||||
ZAM-code no_CPP
|
11
testing/btest/Baseline.zam/language.skip-opt2/out
Normal file
11
testing/btest/Baseline.zam/language.skip-opt2/out
Normal file
|
@ -0,0 +1,11 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
always: function() : void
|
||||
{
|
||||
print always;
|
||||
}
|
||||
no_ZAM: function() : void
|
||||
{
|
||||
print no ZAM;
|
||||
}
|
||||
no_CPP: function() : void
|
||||
ZAM-code no_CPP
|
13
testing/btest/Baseline/language.skip-opt1/out
Normal file
13
testing/btest/Baseline/language.skip-opt1/out
Normal file
|
@ -0,0 +1,13 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
always: function() : void
|
||||
{
|
||||
print always;
|
||||
}
|
||||
no_ZAM: function() : void
|
||||
{
|
||||
print no ZAM;
|
||||
}
|
||||
no_CPP: function() : void
|
||||
{
|
||||
print no CPP;
|
||||
}
|
13
testing/btest/Baseline/language.skip-opt2/out
Normal file
13
testing/btest/Baseline/language.skip-opt2/out
Normal file
|
@ -0,0 +1,13 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
always: function() : void
|
||||
{
|
||||
print always;
|
||||
}
|
||||
no_ZAM: function() : void
|
||||
{
|
||||
print no ZAM;
|
||||
}
|
||||
no_CPP: function() : void
|
||||
{
|
||||
print no CPP;
|
||||
}
|
13
testing/btest/Baseline/language.skip-opt3/out
Normal file
13
testing/btest/Baseline/language.skip-opt3/out
Normal file
|
@ -0,0 +1,13 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
always: function() : void
|
||||
{
|
||||
print always;
|
||||
}
|
||||
no_ZAM: function() : void
|
||||
{
|
||||
print no ZAM;
|
||||
}
|
||||
no_CPP: function() : void
|
||||
{
|
||||
print no CPP;
|
||||
}
|
6
testing/btest/Baseline/opt.opt-skip-files/output
Normal file
6
testing/btest/Baseline/opt.opt-skip-files/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 shouldn't be ZAM code!
|
||||
my_test: function() : void
|
||||
{
|
||||
print I shouldn't be ZAM code!;
|
||||
}
|
6
testing/btest/Baseline/opt.opt-skip-funcs/out1
Normal file
6
testing/btest/Baseline/opt.opt-skip-funcs/out1
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 shouldn't be ZAM code!
|
||||
my_test: function() : void
|
||||
{
|
||||
print I shouldn't be ZAM code!;
|
||||
}
|
6
testing/btest/Baseline/opt.opt-skip-funcs/out2
Normal file
6
testing/btest/Baseline/opt.opt-skip-funcs/out2
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 shouldn't be ZAM code!
|
||||
my_test: function() : void
|
||||
{
|
||||
print I shouldn't be ZAM code!;
|
||||
}
|
4
testing/btest/Baseline/opt.opt-skip-other/out1
Normal file
4
testing/btest/Baseline/opt.opt-skip-other/out1
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: function() : void
|
||||
ZAM-code my_test
|
4
testing/btest/Baseline/opt.opt-skip-other/out2
Normal file
4
testing/btest/Baseline/opt.opt-skip-other/out2
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: function() : void
|
||||
ZAM-code my_test
|
24
testing/btest/language/skip-opt1.zeek
Normal file
24
testing/btest/language/skip-opt1.zeek
Normal file
|
@ -0,0 +1,24 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out 2>&1
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
function always()
|
||||
{
|
||||
print "always";
|
||||
}
|
||||
|
||||
function no_ZAM() &no_ZAM_opt
|
||||
{
|
||||
print "no ZAM";
|
||||
}
|
||||
|
||||
function no_CPP() &no_CPP_opt
|
||||
{
|
||||
print "no CPP";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
print always;
|
||||
print no_ZAM;
|
||||
print no_CPP;
|
||||
}
|
24
testing/btest/language/skip-opt2.zeek
Normal file
24
testing/btest/language/skip-opt2.zeek
Normal file
|
@ -0,0 +1,24 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT --no-optimize-func=always >out 2>&1
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
function always()
|
||||
{
|
||||
print "always";
|
||||
}
|
||||
|
||||
function no_ZAM() &no_ZAM_opt
|
||||
{
|
||||
print "no ZAM";
|
||||
}
|
||||
|
||||
function no_CPP() &no_CPP_opt
|
||||
{
|
||||
print "no CPP";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
print always;
|
||||
print no_ZAM;
|
||||
print no_CPP;
|
||||
}
|
24
testing/btest/language/skip-opt3.zeek
Normal file
24
testing/btest/language/skip-opt3.zeek
Normal file
|
@ -0,0 +1,24 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT --no-optimize-file=skip-opt >out 2>&1
|
||||
# @TEST-EXEC: btest-diff out
|
||||
|
||||
function always()
|
||||
{
|
||||
print "always";
|
||||
}
|
||||
|
||||
function no_ZAM() &no_ZAM_opt
|
||||
{
|
||||
print "no ZAM";
|
||||
}
|
||||
|
||||
function no_CPP() &no_CPP_opt
|
||||
{
|
||||
print "no CPP";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
print always;
|
||||
print no_ZAM;
|
||||
print no_CPP;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM --optimize-files='opt-files' %INPUT >output
|
||||
# @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.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM --optimize-files='base/utils' %INPUT >output
|
||||
# @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.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM --optimize-files='base/utils' --optimize-files='opt-files3' %INPUT >output
|
||||
# @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.
|
||||
# Tests that we can selectively pick a group of (other) files *and* this one.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM --optimize-func='my_test' %INPUT >output
|
||||
# @TEST-EXEC: zeek -b -O ZAM --optimize-func=my_test %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Tests that we can selectively pick a given function.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM --optimize-func='another_test' %INPUT >output
|
||||
# @TEST-EXEC: zeek -b -O ZAM --optimize-func=another_test %INPUT >output
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# Tests that we can selectively pick a bunch of functions (event handlers),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM --optimize-func='my_test' --optimize-func='another_test' %INPUT >output
|
||||
# @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 pick a bunch of functions (event handlers),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b -O ZAM --optimize-files='Xopt-files' %INPUT
|
||||
# @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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b -O ZAM --optimize-files='my_func' %INPUT
|
||||
# @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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# @TEST-EXEC-FAIL: zeek -b -O ZAM --optimize-files='my_func' %INPUT
|
||||
# @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.
|
||||
|
|
20
testing/btest/opt/opt-skip-files.zeek
Normal file
20
testing/btest/opt/opt-skip-files.zeek
Normal file
|
@ -0,0 +1,20 @@
|
|||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM --no-optimize-files=opt-skip-files %INPUT >output
|
||||
# @TEST-EXEC-FAIL: zeek -b -O ZAM --no-optimize-files=opt-skip-files --optimize-files=opt-skip-files %INPUT
|
||||
# @TEST-EXEC: btest-diff output
|
||||
|
||||
# The first run tests that we can selectively exclude this file.
|
||||
#
|
||||
# The second run tests that skipping overrides including. This should
|
||||
# result in an error because there are no functions to compile.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
print "I shouldn't be ZAM code!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
my_test();
|
||||
print my_test;
|
||||
}
|
19
testing/btest/opt/opt-skip-funcs.zeek
Normal file
19
testing/btest/opt/opt-skip-funcs.zeek
Normal file
|
@ -0,0 +1,19 @@
|
|||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM --no-optimize-func=my_test %INPUT >out1
|
||||
# @TEST-EXEC: zeek -b -O ZAM --no-optimize-func=my_test --optimize-func=my_test %INPUT --optimize-func=zeek_init >out2
|
||||
# @TEST-EXEC: btest-diff out1
|
||||
# @TEST-EXEC: btest-diff out2
|
||||
|
||||
# The first test checks that we can selectively exclude a function.
|
||||
# The second tests that skipping overrides including.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
print "I shouldn't be ZAM code!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
my_test();
|
||||
print my_test;
|
||||
}
|
20
testing/btest/opt/opt-skip-other.zeek
Normal file
20
testing/btest/opt/opt-skip-other.zeek
Normal file
|
@ -0,0 +1,20 @@
|
|||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zeek -b -O ZAM --no-optimize-files=Xopt-skip-other-file %INPUT >out1
|
||||
# @TEST-EXEC: zeek -b -O ZAM --no-optimize-func=my_tes %INPUT >out2
|
||||
# @TEST-EXEC: btest-diff out1
|
||||
# @TEST-EXEC: btest-diff out2
|
||||
|
||||
# The first test checks that if we exclude a different file, we still compile
|
||||
# this one. The second tests that if we exclude a different function (since
|
||||
# function matches have to be full), we still compile this one.
|
||||
|
||||
function my_test()
|
||||
{
|
||||
print "I should be ZAM code!";
|
||||
}
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
my_test();
|
||||
print my_test;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue