mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
BTests & baselines for testing selective skipping of script optimization
This commit is contained in:
parent
acedb1cb9a
commit
15964daad0
30 changed files with 284 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/output
Normal file
6
testing/btest/Baseline/opt.opt-skip-funcs/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-funcs2/output
Normal file
6
testing/btest/Baseline/opt.opt-skip-funcs2/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!;
|
||||||
|
}
|
4
testing/btest/Baseline/opt.opt-skip-other-file/output
Normal file
4
testing/btest/Baseline/opt.opt-skip-other-file/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: function() : void
|
||||||
|
ZAM-code my_test
|
4
testing/btest/Baseline/opt.opt-skip-other-func/output
Normal file
4
testing/btest/Baseline/opt.opt-skip-other-func/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: 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-opt-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-opt-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-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
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
# Tests that we can selectively pick this file.
|
# Tests that we can selectively pick this file.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
# @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
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
# Tests that we can selectively pick a group of files but not this one.
|
# 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-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
|
# @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()
|
function my_test()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
# @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
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
# Tests that we can selectively pick a given function.
|
# Tests that we can selectively pick a given function.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
# @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
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
# Tests that we can selectively pick a bunch of functions (event handlers),
|
# Tests that we can selectively pick a bunch of functions (event handlers),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
# @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
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
# Tests that we can selectively pick a bunch of functions (event handlers),
|
# 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
|
# @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
|
# 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
|
# @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
|
# 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
|
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff .stderr
|
||||||
|
|
||||||
# Make sure that --optimize-func anchors the regex.
|
# Make sure that --optimize-func anchors the regex.
|
||||||
|
|
16
testing/btest/opt/opt-skip-files.zeek
Normal file
16
testing/btest/opt/opt-skip-files.zeek
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||||
|
# @TEST-EXEC: zeek -b -O ZAM --no-opt-files=opt-skip-files %INPUT >output
|
||||||
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
|
# Tests that we can selectively exclude this file.
|
||||||
|
|
||||||
|
function my_test()
|
||||||
|
{
|
||||||
|
print "I shouldn't be ZAM code!";
|
||||||
|
}
|
||||||
|
|
||||||
|
event zeek_init()
|
||||||
|
{
|
||||||
|
my_test();
|
||||||
|
print my_test;
|
||||||
|
}
|
16
testing/btest/opt/opt-skip-files2.zeek
Normal file
16
testing/btest/opt/opt-skip-files2.zeek
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||||
|
# @TEST-EXEC-FAIL: zeek -b -O ZAM --no-opt-files=opt-skip-files --optimize-files=opt-skip-files %INPUT >output
|
||||||
|
|
||||||
|
# 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;
|
||||||
|
}
|
16
testing/btest/opt/opt-skip-funcs.zeek
Normal file
16
testing/btest/opt/opt-skip-funcs.zeek
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||||
|
# @TEST-EXEC: zeek -b -O ZAM --no-opt-func=my_test %INPUT >output
|
||||||
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
|
# Tests that we can selectively exclude a function.
|
||||||
|
|
||||||
|
function my_test()
|
||||||
|
{
|
||||||
|
print "I shouldn't be ZAM code!";
|
||||||
|
}
|
||||||
|
|
||||||
|
event zeek_init()
|
||||||
|
{
|
||||||
|
my_test();
|
||||||
|
print my_test;
|
||||||
|
}
|
16
testing/btest/opt/opt-skip-funcs2.zeek
Normal file
16
testing/btest/opt/opt-skip-funcs2.zeek
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||||
|
# @TEST-EXEC: zeek -b -O ZAM --no-opt-func=my_test --optimize-func=my_test %INPUT --optimize-func=zeek_init >output
|
||||||
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
|
# Tests that skipping overrides including.
|
||||||
|
|
||||||
|
function my_test()
|
||||||
|
{
|
||||||
|
print "I shouldn't be ZAM code!";
|
||||||
|
}
|
||||||
|
|
||||||
|
event zeek_init()
|
||||||
|
{
|
||||||
|
my_test();
|
||||||
|
print my_test;
|
||||||
|
}
|
16
testing/btest/opt/opt-skip-other-file.zeek
Normal file
16
testing/btest/opt/opt-skip-other-file.zeek
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||||
|
# @TEST-EXEC: zeek -b -O ZAM --no-opt-files=Xopt-skip-other-file %INPUT >output
|
||||||
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
|
# Tests that if we exclude a different file, we still compile this one.
|
||||||
|
|
||||||
|
function my_test()
|
||||||
|
{
|
||||||
|
print "I should be ZAM code!";
|
||||||
|
}
|
||||||
|
|
||||||
|
event zeek_init()
|
||||||
|
{
|
||||||
|
my_test();
|
||||||
|
print my_test;
|
||||||
|
}
|
17
testing/btest/opt/opt-skip-other-func.zeek
Normal file
17
testing/btest/opt/opt-skip-other-func.zeek
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||||
|
# @TEST-EXEC: zeek -b -O ZAM --no-opt-func=my_tes %INPUT >output
|
||||||
|
# @TEST-EXEC: btest-diff output
|
||||||
|
|
||||||
|
# Tests that if we exclude a different function (given 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