mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Merge remote-tracking branch 'origin/topic/vern/bit-shift-fixes'
* origin/topic/vern/bit-shift-fixes: btest portability fix address review comment about shifting corner-case canonicalize filenames for new vector deprecation btest updates for gen-C++ maintenance, including skipping some inappropriate tests fix for profiling "when" statements gen-C++ support for vector bit-shift operations corrected wording in some btest comments make gen-C++ maintenance scripts directly executable ZAM support for bit-shifting don't allow deprecated-style mixing of vectors and scaling for shifting leverage restrictions placed on shifting (RHS is always unsigned) split deprecated vector operations into separate test, with separate ZAM baseline ZAM fix for vector "in" operator ensure that language tests pay attention to .stderr fix vector tests, including checking for errors
This commit is contained in:
commit
3ffffe33bc
115 changed files with 568 additions and 300 deletions
24
CHANGES
24
CHANGES
|
@ -1,3 +1,27 @@
|
|||
5.1.0-dev.326 | 2022-08-03 09:56:37 -0700
|
||||
|
||||
* updates for gen-C++ maintenance, including skipping some inappropriate tests (Vern Paxson, Corelight)
|
||||
|
||||
* fix for profiling "when" statements (Vern Paxson, Corelight)
|
||||
|
||||
* gen-C++ support for vector bit-shift operations (Vern Paxson, Corelight)
|
||||
|
||||
* corrected wording in some btest comments (Vern Paxson, Corelight)
|
||||
|
||||
* make gen-C++ maintenance scripts directly executable (Vern Paxson, Corelight)
|
||||
|
||||
* ZAM support for bit-shifting (Vern Paxson, Corelight)
|
||||
|
||||
* don't allow deprecated-style mixing of vectors and scaling for shifting (Vern Paxson, Corelight)
|
||||
leverage restrictions placed on shifting (RHS is always unsigned)
|
||||
split deprecated vector operations into separate test, with separate ZAM baseline
|
||||
|
||||
* ZAM fix for vector "in" operator (Vern Paxson, Corelight)
|
||||
|
||||
* ensure that language tests pay attention to .stderr (Vern Paxson, Corelight)
|
||||
|
||||
* fix vector tests, including checking for errors (Vern Paxson, Corelight)
|
||||
|
||||
5.1.0-dev.312 | 2022-08-02 12:37:51 -0700
|
||||
|
||||
* Update plugins.hooks baseline with new DHCP options (peter.cullen, Corelight)
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
5.1.0-dev.312
|
||||
5.1.0-dev.326
|
||||
|
|
36
src/Expr.cc
36
src/Expr.cc
|
@ -963,20 +963,15 @@ ValPtr BinaryExpr::Fold(Val* v1, Val* v2) const
|
|||
{
|
||||
if ( is_integral )
|
||||
{
|
||||
if ( i2 < 0 )
|
||||
RuntimeError("left shift by negative value");
|
||||
else if ( i1 < 1 )
|
||||
if ( i1 < 0 )
|
||||
RuntimeError("left shifting a negative number is undefined");
|
||||
|
||||
i3 = i1 << i2;
|
||||
i3 = i1 << static_cast<zeek_uint_t>(i2);
|
||||
}
|
||||
else if ( is_unsigned )
|
||||
{
|
||||
if ( u2 < 0 )
|
||||
RuntimeError("left shift by negative value");
|
||||
|
||||
else if ( is_unsigned )
|
||||
u3 = u1 << u2;
|
||||
}
|
||||
|
||||
else
|
||||
RuntimeErrorWithCallStack("bad type in BinaryExpr::Fold");
|
||||
break;
|
||||
|
@ -984,19 +979,11 @@ ValPtr BinaryExpr::Fold(Val* v1, Val* v2) const
|
|||
case EXPR_RSHIFT:
|
||||
{
|
||||
if ( is_integral )
|
||||
{
|
||||
if ( i2 < 0 )
|
||||
RuntimeError("right shift by negative value");
|
||||
i3 = i1 >> static_cast<zeek_uint_t>(i2);
|
||||
|
||||
i3 = i1 >> i2;
|
||||
}
|
||||
else if ( is_unsigned )
|
||||
{
|
||||
if ( u2 < 0 )
|
||||
RuntimeError("right shift by negative value");
|
||||
|
||||
u3 = u1 >> u2;
|
||||
}
|
||||
|
||||
else
|
||||
RuntimeErrorWithCallStack("bad type in BinaryExpr::Fold");
|
||||
break;
|
||||
|
@ -2202,6 +2189,9 @@ BitExpr::BitExpr(ExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
|||
|
||||
if ( tag == EXPR_LSHIFT || tag == EXPR_RSHIFT )
|
||||
{
|
||||
if ( (is_vector(op1) || is_vector(op2)) && ! (is_vector(op1) && is_vector(op2)) )
|
||||
ExprError("cannot mix vectors and scalars for shift operations");
|
||||
|
||||
if ( IsIntegral(bt1) && bt2 == TYPE_COUNT )
|
||||
{
|
||||
if ( is_vector(op1) || is_vector(op2) )
|
||||
|
@ -2209,13 +2199,19 @@ BitExpr::BitExpr(ExprTag arg_tag, ExprPtr arg_op1, ExprPtr arg_op2)
|
|||
else
|
||||
SetType(base_type(bt1));
|
||||
}
|
||||
|
||||
else if ( IsIntegral(bt1) && bt2 == TYPE_INT )
|
||||
ExprError("requires \"count\" right operand");
|
||||
|
||||
else
|
||||
ExprError("requires integral operands");
|
||||
|
||||
return; // because following scalar check isn't apt
|
||||
}
|
||||
|
||||
else if ( (bt1 == TYPE_COUNT) && (bt2 == TYPE_COUNT) )
|
||||
CheckScalarAggOp();
|
||||
|
||||
if ( (bt1 == TYPE_COUNT) && (bt2 == TYPE_COUNT) )
|
||||
{
|
||||
if ( is_vector(op1) || is_vector(op2) )
|
||||
SetType(make_intrusive<VectorType>(base_type(TYPE_COUNT)));
|
||||
|
|
|
@ -2185,6 +2185,12 @@ TraversalCode WhenStmt::Traverse(TraversalCallback* cb) const
|
|||
}
|
||||
}
|
||||
|
||||
if ( wi->TimeoutExpr() )
|
||||
{
|
||||
tc = wi->TimeoutExpr()->Traverse(cb);
|
||||
HANDLE_TC_STMT_PRE(tc);
|
||||
}
|
||||
|
||||
tc = cb->PostStmt(this);
|
||||
HANDLE_TC_STMT_POST(tc);
|
||||
}
|
||||
|
|
|
@ -1593,10 +1593,8 @@ public:
|
|||
ValPtr ValAt(unsigned int index) const { return At(index); }
|
||||
|
||||
bool Has(unsigned int index) const
|
||||
// Version to use once std::optional implementation is merged.
|
||||
// { return index < vector_val->size() && vector_val[index]; }
|
||||
{
|
||||
return At(index) != nullptr;
|
||||
return index < vector_val->size() && (*vector_val)[index];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -170,6 +170,8 @@ VEC_OP2(or, |, )
|
|||
VEC_OP2(xor, ^, )
|
||||
VEC_OP2(andand, &&, )
|
||||
VEC_OP2(oror, ||, )
|
||||
VEC_OP2(lshift, <<, )
|
||||
VEC_OP2(rshift, >>, )
|
||||
|
||||
// A version of VEC_OP2 that instead supports relational operations, so
|
||||
// the result type is always vector-of-bool.
|
||||
|
|
|
@ -45,6 +45,8 @@ extern VectorValPtr vec_op_or__CPP(const VectorValPtr& v1, const VectorValPtr& v
|
|||
extern VectorValPtr vec_op_xor__CPP(const VectorValPtr& v1, const VectorValPtr& v2);
|
||||
extern VectorValPtr vec_op_andand__CPP(const VectorValPtr& v1, const VectorValPtr& v2);
|
||||
extern VectorValPtr vec_op_oror__CPP(const VectorValPtr& v1, const VectorValPtr& v2);
|
||||
extern VectorValPtr vec_op_lshift__CPP(const VectorValPtr& v1, const VectorValPtr& v2);
|
||||
extern VectorValPtr vec_op_rshift__CPP(const VectorValPtr& v1, const VectorValPtr& v2);
|
||||
|
||||
// Vector relational operations.
|
||||
extern VectorValPtr vec_op_lt__CPP(const VectorValPtr& v1, const VectorValPtr& v2);
|
||||
|
|
|
@ -495,7 +495,7 @@ void CPPCompile::GenForOverTable(const ExprPtr& tbl, const IDPtr& value_var,
|
|||
StartBlock();
|
||||
|
||||
Emit("auto k__CPP = lve__CPP.GetHashKey();");
|
||||
Emit("auto* current_tev__CPP = lve__CPP.GetValue<TableEntryVal*>();");
|
||||
Emit("auto* current_tev__CPP = lve__CPP.value;");
|
||||
Emit("auto ind_lv__CPP = tv__CPP->RecreateIndex(*k__CPP);");
|
||||
|
||||
if ( value_var )
|
||||
|
|
|
@ -15,7 +15,7 @@ The maintenance workflow:
|
|||
to check in updates to the list of how the compiler currently fares
|
||||
on various btests (see end of this doc):
|
||||
|
||||
Thu May 12 12:54:10 PDT 2022
|
||||
Mon Aug 1 16:39:05 PDT 2022
|
||||
|
||||
2. Run "find-test-files.sh" to generate a list (to stdout) of all of the
|
||||
possible Zeek source files found in the test suite.
|
||||
|
@ -57,17 +57,27 @@ These BTests won't successfully run due to the indicated issue:
|
|||
command-line-error - a deliberate command-line error
|
||||
complex-to-debug - hard-to-figure-out failure
|
||||
deprecated - uses features deprecated for -O C++
|
||||
error-handling - behavior in face of an error differs
|
||||
needs-plugin - requires knowing how to build an associated plugin
|
||||
no-script - there's no actual script to compile
|
||||
ZAM - meant specifically for -O ZAM
|
||||
|
||||
Consider migrating these to have @TEST-REQUIRES clauses so we don't have
|
||||
to maintain this list.
|
||||
|
||||
../testing/btest/core/negative-time.test no-script
|
||||
../testing/btest/core/pcap/dumper.zeek no-script
|
||||
../testing/btest/core/pcap/input-error.zeek command-line-error
|
||||
../testing/btest/core/proc-status-file.zeek no-script
|
||||
../testing/btest/core/scalar-vector.zeek deprecated
|
||||
../testing/btest/language/at-if-event.zeek @if
|
||||
../testing/btest/language/at-if.zeek @if
|
||||
../testing/btest/language/at-ifdef.zeek @if
|
||||
../testing/btest/language/at-ifndef.zeek @if
|
||||
../testing/btest/language/incr-vec-expr.test deprecated
|
||||
../testing/btest/language/uninitialized-local2.zeek error-handling
|
||||
../testing/btest/language/vector-deprecated.zeek deprecated
|
||||
../testing/btest/language/vector-in-operator.zeek
|
||||
../testing/btest/language/vector-in-operator.zeek deprecated
|
||||
../testing/btest/language/when-aggregates.zeek bad-when
|
||||
../testing/btest/opt/opt-files.zeek ZAM
|
||||
|
@ -76,6 +86,7 @@ These BTests won't successfully run due to the indicated issue:
|
|||
../testing/btest/opt/opt-func.zeek ZAM
|
||||
../testing/btest/opt/opt-func2.zeek ZAM
|
||||
../testing/btest/opt/opt-func3.zeek ZAM
|
||||
../testing/btest/plugins/packet-protocol.zeek needs-plugin
|
||||
../testing/btest/scripts/base/protocols/dhcp/dhcp-ack-msg-types.zeek no-script
|
||||
../testing/btest/scripts/base/protocols/dhcp/dhcp-all-msg-types.zeek no-script
|
||||
../testing/btest/scripts/base/protocols/dhcp/dhcp-discover-msg-types.zeek no-script
|
||||
|
|
17
src/script_opt/CPP/maint/check-CPP-gen.sh
Normal file → Executable file
17
src/script_opt/CPP/maint/check-CPP-gen.sh
Normal file → Executable file
|
@ -1,8 +1,19 @@
|
|||
#! /bin/sh
|
||||
|
||||
out=out.$(echo $1 | sed 's,\.\./,,;s,/,#,g')
|
||||
abbr=$(echo $1 | sed 's,\.\./,,;s,/,#,g')
|
||||
out=CPP-test/out.$abbr
|
||||
gen_out=CPP-test/gen.$abbr
|
||||
|
||||
(
|
||||
/bin/echo -n $1" "
|
||||
(src/zeek -O gen-C++ --optimize-files=testing/btest --optimize-func="<global-stmts>" $1 >&/dev/null && echo "success") || echo "fail"
|
||||
) >CPP-test/$out 2>&1
|
||||
if ! src/zeek -O gen-C++ --optimize-files=testing/btest $1 >&$gen_out 2>&1; then
|
||||
echo "fail"
|
||||
exit 1
|
||||
fi
|
||||
if grep -E -q 'deprecated|skipping|cannot compile|no matching functions' $gen_out; then
|
||||
echo "fail"
|
||||
exit 1
|
||||
fi
|
||||
echo "success"
|
||||
exit 0
|
||||
) >$out 2>&1
|
||||
|
|
0
src/script_opt/CPP/maint/check-zeek.sh
Normal file → Executable file
0
src/script_opt/CPP/maint/check-zeek.sh
Normal file → Executable file
13
src/script_opt/CPP/maint/do-CPP-btest.sh
Normal file → Executable file
13
src/script_opt/CPP/maint/do-CPP-btest.sh
Normal file → Executable file
|
@ -1,11 +1,22 @@
|
|||
#! /bin/sh
|
||||
|
||||
rm -f CPP-gen.cc
|
||||
|
||||
cp zeek.HOLD src/zeek || (
|
||||
echo Need to create clean zeek.HOLD
|
||||
exit 1
|
||||
) || exit 1
|
||||
|
||||
if [ "$1" == "-U" ]; then
|
||||
btest_opt=-U
|
||||
shift
|
||||
elif [ "$1" == "-d" ]; then
|
||||
btest_opt=-d
|
||||
shift
|
||||
else
|
||||
btest_opt=-d
|
||||
fi
|
||||
|
||||
base=$(echo $1 | sed 's,\.\./,,;s,/,#,g')
|
||||
rel_test=$(echo $1 | sed 's,.*testing/btest/,,')
|
||||
|
||||
|
@ -26,5 +37,5 @@ ninja
|
|||
|
||||
(
|
||||
cd ../testing/btest
|
||||
../../auxil/btest/btest -a cpp -d -f ../../build/CPP-test/diag.$base $rel_test
|
||||
../../auxil/btest/btest -a cpp $btest_opt -f ../../build/CPP-test/diag.$base $rel_test
|
||||
)
|
||||
|
|
0
src/script_opt/CPP/maint/find-test-files.sh
Normal file → Executable file
0
src/script_opt/CPP/maint/find-test-files.sh
Normal file → Executable file
|
@ -543,6 +543,19 @@ op-type U
|
|||
vector
|
||||
eval $1 ^ $2
|
||||
|
||||
binary-expr-op Lshift
|
||||
op-type I U
|
||||
vector
|
||||
eval-type I if ( $1 < 0 )
|
||||
ZAM_run_time_error(z.loc, "left shifting a negative number is undefined");
|
||||
$$ = $1 << $2;
|
||||
eval $1 << $2
|
||||
|
||||
binary-expr-op Rshift
|
||||
op-type I U
|
||||
vector
|
||||
eval $1 >> $2
|
||||
|
||||
########## Relationals ##########
|
||||
|
||||
rel-expr-op LT
|
||||
|
@ -833,13 +846,13 @@ internal-op Val-Is-In-Vector
|
|||
type VVV
|
||||
eval auto& vec = frame[z.v3].vector_val;
|
||||
auto ind = frame[z.v2].int_val;
|
||||
frame[z.v1].int_val = ind >= 0 && static_cast<zeek_uint_t>(ind) < vec->Size();
|
||||
frame[z.v1].int_val = vec->Has(ind);
|
||||
|
||||
internal-op Const-Is-In-Vector
|
||||
type VCV
|
||||
eval auto& vec = frame[z.v2].vector_val;
|
||||
auto ind = z.c.int_val;
|
||||
frame[z.v1].int_val = ind >= 0 && static_cast<zeek_uint_t>(ind) < vec->Size();
|
||||
frame[z.v1].int_val = vec->Has(ind);
|
||||
|
||||
expr-op Cond
|
||||
type VVVV
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
|
||||
--- Backtrace ---
|
||||
#0: zeek_init()
|
||||
|
||||
--- Backtrace ---
|
||||
|
||||
| #0: zeek_init() |
|
||||
|
||||
--- Backtrace ---
|
||||
#0: zeek_init()
|
||||
|
|
7
testing/btest/Baseline.cpp/bifs.disable_analyzer/out
Normal file
7
testing/btest/Baseline.cpp/bifs.disable_analyzer/out
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.
|
||||
proto confirm, AllAnalyzers::ANALYZER_ANALYZER_HTTP
|
||||
http_request, GET, /style/enhanced.css
|
||||
T
|
||||
total http messages, {
|
||||
[[orig_h=192.168.1.104, orig_p=1673/tcp, resp_h=63.245.209.11, resp_p=80/tcp]] = 1
|
||||
}
|
|
@ -5,16 +5,16 @@ type aliases for 'MyRec val': MyRec MyRecAlias
|
|||
type aliases for 'MyRecAlias val': MyRec MyRecAlias
|
||||
type aliases for 'MyRec type': MyRec MyRecAlias
|
||||
type aliases for 'MyRecalias type': MyRec MyRecAlias
|
||||
type aliases for 'MyString val': MyString AnotherString
|
||||
type aliases for 'MyString val': it's just a 'string'
|
||||
type aliases for 'MyString type': MyString AnotherString
|
||||
type aliases for 'MyOtherString type': MyOtherString
|
||||
type aliases for 'AnotherString type': MyString AnotherString
|
||||
type aliases for 'string literal value': MyString AnotherString
|
||||
type aliases for 'string literal value': it's just a 'string'
|
||||
type aliases for 'count literal value': it's just a 'count'
|
||||
type aliases for 'MyTable value': MyTable2 MyTable3 MyTable MyTable4
|
||||
type aliases for 'MyTable2 value': MyTable2 MyTable3 MyTable MyTable4
|
||||
type aliases for 'MyTable3 value': MyTable2 MyTable3 MyTable MyTable4
|
||||
type aliases for 'MyTable4 value': MyTable2 MyTable3 MyTable MyTable4
|
||||
type aliases for 'MyTable value': it's just a 'table[count] of string'
|
||||
type aliases for 'MyTable2 value': it's just a 'table[count] of string'
|
||||
type aliases for 'MyTable3 value': it's just a 'table[count] of string'
|
||||
type aliases for 'MyTable4 value': it's just a 'table[count] of string'
|
||||
type aliases for 'MyTable type': MyTable2 MyTable3 MyTable MyTable4
|
||||
type aliases for 'MyTable2 type': MyTable2 MyTable3 MyTable MyTable4
|
||||
type aliases for 'MyTable3 type': MyTable2 MyTable3 MyTable MyTable4
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
error in <...>/main.zeek, lines 498-499: Failed to attach master store backend_failure: (Option::set_change_handler(Broker::metrics_export_prefixes, to_any_coerceBroker::update_metrics_export_prefixes, (coerce 0 to int)))
|
||||
error in <...>/main.zeek, lines 498-499: Could not create Broker master store '../fail' (Option::set_change_handler(Broker::metrics_export_prefixes, to_any_coerceBroker::update_metrics_export_prefixes, (coerce 0 to int)))
|
||||
error in <no location>: invalid Broker store handle (broker::store::{})
|
||||
error in <no location>: invalid Broker store handle (broker::store::{})
|
||||
error in <no location>: invalid Broker store handle (broker::store::{})
|
||||
error in <no location>: invalid Broker store handle (broker::store::{})
|
||||
error in <no location>: invalid Broker store handle (broker::store::{})
|
||||
error in <no location>: invalid Broker store handle (broker::store::{})
|
||||
error in <no location>: invalid Broker store handle (broker::store::{})
|
||||
received termination signal
|
|
@ -0,0 +1,21 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
T
|
||||
F
|
||||
F
|
||||
F
|
||||
m1 keys result: [status=Broker::FAILURE, result=[data=<uninitialized>]]
|
||||
m2 keys result: [status=Broker::SUCCESS, result=[data=broker::data{{}}]]
|
||||
c2 keys result: [status=Broker::SUCCESS, result=[data=broker::data{{}}]]
|
||||
T
|
||||
F
|
||||
F
|
||||
F
|
||||
T
|
||||
T
|
||||
T
|
||||
T
|
||||
m1 keys result: [status=Broker::FAILURE, result=[data=<uninitialized>]]
|
||||
c1 keys result: [status=Broker::FAILURE, result=[data=<uninitialized>]]
|
||||
m2 keys result: [status=Broker::FAILURE, result=[data=<uninitialized>]]
|
||||
c2 keys result: [status=Broker::FAILURE, result=[data=<uninitialized>]]
|
||||
c1 timeout
|
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
|
@ -1,7 +1,7 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
reporter_info|init test-info||XXXXXXXXXX.XXXXXX
|
||||
reporter_warning|init test-warning||XXXXXXXXXX.XXXXXX
|
||||
reporter_error|init test-error||XXXXXXXXXX.XXXXXX
|
||||
reporter_info|init test-info|<...>/main.zeek, lines 498-499|XXXXXXXXXX.XXXXXX
|
||||
reporter_warning|init test-warning|<...>/main.zeek, lines 498-499|XXXXXXXXXX.XXXXXX
|
||||
reporter_error|init test-error|<...>/main.zeek, lines 498-499|XXXXXXXXXX.XXXXXX
|
||||
reporter_info|done test-info||XXXXXXXXXX.XXXXXX
|
||||
reporter_warning|done test-warning||XXXXXXXXXX.XXXXXX
|
||||
reporter_error|done test-error||XXXXXXXXXX.XXXXXX
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
pre test-info
|
||||
warning: pre test-warning
|
||||
error: pre test-error
|
||||
init test-info
|
||||
warning: init test-warning
|
||||
error: init test-error
|
||||
<...>/main.zeek, lines 498-499: init test-info
|
||||
warning in <...>/main.zeek, lines 498-499: init test-warning
|
||||
error in <...>/main.zeek, lines 498-499: init test-error
|
||||
done test-info
|
||||
warning: done test-warning
|
||||
error: done test-error
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
### NOTE: This file has been sorted with diff-sort.
|
||||
[f(F)]
|
||||
[f(T)]
|
||||
[zeek_init()]
|
||||
f() done, no exception, T
|
||||
g() done, no exception, T
|
||||
received termination signal
|
||||
runtime error in compiled code: field value missing
|
||||
runtime error in compiled code: field value missing
|
||||
runtime error in compiled code: field value missing
|
||||
runtime error in compiled code: field value missing
|
||||
timeout
|
||||
timeout g(), F
|
||||
timeout g(), T
|
|
@ -9,5 +9,5 @@ orig=/^?(.*PATTERN.*)$?/ (pattern) clone=/^?(.*PATTERN.*)$?/ (pattern) same_obje
|
|||
orig=2,5,3,4,1 (set[count]) clone=2,5,3,4,1 (set[count]) equal=T same_object=F (ok)
|
||||
orig=[1, 2, 3, 4, 5] (vector of count) clone=[1, 2, 3, 4, 5] (vector of count) equal=T same_object=F (ok)
|
||||
orig=a=va;b=vb (table[string] of string) clone=a=va;b=vb (table[string] of string) equal=T same_object=F (ok)
|
||||
orig=ENUMME (enum MyEnum) clone=ENUMME (enum MyEnum) equal=T same_object=F (FAIL1)
|
||||
orig=[s1=s1, s2=s2, i1=[a=a], i2=[a=a], donotset=<uninitialized>, def=5] (record { s1:string; s2:string; i1:record { a:string; }; i2:record { a:string; } &optional; donotset:record { a:string; } &optional; def:count &default=5, &optional; }) clone=[s1=s1, s2=s2, i1=[a=a], i2=[a=a], donotset=<uninitialized>, def=5] (record { s1:string; s2:string; i1:record { a:string; }; i2:record { a:string; } &optional; donotset:record { a:string; } &optional; def:count &default=5, &optional; }) equal=T same_object=F (ok)
|
||||
orig=ENUMME (MyEnum) clone=ENUMME (MyEnum) equal=T same_object=F (FAIL1)
|
||||
orig=[s1=s1, s2=s2, i1=[a=a], i2=[a=a], donotset=<uninitialized>, def=5] (TestRecord) clone=[s1=s1, s2=s2, i1=[a=a], i2=[a=a], donotset=<uninitialized>, def=5] (TestRecord) equal=T same_object=F (ok)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
runtime error in compiled code: vector index assignment failed for invalid type 'myrec', value: [a=T, b=hi, c=<uninitialized>]
|
||||
runtime error in compiled code: vector index assignment failed for invalid type 'myrec', value: [a=T, b=hi, c=<uninitialized>]
|
||||
runtime error in compiled code: vector index assignment failed for invalid type 'myrec', value: [a=T, b=hi, c=<uninitialized>]
|
||||
runtime error in compiled code: vector index assignment failed for invalid type 'myrec', value: [a=T, b=hi, c=<uninitialized>]
|
||||
runtime error in compiled code: vector index assignment failed for invalid type 'myrec', value: [a=T, b=hi, c=<uninitialized>]
|
||||
runtime error in <...>/queue.zeek, line 152: vector index assignment failed for invalid type 'myrec', value: [a=T, b=hi, c=<uninitialized>], expression: Queue::ret[Queue::j], call stack:
|
||||
#0 Queue::get_vector([initialized=T, vals={[2] = test,[3] = [a=T, b=hi, c=<uninitialized>],[5] = 3,[0] = hello,[6] = jkl;,[4] = asdf,[1] = goodbye}, settings=[max_len=<uninitialized>], top=7, bottom=0, size=0], [hello, goodbye, test]) at <...>/main.zeek:498
|
||||
#1 zeek_init()
|
||||
|
||||
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
| Hook Some Info
|
||||
| Hook error An Error
|
||||
| Hook error An Error that does not show up in the log
|
||||
Reporter::Hook - Exercise Reporter Hook (dynamic, version 1.0.0)
|
||||
Implements Reporter (priority 0)
|
||||
|
||||
| Hook Some Info <...>/main.zeek, lines 498-499
|
||||
| Hook error An Error <...>/main.zeek, lines 498-499
|
||||
| Hook error An Error that does not show up in the log <...>/main.zeek, lines 498-499
|
||||
| Hook runtime error in compiled code field value missing
|
||||
| Hook warning A warning
|
||||
Some Info
|
||||
error: An Error
|
||||
error: An Error that does not show up in the log
|
||||
| Hook warning A warning <...>/main.zeek, lines 498-499
|
||||
<...>/main.zeek, lines 498-499: Some Info
|
||||
error in <...>/main.zeek, lines 498-499: An Error
|
||||
error in <...>/main.zeek, lines 498-499: An Error that does not show up in the log
|
||||
runtime error in compiled code: field value missing
|
||||
warning: A warning
|
||||
warning in <...>/main.zeek, lines 498-499: A warning
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
#open XXXX-XX-XX-XX-XX-XX
|
||||
#fields ts level message location
|
||||
#types time enum string string
|
||||
XXXXXXXXXX.XXXXXX Reporter::INFO Some Info (empty)
|
||||
XXXXXXXXXX.XXXXXX Reporter::WARNING A warning (empty)
|
||||
XXXXXXXXXX.XXXXXX Reporter::ERROR An Error (empty)
|
||||
XXXXXXXXXX.XXXXXX Reporter::INFO Some Info <...>/main.zeek, lines 498-499
|
||||
XXXXXXXXXX.XXXXXX Reporter::WARNING A warning <...>/main.zeek, lines 498-499
|
||||
XXXXXXXXXX.XXXXXX Reporter::ERROR An Error <...>/main.zeek, lines 498-499
|
||||
XXXXXXXXXX.XXXXXX Reporter::ERROR field value missing (empty)
|
||||
#close XXXX-XX-XX-XX-XX-XX
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
all, AllAnalyzers::ANALYZER_ANALYZER_DNS
|
||||
analyzer, Analyzer::ANALYZER_DNS
|
||||
all, AllAnalyzers::PACKETANALYZER_ANALYZER_UDP
|
||||
packet analyzer, PacketAnalyzer::ANALYZER_UDP
|
||||
all, AllAnalyzers::FILES_ANALYZER_X509
|
||||
file analyzer, Files::ANALYZER_X509
|
|
@ -1,2 +1,3 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
error: file ID asdf not a known file
|
||||
warning: non-void function returning without a value: Files::lookup_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.
|
||||
warning in /Users/vern/warehouse/zeek/zeek-master.29Jul22/testing/btest/.tmp/language.vector-deprecated/vector-deprecated.zeek, line 18: mixing vector and scalar operands is deprecated (vector) (string)
|
||||
warning in /Users/vern/warehouse/zeek/zeek-master.29Jul22/testing/btest/.tmp/language.vector-deprecated/vector-deprecated.zeek, line 21: mixing vector and scalar operands is deprecated (string) (vector)
|
||||
warning in /Users/vern/warehouse/zeek/zeek-master.29Jul22/testing/btest/.tmp/language.vector-deprecated/vector-deprecated.zeek, line 24: mixing vector and scalar operands is deprecated (string) (vector)
|
||||
error: deprecated mixed vector/scalar operation not supported for ZAM compiling
|
||||
error: deprecated mixed vector/scalar operation not supported for ZAM compiling
|
||||
error: deprecated mixed vector/scalar operation not supported for ZAM compiling
|
|
@ -0,0 +1,4 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
+ operator [string] (PASS)
|
||||
== operator [string] (PASS)
|
||||
== operator [string] (PASS)
|
|
@ -1,10 +1,10 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
1 <...>/coverage-blacklist.zeek, line 13 print cover me;
|
||||
1 <...>/coverage-blacklist.zeek, line 15 if (T) { print always executed; }
|
||||
1 <...>/coverage-blacklist.zeek, line 17 print always executed;
|
||||
1 <...>/coverage-blacklist.zeek, line 22 if (0 + 0 == 1) print impossible;
|
||||
1 <...>/coverage-blacklist.zeek, line 24 if (1 == 0) { print also impossible, but included in code coverage analysis; }
|
||||
0 <...>/coverage-blacklist.zeek, line 26 print also impossible, but included in code coverage analysis;
|
||||
1 <...>/coverage-blacklist.zeek, line 29 print success;
|
||||
1 <...>/coverage-blacklist.zeek, line 5 print first;
|
||||
1 <...>/coverage-blacklist.zeek, line 7 if (F) { print hello; print world; }
|
||||
1 <...>/coverage-blacklist.zeek, line 10 if (F) { print hello; print world; }
|
||||
1 <...>/coverage-blacklist.zeek, line 16 print cover me;
|
||||
1 <...>/coverage-blacklist.zeek, line 18 if (T) { print always executed; }
|
||||
1 <...>/coverage-blacklist.zeek, line 20 print always executed;
|
||||
1 <...>/coverage-blacklist.zeek, line 25 if (0 + 0 == 1) print impossible;
|
||||
1 <...>/coverage-blacklist.zeek, line 27 if (1 == 0) { print also impossible, but included in code coverage analysis; }
|
||||
0 <...>/coverage-blacklist.zeek, line 29 print also impossible, but included in code coverage analysis;
|
||||
1 <...>/coverage-blacklist.zeek, line 32 print success;
|
||||
1 <...>/coverage-blacklist.zeek, line 8 print first;
|
||||
|
|
1
testing/btest/Baseline/language.addr/.stderr
Normal file
1
testing/btest/Baseline/language.addr/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.any/.stderr
Normal file
1
testing/btest/Baseline/language.any/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.at-if-event/.stderr
Normal file
1
testing/btest/Baseline/language.at-if-event/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.at-if/.stderr
Normal file
1
testing/btest/Baseline/language.at-if/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.at-ifdef/.stderr
Normal file
1
testing/btest/Baseline/language.at-ifdef/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.at-ifndef/.stderr
Normal file
1
testing/btest/Baseline/language.at-ifndef/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.at-load/.stderr
Normal file
1
testing/btest/Baseline/language.at-load/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.bool/.stderr
Normal file
1
testing/btest/Baseline/language.bool/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
|
@ -1,2 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
expression error in <...>/common-mistakes2.zeek, line 16: type-checking failed in vector append (v += ok)
|
||||
expression error in <...>/common-mistakes2.zeek, line 17: type-checking failed in vector append (v += ok)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.copy/.stderr
Normal file
1
testing/btest/Baseline/language.copy/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.count/.stderr
Normal file
1
testing/btest/Baseline/language.count/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.double/.stderr
Normal file
1
testing/btest/Baseline/language.double/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.enum/.stderr
Normal file
1
testing/btest/Baseline/language.enum/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.for/.stderr
Normal file
1
testing/btest/Baseline/language.for/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.function/.stderr
Normal file
1
testing/btest/Baseline/language.function/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.if/.stderr
Normal file
1
testing/btest/Baseline/language.if/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.int/.stderr
Normal file
1
testing/btest/Baseline/language.int/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.interval/.stderr
Normal file
1
testing/btest/Baseline/language.interval/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.module/.stderr
Normal file
1
testing/btest/Baseline/language.module/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.no-module/.stderr
Normal file
1
testing/btest/Baseline/language.no-module/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.pattern/.stderr
Normal file
1
testing/btest/Baseline/language.pattern/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.port/.stderr
Normal file
1
testing/btest/Baseline/language.port/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.precedence/.stderr
Normal file
1
testing/btest/Baseline/language.precedence/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.set/.stderr
Normal file
1
testing/btest/Baseline/language.set/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.short-circuit/.stderr
Normal file
1
testing/btest/Baseline/language.short-circuit/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.string/.stderr
Normal file
1
testing/btest/Baseline/language.string/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.subnet/.stderr
Normal file
1
testing/btest/Baseline/language.subnet/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.table/.stderr
Normal file
1
testing/btest/Baseline/language.table/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
1
testing/btest/Baseline/language.time/.stderr
Normal file
1
testing/btest/Baseline/language.time/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
|
@ -1,2 +1,2 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
warning: please_warn assignment unused: please_warn = test; <...>/unused-assignment.zeek, line 7
|
||||
warning: please_warn assignment unused: please_warn = test; <...>/unused-assignment.zeek, line 10
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
||||
warning in <...>/vector-deprecated.zeek, line 18: mixing vector and scalar operands is deprecated (vector) (string)
|
||||
warning in <...>/vector-deprecated.zeek, line 21: mixing vector and scalar operands is deprecated (string) (vector)
|
||||
warning in <...>/vector-deprecated.zeek, line 24: mixing vector and scalar operands is deprecated (string) (vector)
|
4
testing/btest/Baseline/language.vector-deprecated/out
Normal file
4
testing/btest/Baseline/language.vector-deprecated/out
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.
|
||||
+ operator [string] (PASS)
|
||||
== operator [string] (PASS)
|
||||
== operator [string] (PASS)
|
1
testing/btest/Baseline/language.vector/.stderr
Normal file
1
testing/btest/Baseline/language.vector/.stderr
Normal file
|
@ -0,0 +1 @@
|
|||
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
|
|
@ -60,9 +60,6 @@ access element (PASS)
|
|||
/ operator (PASS)
|
||||
% operator (PASS)
|
||||
+ operator [string] (PASS)
|
||||
+ operator [string] (PASS)
|
||||
== operator [string] (PASS)
|
||||
== operator [string] (PASS)
|
||||
== operator [string] (PASS)
|
||||
&& operator (PASS)
|
||||
|| operator (PASS)
|
||||
|
@ -81,3 +78,5 @@ copy of a vector with holes (PASS)
|
|||
copy of a vector with trailing holes, [0, 2, 3, 77, , ], [0, 2, 3, 77, , ]
|
||||
hole in vector of managed types, 5, [[a=T], [a=T], , , [a=T]]
|
||||
hole in vector of managed types after replacing slice, 3, [[a=T], [a=T], ]
|
||||
left shift (PASS)
|
||||
right shift (PASS)
|
||||
|
|
|
@ -4,7 +4,11 @@
|
|||
|
||||
global cmds = "print \"hello world\";";
|
||||
cmds = string_cat(cmds, "\nprint \"foobar\";");
|
||||
if ( piped_exec("zeek", cmds) != T )
|
||||
|
||||
# If we're using generated C++, turn that off for the pipe execution,
|
||||
# as otherwise we'll get a complaint that there's no corresponding
|
||||
# C++ bodies found for that zeek instance.
|
||||
if ( piped_exec("unset ZEEK_USE_CPP; zeek", cmds) != T )
|
||||
exit(1);
|
||||
|
||||
# Test null output.
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
# This tests Zeek's mechanism to prevent duplicate script loading.
|
||||
#
|
||||
# Don't run for C++ scripts, since it doesn't actually do anything and that
|
||||
# leads to complaints that there are no scripts.
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: mkdir -p foo/bar
|
||||
# @TEST-EXEC: echo "@load bar/test" >loader.zeek
|
||||
# @TEST-EXEC: cp %INPUT foo/bar/test.zeek
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
# This verifies Zeek's ability to load scripts from stdin.
|
||||
#
|
||||
# Don't run for C++ scripts because the multiple invocations lead to
|
||||
# some runs having complaints that there are no scripts.
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
#
|
||||
# @TEST-EXEC: echo 'print "stdin";' | zeek -b >output.implicit
|
||||
# @TEST-EXEC: echo 'print "stdin";' | zeek -b - >output.explicit
|
||||
# @TEST-EXEC: echo 'print "stdin";' | zeek -b %INPUT >output.nostdin
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
# greps to validate that we got a syntax error in the output with the string that we passed
|
||||
# as a filter.
|
||||
|
||||
# Don't run for C++ scripts, since first invocation doesn't use the input
|
||||
# and hence leads to complaints that there are no scripts.
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
#
|
||||
# @TEST-EXEC-FAIL: zeek -r $TRACES/workshop_2011_browse.trace -f "kaputt" >output 2>&1
|
||||
# @TEST-EXEC-FAIL: test -e conn.log
|
||||
# @TEST-EXEC: grep "kaputt" output | grep -q "syntax error"
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
# Don't run for C++ scripts, since script invocation of Zeek hashes
|
||||
# the script differently, leading to complaints that there are no scripts.
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
|
||||
# @TEST-EXEC: printf '#!' > test.zeek
|
||||
# @TEST-EXEC: printf "$BUILD/src/zeek -b --\n" >> test.zeek
|
||||
# @TEST-EXEC: cat %INPUT >> test.zeek
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Don't run for C++ scripts, since they aren't compatible with interpreter-level
|
||||
# coverage analysis.
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: ZEEK_PROFILER_FILE=coverage zeek -b %INPUT
|
||||
# @TEST-EXEC: grep %INPUT coverage | sort -k2 >output
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff output
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# Don't run for C++ scripts, they're not compatible.
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
|
||||
# Shouldn't emit any warnings about not being able to document something
|
||||
# that's supplied via command line script.
|
||||
|
||||
|
|
|
@ -1,20 +1,33 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
|
||||
}
|
||||
|
||||
# IPv4 addresses
|
||||
global a1: addr = 0.0.0.0;
|
||||
global a2: addr = 10.0.0.11;
|
||||
global a3: addr = 255.255.255.255;
|
||||
global a4 = 192.1.2.3;
|
||||
|
||||
# IPv6 addresses
|
||||
global b1: addr = [::];
|
||||
global b2: addr = [::255.255.255.255];
|
||||
global b3: addr = [::ffff:ffff];
|
||||
global b4: addr = [ffff::ffff];
|
||||
global b5: addr = [0000:0000:0000:0000:0000:0000:0000:0000];
|
||||
global b6: addr = [aaaa:bbbb:cccc:dddd:eeee:ffff:1111:2222];
|
||||
global b7: addr = [AAAA:BBBB:CCCC:DDDD:EEEE:FFFF:1111:2222];
|
||||
global b9 = [2001:db8:0:0:0:FFFF:192.168.0.5];
|
||||
|
||||
# IPv4-mapped-IPv6 (internally treated as IPv4)
|
||||
global c1: addr = [::ffff:1.2.3.4];
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
# IPv4 addresses
|
||||
local a1: addr = 0.0.0.0;
|
||||
local a2: addr = 10.0.0.11;
|
||||
local a3: addr = 255.255.255.255;
|
||||
local a4 = 192.1.2.3;
|
||||
|
||||
test_case( "IPv4 address inequality", a1 != a2 );
|
||||
test_case( "IPv4 address equality", a1 == 0.0.0.0 );
|
||||
test_case( "IPv4 address comparison", a1 < a2 );
|
||||
|
@ -22,16 +35,7 @@ event zeek_init()
|
|||
test_case( "size of IPv4 address", |a1| == 32 );
|
||||
test_case( "IPv4 address type inference", type_name(a4) == "addr" );
|
||||
|
||||
# IPv6 addresses
|
||||
local b1: addr = [::];
|
||||
local b2: addr = [::255.255.255.255];
|
||||
local b3: addr = [::ffff:ffff];
|
||||
local b4: addr = [ffff::ffff];
|
||||
local b5: addr = [0000:0000:0000:0000:0000:0000:0000:0000];
|
||||
local b6: addr = [aaaa:bbbb:cccc:dddd:eeee:ffff:1111:2222];
|
||||
local b7: addr = [AAAA:BBBB:CCCC:DDDD:EEEE:FFFF:1111:2222];
|
||||
local b8 = [a::b];
|
||||
local b9 = [2001:db8:0:0:0:FFFF:192.168.0.5];
|
||||
|
||||
test_case( "IPv6 address inequality", b1 != b2 );
|
||||
test_case( "IPv6 address equality", b1 == b5 );
|
||||
|
@ -44,9 +48,6 @@ event zeek_init()
|
|||
|
||||
test_case( "IPv4 and IPv6 address inequality", a1 != b1 );
|
||||
|
||||
# IPv4-mapped-IPv6 (internally treated as IPv4)
|
||||
local c1: addr = [::ffff:1.2.3.4];
|
||||
|
||||
test_case( "IPv4-mapped-IPv6 equality to IPv4", c1 == 1.2.3.4 );
|
||||
test_case( "IPv4-mapped-IPv6 is IPv4", is_v4_addr(c1) == T );
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
@ -11,12 +12,12 @@ function anyarg(arg1: any, arg1type: string)
|
|||
test_case( arg1type, type_name(arg1) == arg1type );
|
||||
}
|
||||
|
||||
global any1: any = 5;
|
||||
global any2: any = "bar";
|
||||
global any3: any = /bar/;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local any1: any = 5;
|
||||
local any2: any = "bar";
|
||||
local any3: any = /bar/;
|
||||
|
||||
# Test using variable of type "any"
|
||||
|
||||
anyarg( any1, "count" );
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
# Check if @if can be used to alternative function/event definitions
|
||||
|
||||
@if ( 1==1 )
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
@ -10,11 +11,10 @@ function foo(c: count): bool
|
|||
{ return c == 42 ? T : F; }
|
||||
|
||||
global TRUE_CONDITION = T;
|
||||
global xyz = 0;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local xyz = 0;
|
||||
|
||||
# Test "if" without "else"
|
||||
|
||||
@if ( F )
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
@ -7,11 +8,10 @@ function test_case(msg: string, expect: bool)
|
|||
}
|
||||
|
||||
global thisisdefined = 123;
|
||||
global xyz = 0;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local xyz = 0;
|
||||
|
||||
# Test "ifdef" without "else"
|
||||
|
||||
@ifdef ( notdefined )
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
@ -7,11 +8,10 @@ function test_case(msg: string, expect: bool)
|
|||
}
|
||||
|
||||
global thisisdefined = 123;
|
||||
global xyz = 0;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local xyz = 0;
|
||||
|
||||
# Test "ifndef" without "else"
|
||||
|
||||
@ifndef ( notdefined )
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
# In this script, we try to access each object defined in a "@load"ed script
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
|
||||
}
|
||||
|
||||
global b1: bool = T;
|
||||
global b2: bool = F;
|
||||
global b3: bool = T;
|
||||
global b4 = T;
|
||||
global b5 = F;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local b1: bool = T;
|
||||
local b2: bool = F;
|
||||
local b3: bool = T;
|
||||
local b4 = T;
|
||||
local b5 = F;
|
||||
|
||||
test_case( "equality operator", b1 == b3 );
|
||||
test_case( "inequality operator", b1 != b2 );
|
||||
test_case( "logical or operator", b1 || b2 );
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# A companion to language/common-mistakes.zeek. Split off because we skip
|
||||
# this test when using ZAM, since it employs a type-checking violation via
|
||||
# vector-of-any, which doesn't seem worth going out of our way to support
|
||||
# in ZAM (and it isn't dead simple to do so).
|
||||
# this test when using script optimization, since it employs a type-checking
|
||||
# violation via vector-of-any, which doesn't seem worth going out of our way
|
||||
# to support for script optimization.
|
||||
|
||||
# @TEST-REQUIRES: test "${ZEEK_ZAM}" != "1"
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
|
||||
# @TEST-EXEC: zeek -b %INPUT >out 2>err
|
||||
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
@ -25,13 +26,17 @@ function f2(): bool
|
|||
# value is constant.
|
||||
global false = F;
|
||||
|
||||
global a: count;
|
||||
global b: count;
|
||||
global res: count;
|
||||
global res2: bool;
|
||||
|
||||
global s: set[string] = { "one", "two", "three" };
|
||||
global t: table[count] of string = { [1] = "one", [2] = "two", [3] = "three" };
|
||||
global v: vector of string = { "one", "two", "three" };
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local a: count;
|
||||
local b: count;
|
||||
local res: count;
|
||||
local res2: bool;
|
||||
|
||||
# Test that the correct operand is evaluated
|
||||
|
||||
a = b = 0;
|
||||
|
@ -67,21 +72,18 @@ event zeek_init()
|
|||
test_case( "associativity", ct == 2 );
|
||||
|
||||
# Test for unspecified set coercion
|
||||
local s: set[string] = { "one", "two", "three" };
|
||||
local sT = T ? set() : s;
|
||||
local sF = F ? s : set();
|
||||
print |sT|, type_name(sT);
|
||||
print |sF|, type_name(sF);
|
||||
|
||||
# Test for unspecified table coercion
|
||||
local t: table[count] of string = { [1] = "one", [2] = "two", [3] = "three" };
|
||||
local tT = T ? table() : t;
|
||||
local tF = F ? t : table();
|
||||
print |tT|, type_name(tT);
|
||||
print |tF|, type_name(tF);
|
||||
|
||||
# Test for unspecified vector coercion
|
||||
local v: vector of string = { "one", "two", "three" };
|
||||
local vT = T ? vector() : v;
|
||||
local vF = F ? v : vector();
|
||||
print |vT|, type_name(vT);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
|
||||
}
|
||||
|
||||
global c1: count = 0;
|
||||
global c2: count = 5;
|
||||
global c3: count = 0xFF;
|
||||
global c4: count = 255;
|
||||
global c5: count = 18446744073709551615; # maximum allowed value
|
||||
global c6: count = 0xffffffffffffffff; # maximum allowed value
|
||||
global c7 = 1;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local c1: count = 0;
|
||||
local c2: count = 5;
|
||||
local c3: count = 0xFF;
|
||||
local c4: count = 255;
|
||||
local c5: count = 18446744073709551615; # maximum allowed value
|
||||
local c6: count = 0xffffffffffffffff; # maximum allowed value
|
||||
local c7 = 1;
|
||||
|
||||
# Type inference test
|
||||
|
||||
test_case( "type inference", type_name(c7) == "count" );
|
||||
|
||||
|
||||
# Test various constant representations
|
||||
|
||||
test_case( "hexadecimal", c3 == c4 );
|
||||
|
@ -60,6 +58,5 @@ event zeek_init()
|
|||
test_case( str1, str1 == "max count value = 18446744073709551615" );
|
||||
local str2 = fmt("max count value = %d", c6);
|
||||
test_case( str2, str2 == "max count value = 18446744073709551615" );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
|
||||
}
|
||||
|
||||
global d1: double = 3;
|
||||
global d2: double = +3;
|
||||
global d3: double = 3.;
|
||||
global d4: double = 3.0;
|
||||
global d5: double = +3.0;
|
||||
global d6: double = 3e0;
|
||||
global d7: double = 3E0;
|
||||
global d8: double = 3e+0;
|
||||
global d9: double = 3e-0;
|
||||
global d10: double = 3.0e0;
|
||||
global d11: double = +3.0e0;
|
||||
global d12: double = +3.0e+0;
|
||||
global d13: double = +3.0E+0;
|
||||
global d14: double = +3.0E-0;
|
||||
global d15: double = .03E+2;
|
||||
global d16: double = .03E2;
|
||||
global d17: double = 3.0001;
|
||||
global d18: double = -3.0001;
|
||||
global d19: double = 1.7976931348623157e308; # maximum allowed value
|
||||
global d20 = 7.0;
|
||||
global d21 = 7e0;
|
||||
global d22 = 7e+1;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local d1: double = 3;
|
||||
local d2: double = +3;
|
||||
local d3: double = 3.;
|
||||
local d4: double = 3.0;
|
||||
local d5: double = +3.0;
|
||||
local d6: double = 3e0;
|
||||
local d7: double = 3E0;
|
||||
local d8: double = 3e+0;
|
||||
local d9: double = 3e-0;
|
||||
local d10: double = 3.0e0;
|
||||
local d11: double = +3.0e0;
|
||||
local d12: double = +3.0e+0;
|
||||
local d13: double = +3.0E+0;
|
||||
local d14: double = +3.0E-0;
|
||||
local d15: double = .03E+2;
|
||||
local d16: double = .03E2;
|
||||
local d17: double = 3.0001;
|
||||
local d18: double = -3.0001;
|
||||
local d19: double = 1.7976931348623157e308; # maximum allowed value
|
||||
local d20 = 7.0;
|
||||
local d21 = 7e0;
|
||||
local d22 = 7e+1;
|
||||
|
||||
# Type inference tests
|
||||
|
||||
test_case( "type inference", type_name(d20) == "double" );
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
@ -13,20 +14,19 @@ type color: enum { Red, White, Blue, };
|
|||
# enum without optional comma
|
||||
type city: enum { Rome, Paris };
|
||||
|
||||
global e1: color = Blue;
|
||||
global e2: color = White;
|
||||
global e3: color = Blue;
|
||||
global e4: city = Rome;
|
||||
global x = Blue;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local e1: color = Blue;
|
||||
local e2: color = White;
|
||||
local e3: color = Blue;
|
||||
local e4: city = Rome;
|
||||
|
||||
test_case( "enum equality comparison", e1 != e2 );
|
||||
test_case( "enum equality comparison", e1 == e3 );
|
||||
test_case( "enum equality comparison", e1 != e4 );
|
||||
|
||||
# type inference
|
||||
local x = Blue;
|
||||
test_case( "type inference", x == e1 );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
|
|
@ -1,30 +1,30 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
|
||||
}
|
||||
|
||||
global i1: int = 3;
|
||||
global i2: int = +3;
|
||||
global i3: int = -3;
|
||||
global i4: int = +0;
|
||||
global i5: int = -0;
|
||||
global i6: int = 12;
|
||||
global i7: int = +0xc;
|
||||
global i8: int = 0xC;
|
||||
global i9: int = -0xC;
|
||||
global i10: int = -12;
|
||||
global i11: int = 9223372036854775807; # max. allowed value
|
||||
global i12: int = -9223372036854775808; # min. allowed value
|
||||
global i13: int = 0x7fffffffffffffff; # max. allowed value
|
||||
global i14: int = -0x8000000000000000; # min. allowed value
|
||||
global i15 = +3;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local i1: int = 3;
|
||||
local i2: int = +3;
|
||||
local i3: int = -3;
|
||||
local i4: int = +0;
|
||||
local i5: int = -0;
|
||||
local i6: int = 12;
|
||||
local i7: int = +0xc;
|
||||
local i8: int = 0xC;
|
||||
local i9: int = -0xC;
|
||||
local i10: int = -12;
|
||||
local i11: int = 9223372036854775807; # max. allowed value
|
||||
local i12: int = -9223372036854775808; # min. allowed value
|
||||
local i13: int = 0x7fffffffffffffff; # max. allowed value
|
||||
local i14: int = -0x8000000000000000; # min. allowed value
|
||||
local i15 = +3;
|
||||
|
||||
# Type inference test
|
||||
|
||||
test_case( "type inference", type_name(i15) == "int" );
|
||||
|
@ -67,5 +67,4 @@ event zeek_init()
|
|||
test_case( str3, str3 == "max int value = 9223372036854775807" );
|
||||
local str4 = fmt("min int value = %d", i14);
|
||||
test_case( str4, str4 == "min int value = -9223372036854775808" );
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
@ -12,41 +13,39 @@ function approx_equal(x: double, y: double): bool
|
|||
return |(x - y)/x| < 1e-6 ? T : F;
|
||||
}
|
||||
|
||||
# Constants without space and no letter "s"
|
||||
global in11: interval = 2usec;
|
||||
global in12: interval = 2msec;
|
||||
global in13: interval = 120sec;
|
||||
global in14: interval = 2min;
|
||||
global in15: interval = -2hr;
|
||||
global in16: interval = 2.5day;
|
||||
|
||||
# Constants with space and no letter "s"
|
||||
global in21: interval = 2 usec;
|
||||
global in22: interval = 2 msec;
|
||||
global in23: interval = 120 sec;
|
||||
global in24: interval = 2 min;
|
||||
global in25: interval = -2 hr;
|
||||
global in26: interval = 2.5 day;
|
||||
|
||||
# Constants with space and letter "s"
|
||||
|
||||
global in31: interval = 2 usecs;
|
||||
global in32: interval = 2 msecs;
|
||||
global in33: interval = 1.2e2 secs;
|
||||
global in34: interval = 2 mins;
|
||||
global in35: interval = -2 hrs;
|
||||
global in36: interval = 2.5 days;
|
||||
|
||||
# Type inference
|
||||
|
||||
global in41 = 2 usec;
|
||||
global in42 = 2.1usec;
|
||||
global in43 = 3usecs;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
# Constants without space and no letter "s"
|
||||
|
||||
local in11: interval = 2usec;
|
||||
local in12: interval = 2msec;
|
||||
local in13: interval = 120sec;
|
||||
local in14: interval = 2min;
|
||||
local in15: interval = -2hr;
|
||||
local in16: interval = 2.5day;
|
||||
|
||||
# Constants with space and no letter "s"
|
||||
|
||||
local in21: interval = 2 usec;
|
||||
local in22: interval = 2 msec;
|
||||
local in23: interval = 120 sec;
|
||||
local in24: interval = 2 min;
|
||||
local in25: interval = -2 hr;
|
||||
local in26: interval = 2.5 day;
|
||||
|
||||
# Constants with space and letter "s"
|
||||
|
||||
local in31: interval = 2 usecs;
|
||||
local in32: interval = 2 msecs;
|
||||
local in33: interval = 1.2e2 secs;
|
||||
local in34: interval = 2 mins;
|
||||
local in35: interval = -2 hrs;
|
||||
local in36: interval = 2.5 days;
|
||||
|
||||
# Type inference
|
||||
|
||||
local in41 = 2 usec;
|
||||
local in42 = 2.1usec;
|
||||
local in43 = 3usecs;
|
||||
|
||||
# Type inference tests
|
||||
|
||||
test_case( "type inference", type_name(in41) == "interval" );
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT secondtestfile >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
# In this source file, we define a module and export some objects
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT secondtestfile >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
# This is the same test as "module.zeek", but here we omit the module definition
|
||||
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
|
||||
}
|
||||
|
||||
global p1: pattern = /foo|bar/;
|
||||
global p2: pattern = /oob/;
|
||||
global p3: pattern = /^oob/;
|
||||
global p4 = /foo/;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local p1: pattern = /foo|bar/;
|
||||
local p2: pattern = /oob/;
|
||||
local p3: pattern = /^oob/;
|
||||
local p4 = /foo/;
|
||||
|
||||
# Type inference tests
|
||||
|
||||
test_case( "type inference", type_name(p4) == "pattern" );
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
print fmt("%s (%s)", msg, expect ? "PASS" : "FAIL");
|
||||
}
|
||||
|
||||
global p1: port = 1/icmp;
|
||||
global p2: port = 2/udp;
|
||||
global p3: port = 3/tcp;
|
||||
global p4: port = 4/unknown;
|
||||
global p5 = 123/tcp;
|
||||
|
||||
# maximum allowed values for each port type
|
||||
global p6: port = 255/icmp;
|
||||
global p7: port = 65535/udp;
|
||||
global p8: port = 65535/tcp;
|
||||
global p9: port = 255/unknown;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local p1: port = 1/icmp;
|
||||
local p2: port = 2/udp;
|
||||
local p3: port = 3/tcp;
|
||||
local p4: port = 4/unknown;
|
||||
local p5 = 123/tcp;
|
||||
|
||||
# maximum allowed values for each port type
|
||||
local p6: port = 255/icmp;
|
||||
local p7: port = 65535/udp;
|
||||
local p8: port = 65535/tcp;
|
||||
local p9: port = 255/unknown;
|
||||
|
||||
# Type inference test
|
||||
|
||||
test_case( "type inference", type_name(p5) == "port" );
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
@ -9,12 +10,16 @@ function test_case(msg: string, expect: bool)
|
|||
# This is an incomplete set of tests to demonstrate the order of precedence
|
||||
# of zeek script operators
|
||||
|
||||
global n1: int;
|
||||
global n2: int;
|
||||
global n3: int;
|
||||
|
||||
global r1: bool;
|
||||
global r2: bool;
|
||||
global r3: bool;
|
||||
|
||||
event zeek_init()
|
||||
{
|
||||
local n1: int;
|
||||
local n2: int;
|
||||
local n3: int;
|
||||
|
||||
# Tests that show "++" has higher precedence than "*"
|
||||
|
||||
n1 = n2 = 5;
|
||||
|
@ -70,10 +75,6 @@ event zeek_init()
|
|||
test_case( "+= and +", n2 == 3 );
|
||||
test_case( "+= and +", n3 == 1 );
|
||||
|
||||
local r1: bool;
|
||||
local r2: bool;
|
||||
local r3: bool;
|
||||
|
||||
# Tests that show "&&" has higher precedence than "||"
|
||||
|
||||
r1 = F && F || T;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# @TEST-EXEC: zeek -b %INPUT >out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC: btest-diff .stderr
|
||||
|
||||
function test_case(msg: string, expect: bool)
|
||||
{
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue