Merge remote-tracking branch 'origin/topic/vern/cpp-new-func'

- Removed a couple of dead statements during merge

* origin/topic/vern/cpp-new-func:
  option for deterministic descriptions of sets & tables
  determinism for concurrent Zeek test suite invocations; split out deprecations
  disambiguate descriptions of enums; include attributes when describing records
  more liberal view of attribute equality; allow suppressing attr type-checking
  support for operations on sets that return new values
  low-level addition of enum values
  sundry accessors/cast-ers; RE_Matcher's track their construction values
  convenience functions for comparing IP addresses
This commit is contained in:
Jon Siwek 2021-03-23 19:05:10 -07:00
commit f46d3dec8f
38 changed files with 371 additions and 102 deletions

18
CHANGES
View file

@ -1,4 +1,22 @@
4.1.0-dev.355 | 2021-03-23 19:05:10 -0700
* add option for deterministic descriptions of sets & tables (Vern Paxson, Corelight)
* determinism for concurrent Zeek test suite invocations; split out deprecations (Vern Paxson, Corelight)
* disambiguate descriptions of enum types; include attributes when describing record types (Vern Paxson, Corelight)
* more liberal view of attribute equality; allow suppressing attr type-checking (Vern Paxson, Corelight)
* support for operations on sets that return new values (Vern Paxson, Corelight)
* add low-level method for adding new enum values (Vern Paxson, Corelight)
* sundry accessors/cast-ers; RE_Matcher's track their construction values (Vern Paxson, Corelight)
* add convenience functions for comparing IP addresses (Vern Paxson, Corelight)
4.1.0-dev.346 | 2021-03-23 17:25:02 -0700 4.1.0-dev.346 | 2021-03-23 17:25:02 -0700
* Add new ``./configure --plugindir`` option (Vlad Grigorescu) * Add new ``./configure --plugindir`` option (Vlad Grigorescu)

View file

@ -1 +1 @@
4.1.0-dev.346 4.1.0-dev.355

View file

@ -208,7 +208,10 @@ void Attributes::AddAttr(AttrPtr attr, bool is_redef)
attrs.emplace_back(attr); attrs.emplace_back(attr);
// We only check the attribute after we've added it, to facilitate // We only check the attribute after we've added it, to facilitate
// generating error messages via Attributes::Describe. // generating error messages via Attributes::Describe. If the
// instantiator of the object specified a null type, however, then
// that's a signal to skip the checking.
if ( type )
CheckAttr(attr.get()); CheckAttr(attr.get());
// For ADD_FUNC or DEL_FUNC, add in an implicit REDEF, since // For ADD_FUNC or DEL_FUNC, add in an implicit REDEF, since

View file

@ -86,10 +86,11 @@ public:
return false; return false;
if ( expr || other.expr ) if ( expr || other.expr )
// If any has an expression and they aren't the same object, we // Too hard to check for equivalency, since one
// declare them unequal, as we can't really find out if the two // might be expressed/compiled differently than
// expressions are equivalent. // the other, so assume they're compatible, as
return (expr == other.expr); // long as both are present.
return expr && other.expr;
return true; return true;
} }

View file

@ -40,6 +40,7 @@ ODesc::ODesc(DescType t, File* arg_f)
indent_level = 0; indent_level = 0;
is_short = false; is_short = false;
want_quotes = false; want_quotes = false;
want_determinism = false;
do_flush = true; do_flush = true;
include_stats = false; include_stats = false;
indent_with_spaces = 0; indent_with_spaces = 0;

View file

@ -47,6 +47,11 @@ public:
bool WantQuotes() const { return want_quotes; } bool WantQuotes() const { return want_quotes; }
void SetQuotes(bool q) { want_quotes = q; } void SetQuotes(bool q) { want_quotes = q; }
// Whether to ensure deterministic output (for example, when
// describing TableVal's).
bool WantDeterminism() const { return want_determinism; }
void SetDeterminism(bool d) { want_determinism = d; }
// Whether we want to print statistics like access time and execution // Whether we want to print statistics like access time and execution
// count where available. // count where available.
bool IncludeStats() const { return include_stats; } bool IncludeStats() const { return include_stats; }
@ -194,6 +199,7 @@ protected:
bool escape; // escape unprintable characters in output? bool escape; // escape unprintable characters in output?
bool is_short; bool is_short;
bool want_quotes; bool want_quotes;
bool want_determinism;
int indent_with_spaces; int indent_with_spaces;

View file

@ -96,6 +96,7 @@ class IndexAssignExpr;
class IndexExpr; class IndexExpr;
class IsExpr; class IsExpr;
class InlineExpr; class InlineExpr;
class LambdaExpr;
class ListExpr; class ListExpr;
class NameExpr; class NameExpr;
class RefExpr; class RefExpr;
@ -216,6 +217,7 @@ public:
ZEEK_EXPR_ACCESSOR_DECLS(IndexExpr) ZEEK_EXPR_ACCESSOR_DECLS(IndexExpr)
ZEEK_EXPR_ACCESSOR_DECLS(IsExpr) ZEEK_EXPR_ACCESSOR_DECLS(IsExpr)
ZEEK_EXPR_ACCESSOR_DECLS(InlineExpr) ZEEK_EXPR_ACCESSOR_DECLS(InlineExpr)
ZEEK_EXPR_ACCESSOR_DECLS(LambdaExpr)
ZEEK_EXPR_ACCESSOR_DECLS(ListExpr) ZEEK_EXPR_ACCESSOR_DECLS(ListExpr)
ZEEK_EXPR_ACCESSOR_DECLS(NameExpr) ZEEK_EXPR_ACCESSOR_DECLS(NameExpr)
ZEEK_EXPR_ACCESSOR_DECLS(RefExpr) ZEEK_EXPR_ACCESSOR_DECLS(RefExpr)
@ -1304,7 +1306,9 @@ public:
LambdaExpr(std::unique_ptr<function_ingredients> ingredients, LambdaExpr(std::unique_ptr<function_ingredients> ingredients,
IDPList outer_ids); IDPList outer_ids);
const std::string& Name() const { return my_name; }
const IDPList& OuterIDs() const { return outer_ids; } const IDPList& OuterIDs() const { return outer_ids; }
const function_ingredients& Ingredients() const { return *ingredients; }
ValPtr Eval(Frame* f) const override; ValPtr Eval(Frame* f) const override;
TraversalCode Traverse(TraversalCallback* cb) const override; TraversalCode Traverse(TraversalCallback* cb) const override;
@ -1427,7 +1431,7 @@ class IsExpr final : public UnaryExpr {
public: public:
IsExpr(ExprPtr op, TypePtr t); IsExpr(ExprPtr op, TypePtr t);
TypePtr TestType() const { return t; } const TypePtr& TestType() const { return t; }
// Optimization-related: // Optimization-related:
ExprPtr Duplicate() override; ExprPtr Duplicate() override;

View file

@ -39,7 +39,11 @@ struct ConnIDKey {
} }
bool operator<(const ConnIDKey& rhs) const { return memcmp(this, &rhs, sizeof(ConnIDKey)) < 0; } bool operator<(const ConnIDKey& rhs) const { return memcmp(this, &rhs, sizeof(ConnIDKey)) < 0; }
bool operator<=(const ConnIDKey& rhs) const { return memcmp(this, &rhs, sizeof(ConnIDKey)) <= 0; }
bool operator==(const ConnIDKey& rhs) const { return memcmp(this, &rhs, sizeof(ConnIDKey)) == 0; } bool operator==(const ConnIDKey& rhs) const { return memcmp(this, &rhs, sizeof(ConnIDKey)) == 0; }
bool operator!=(const ConnIDKey& rhs) const { return memcmp(this, &rhs, sizeof(ConnIDKey)) != 0; }
bool operator>=(const ConnIDKey& rhs) const { return memcmp(this, &rhs, sizeof(ConnIDKey)) >= 0; }
bool operator>(const ConnIDKey& rhs) const { return memcmp(this, &rhs, sizeof(ConnIDKey)) > 0; }
ConnIDKey& operator=(const ConnIDKey& rhs) ConnIDKey& operator=(const ConnIDKey& rhs)
{ {

View file

@ -479,7 +479,7 @@ RE_Matcher::RE_Matcher()
re_exact = new detail::Specific_RE_Matcher(detail::MATCH_EXACTLY); re_exact = new detail::Specific_RE_Matcher(detail::MATCH_EXACTLY);
} }
RE_Matcher::RE_Matcher(const char* pat) RE_Matcher::RE_Matcher(const char* pat) : orig_text(pat)
{ {
re_anywhere = new detail::Specific_RE_Matcher(detail::MATCH_ANYWHERE); re_anywhere = new detail::Specific_RE_Matcher(detail::MATCH_ANYWHERE);
re_exact = new detail::Specific_RE_Matcher(detail::MATCH_EXACTLY); re_exact = new detail::Specific_RE_Matcher(detail::MATCH_EXACTLY);
@ -511,6 +511,8 @@ void RE_Matcher::MakeCaseInsensitive()
{ {
re_anywhere->MakeCaseInsensitive(); re_anywhere->MakeCaseInsensitive();
re_exact->MakeCaseInsensitive(); re_exact->MakeCaseInsensitive();
is_case_insensitive = true;
} }
bool RE_Matcher::Compile(bool lazy) bool RE_Matcher::Compile(bool lazy)

View file

@ -197,6 +197,7 @@ public:
// Makes the matcher as specified to date case-insensitive. // Makes the matcher as specified to date case-insensitive.
void MakeCaseInsensitive(); void MakeCaseInsensitive();
bool IsCaseInsensitive() const { return is_case_insensitive; }
bool Compile(bool lazy = false); bool Compile(bool lazy = false);
@ -227,6 +228,10 @@ public:
const char* PatternText() const { return re_exact->PatternText(); } const char* PatternText() const { return re_exact->PatternText(); }
const char* AnywherePatternText() const { return re_anywhere->PatternText(); } const char* AnywherePatternText() const { return re_anywhere->PatternText(); }
// Original text used to construct this matcher. Empty unless
// the main ("explicit") constructor was used.
const char* OrigText() const { return orig_text.c_str(); }
unsigned int MemoryAllocation() const unsigned int MemoryAllocation() const
{ {
return padded_sizeof(*this) return padded_sizeof(*this)
@ -235,8 +240,12 @@ public:
} }
protected: protected:
std::string orig_text;
detail::Specific_RE_Matcher* re_anywhere; detail::Specific_RE_Matcher* re_anywhere;
detail::Specific_RE_Matcher* re_exact; detail::Specific_RE_Matcher* re_exact;
bool is_case_insensitive = false;
}; };
} // namespace zeek } // namespace zeek

View file

@ -147,6 +147,18 @@ FuncType* Type::AsFuncType()
return (FuncType*) this; return (FuncType*) this;
} }
const FileType* Type::AsFileType() const
{
CHECK_TYPE_TAG(TYPE_FILE, "Type::AsFileType");
return (const FileType*) this;
}
FileType* Type::AsFileType()
{
CHECK_TYPE_TAG(TYPE_FILE, "Type::AsFileType");
return (FileType*) this;
}
const EnumType* Type::AsEnumType() const const EnumType* Type::AsEnumType() const
{ {
CHECK_TYPE_TAG(TYPE_ENUM, "Type::AsEnumType"); CHECK_TYPE_TAG(TYPE_ENUM, "Type::AsEnumType");
@ -1052,6 +1064,12 @@ void RecordType::DescribeFields(ODesc* d) const
else else
td->type->Describe(d); td->type->Describe(d);
if ( td->attrs )
{
d->SP();
td->attrs->Describe(d);
}
d->Add(";"); d->Add(";");
} }
} }
@ -1355,6 +1373,14 @@ void EnumType::AddNameInternal(const string& module_name, const char* name,
names[fullname] = val; names[fullname] = val;
} }
void EnumType::AddNameInternal(const string& full_name, bro_int_t val)
{
names[full_name] = val;
if ( vals.find(val) == vals.end() )
vals[val] = make_intrusive<EnumVal>(IntrusivePtr{NewRef{}, this}, val);
}
bro_int_t EnumType::Lookup(const string& module_name, const char* name) const bro_int_t EnumType::Lookup(const string& module_name, const char* name) const
{ {
NameMap::const_iterator pos = NameMap::const_iterator pos =
@ -1399,6 +1425,27 @@ const EnumValPtr& EnumType::GetEnumVal(bro_int_t i)
return it->second; return it->second;
} }
void EnumType::Describe(ODesc* d) const
{
auto t = Tag();
if ( d->IsBinary() )
{
d->Add(int(t));
if ( ! d->IsShort() )
d->Add(GetName());
}
else
{
d->Add(type_name(t));
if ( ! d->IsShort() )
{
d->SP();
d->Add(GetName());
}
}
}
void EnumType::DescribeReST(ODesc* d, bool roles_only) const void EnumType::DescribeReST(ODesc* d, bool roles_only) const
{ {
d->Add(":zeek:type:`enum`"); d->Add(":zeek:type:`enum`");

View file

@ -219,6 +219,9 @@ public:
const FuncType* AsFuncType() const; const FuncType* AsFuncType() const;
FuncType* AsFuncType(); FuncType* AsFuncType();
const FileType* AsFileType() const;
FileType* AsFileType();
const EnumType* AsEnumType() const; const EnumType* AsEnumType() const;
EnumType* AsEnumType(); EnumType* AsEnumType();
@ -595,6 +598,7 @@ public:
// Given an offset, returns the field's name. // Given an offset, returns the field's name.
const char* FieldName(int field) const; const char* FieldName(int field) const;
const type_decl_list* Types() const { return types; }
type_decl_list* Types() { return types; } type_decl_list* Types() { return types; }
// Given an offset, returns the field's TypeDecl. // Given an offset, returns the field's TypeDecl.
@ -704,6 +708,7 @@ public:
// will be fully qualified with their module name. // will be fully qualified with their module name.
enum_name_list Names() const; enum_name_list Names() const;
void Describe(ODesc* d) const override;
void DescribeReST(ODesc* d, bool roles_only = false) const override; void DescribeReST(ODesc* d, bool roles_only = false) const override;
const EnumValPtr& GetEnumVal(bro_int_t i); const EnumValPtr& GetEnumVal(bro_int_t i);
@ -712,6 +717,8 @@ protected:
void AddNameInternal(const std::string& module_name, void AddNameInternal(const std::string& module_name,
const char* name, bro_int_t val, bool is_export); const char* name, bro_int_t val, bool is_export);
void AddNameInternal(const std::string& full_name, bro_int_t val);
void CheckAndAddName(const std::string& module_name, void CheckAndAddName(const std::string& module_name,
const char* name, bro_int_t val, bool is_export, const char* name, bro_int_t val, bool is_export,
detail::Expr* deprecation = nullptr, detail::Expr* deprecation = nullptr,

View file

@ -71,6 +71,8 @@ Val::~Val()
CONVERTER(tag, ctype, name) \ CONVERTER(tag, ctype, name) \
CONST_CONVERTER(tag, ctype, name) CONST_CONVERTER(tag, ctype, name)
CONVERTERS(TYPE_FUNC, FuncVal*, Val::AsFuncVal)
CONVERTERS(TYPE_FILE, FileVal*, Val::AsFileVal)
CONVERTERS(TYPE_PATTERN, PatternVal*, Val::AsPatternVal) CONVERTERS(TYPE_PATTERN, PatternVal*, Val::AsPatternVal)
CONVERTERS(TYPE_PORT, PortVal*, Val::AsPortVal) CONVERTERS(TYPE_PORT, PortVal*, Val::AsPortVal)
CONVERTERS(TYPE_SUBNET, SubNetVal*, Val::AsSubNetVal) CONVERTERS(TYPE_SUBNET, SubNetVal*, Val::AsSubNetVal)
@ -2332,6 +2334,9 @@ void TableVal::Describe(ODesc* d) const
d->PushIndent(); d->PushIndent();
} }
bool determ = d->WantDeterminism();
std::vector<std::string> elem_descs;
auto iter = table_val->begin(); auto iter = table_val->begin();
for ( int i = 0; i < n; ++i ) for ( int i = 0; i < n; ++i )
@ -2345,7 +2350,10 @@ void TableVal::Describe(ODesc* d) const
auto vl = table_hash->RecoverVals(*k); auto vl = table_hash->RecoverVals(*k);
int dim = vl->Length(); int dim = vl->Length();
if ( i > 0 ) ODesc intermediary_d;
ODesc* d_ptr = determ ? &intermediary_d : d;
if ( ! determ && i > 0 )
{ {
if ( ! d->IsBinary() ) if ( ! d->IsBinary() )
d->Add(","); d->Add(",");
@ -2356,42 +2364,65 @@ void TableVal::Describe(ODesc* d) const
if ( d->IsReadable() ) if ( d->IsReadable() )
{ {
if ( dim != 1 || ! table_type->IsSet() ) if ( dim != 1 || ! table_type->IsSet() )
d->Add("["); d_ptr->Add("[");
} }
else else
{ {
d->Add(dim); d_ptr->Add(dim);
d->SP(); d_ptr->SP();
} }
vl->Describe(d); vl->Describe(d_ptr);
if ( table_type->IsSet() ) if ( table_type->IsSet() )
{ // We're a set, not a table. { // We're a set, not a table.
if ( d->IsReadable() ) if ( d->IsReadable() )
if ( dim != 1 ) if ( dim != 1 )
d->AddSP("]"); d_ptr->AddSP("]");
} }
else else
{ {
if ( d->IsReadable() ) if ( d->IsReadable() )
d->AddSP("] ="); d_ptr->AddSP("] =");
if ( v->GetVal() ) if ( v->GetVal() )
v->GetVal()->Describe(d); v->GetVal()->Describe(d_ptr);
} }
if ( d->IsReadable() && ! d->IsShort() && d->IncludeStats() ) if ( d->IsReadable() && ! d->IsShort() && d->IncludeStats() )
{ {
d->Add(" @"); d_ptr->Add(" @");
d->Add(util::detail::fmt_access_time(v->ExpireAccessTime())); d_ptr->Add(util::detail::fmt_access_time(v->ExpireAccessTime()));
} }
if ( determ )
elem_descs.emplace_back(d_ptr->Description());
++iter; ++iter;
} }
if ( iter != table_val->end() ) if ( iter != table_val->end() )
reporter->InternalError("hash table overflow in TableVal::Describe"); reporter->InternalError("hash table overflow in TableVal::Describe");
if ( determ )
{
sort(elem_descs.begin(), elem_descs.end());
bool did_elems = false;
for ( const auto& ed : elem_descs )
{
if ( did_elems )
{
if ( ! d->IsBinary() )
d->Add(",");
d->NL();
}
d->Add(ed);
did_elems = true;
}
}
if ( d->IsPortable() || d->IsReadable() ) if ( d->IsPortable() || d->IsReadable() )
{ {
d->PopIndent(); d->PopIndent();
@ -3499,6 +3530,7 @@ void describe_vals(const std::vector<ValPtr>& vals,
if ( i > offset && d->IsReadable() && d->Style() != RAW_STYLE ) if ( i > offset && d->IsReadable() && d->Style() != RAW_STYLE )
d->Add(", "); d->Add(", ");
if ( vals[i] )
vals[i]->Describe(d); vals[i]->Describe(d);
} }
} }

View file

@ -61,6 +61,8 @@ class PortVal;
class AddrVal; class AddrVal;
class SubNetVal; class SubNetVal;
class IntervalVal; class IntervalVal;
class FuncVal;
class FileVal;
class PatternVal; class PatternVal;
class TableVal; class TableVal;
class RecordVal; class RecordVal;
@ -143,6 +145,12 @@ UNDERLYING_ACCESSOR_DECL(PatternVal, const RE_Matcher*, AsPattern)
UNDERLYING_ACCESSOR_DECL(TableVal, const PDict<TableEntryVal>*, AsTable) UNDERLYING_ACCESSOR_DECL(TableVal, const PDict<TableEntryVal>*, AsTable)
UNDERLYING_ACCESSOR_DECL(TypeVal, zeek::Type*, AsType) UNDERLYING_ACCESSOR_DECL(TypeVal, zeek::Type*, AsType)
FuncVal* AsFuncVal();
const FuncVal* AsFuncVal() const;
FileVal* AsFileVal();
const FileVal* AsFileVal() const;
PatternVal* AsPatternVal(); PatternVal* AsPatternVal();
const PatternVal* AsPatternVal() const; const PatternVal* AsPatternVal() const;
@ -760,6 +768,32 @@ public:
*/ */
TableValPtr Intersection(const TableVal& v) const; TableValPtr Intersection(const TableVal& v) const;
/**
* Returns a new table that is the union of this table and the
* given table. Union is done only on index, so this generally
* makes most sense to use for sets, not tables.
* @param v The union'ing table.
* @return The union of this table and the given one.
*/
TableValPtr Union(TableVal* v) const
{
auto v_clone = cast_intrusive<TableVal>(v->Clone());
AddTo(v_clone.get(), false, false);
return v_clone;
}
/**
* Returns a copy of this table with the given table removed.
* @param v The table to remove.
* @return The subset of this table that doesn't include v.
*/
TableValPtr TakeOut(TableVal* v)
{
auto clone = cast_intrusive<TableVal>(Clone());
v->RemoveFrom(clone.get());
return clone;
}
// Returns true if this set contains the same members as the // Returns true if this set contains the same members as the
// given set. Note that comparisons are done using hash keys, // given set. Note that comparisons are done using hash keys,
// so errors can arise for compound sets such as sets-of-sets. // so errors can arise for compound sets such as sets-of-sets.

View file

@ -85,6 +85,12 @@ const AnyIndexExpr* Expr::AsAnyIndexExpr() const
return (const AnyIndexExpr*) this; return (const AnyIndexExpr*) this;
} }
const LambdaExpr* Expr::AsLambdaExpr() const
{
CHECK_TAG(tag, EXPR_LAMBDA, "ExprVal::AsLambdaExpr", expr_name)
return (const LambdaExpr*) this;
}
ExprPtr Expr::GetOp1() const { return nullptr; } ExprPtr Expr::GetOp1() const { return nullptr; }
ExprPtr Expr::GetOp2() const { return nullptr; } ExprPtr Expr::GetOp2() const { return nullptr; }
ExprPtr Expr::GetOp3() const { return nullptr; } ExprPtr Expr::GetOp3() const { return nullptr; }

View file

@ -7,7 +7,7 @@ bool
time time
interval interval
pattern pattern
enum enum color
port port
addr addr
addr addr

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in ./bad.zeek, line 2 and ./bad.zeek, line 1: alternate function prototype arguments may not have attributes: arg 'a' (event(c:string; b:string; a:string;) and event(a:string; b:string; c:string;)) error in ./bad.zeek, line 2 and ./bad.zeek, line 1: alternate function prototype arguments may not have attributes: arg 'a' (event(c:string; b:string; a:string &default=A, &optional;) and event(a:string; b:string; c:string &default=C, &optional;))

View file

@ -0,0 +1,12 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
reference capture
4, 10
6, 8
7, 7
reference double capture
4
2, 10, 47
4
2, 8, 47
3
1, 7, 47

View file

@ -1,43 +1,42 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
4, 10 shallow copy
6, 8
7, 7
4, 10 4, 10
5, 8 5, 8
6, 7 6, 7
deep copy
4, 10 4, 10
5, 9 5, 9
6, 8 6, 8
mixed copy, case 1
4, 10 4, 10
5, 8 5, 8
6, 7 6, 7
mixed copy, case 2
4, 10 4, 10
5, 9 5, 9
6, 8 6, 8
4 double shallow copy
2, 10, 47
4
2, 8, 47
3
1, 7, 47
4 4
2, 10, 47 2, 10, 47
5 5
3, 8, 47 3, 8, 47
6 6
4, 7, 47 4, 7, 47
double deep copy, case 1
4 4
2, 10, 47 2, 10, 47
5 5
3, 9, 47 3, 9, 47
6 6
4, 8, 47 4, 8, 47
double deep copy, case 2
4 4
2, 10, 91 2, 10, 91
5 5
3, 9, 91 3, 9, 91
6 6
4, 9, 91 4, 9, 91
double deep copy, case 3
4 4
2, 10, 91 2, 10, 91
5 5

View file

@ -0,0 +1,27 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
hello :-)
peer added
receiver got ping: function 2
inside: 1 | outside: 12 | global: 100
77
receiver got ping: function 1
begin: 100 | base_step: 2
begin: 100 | base_step: 2 | step: 76
178
receiver got ping: function 2
inside: 3 | outside: 12 | global: 100
79
receiver got ping: function 1
begin: 100 | base_step: 4
begin: 100 | base_step: 4 | step: 76
180
receiver got ping: function 2
inside: 5 | outside: 12 | global: 100
81
receiver got ping: function 1
begin: 100 | base_step: 6
begin: 100 | base_step: 6 | step: 76
182
receiver got ping: function 2
inside: 7 | outside: 12 | global: 100
83

View file

@ -0,0 +1,32 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
hello :)
peer added
begin: 100 | base_step: 50
sender got pong: function 2
inside: 1 | outside: 12 | global: 10
77
begin: 100 | base_step: 50
sender got pong: function 1
begin: 178 | base_step: 2
begin: 178 | base_step: 2 | step: 76
256
begin: 100 | base_step: 50
sender got pong: function 2
inside: 3 | outside: 12 | global: 10
79
begin: 100 | base_step: 50
sender got pong: function 1
begin: 180 | base_step: 4
begin: 180 | base_step: 4 | step: 76
260
begin: 100 | base_step: 50
sender got pong: function 2
inside: 5 | outside: 12 | global: 10
81
begin: 100 | base_step: 50
sender got pong: function 1
begin: 182 | base_step: 6
begin: 182 | base_step: 6 | step: 76
264
begin: 100 | base_step: 50
peer lost

View file

@ -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=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=[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=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) clone=ENUMME (enum) equal=T same_object=T (ok) orig=ENUMME (enum MyEnum) clone=ENUMME (enum MyEnum) equal=T same_object=T (ok)
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; }; donotset:record { a:string; }; def:count; }) 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; }; donotset:record { a:string; }; def:count; }) equal=T same_object=F (ok) 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)

View file

@ -1,3 +1,3 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
[id=<uninitialized>, inner=<uninitialized>] [id=<uninitialized>, inner=<uninitialized>]
record { id:count; inner:record { create:function(input:<recursion>;) : string; }; } record { id:count &optional; inner:record { create:function(input:<recursion>;) : string; } &optional; }

View file

@ -1,5 +1,5 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
expression error in <...>/type-cast-error-dynamic.zeek, line 11: invalid cast of value with type 'count' to type 'string' (a as string) expression error in <...>/type-cast-error-dynamic.zeek, line 11: invalid cast of value with type 'count' to type 'string' (a as string)
expression error in <...>/type-cast-error-dynamic.zeek, line 11: invalid cast of value with type 'record { a:addr; b:port; }' to type 'string' (a as string) expression error in <...>/type-cast-error-dynamic.zeek, line 11: invalid cast of value with type 'record { a:addr; b:port; }' to type 'string' (a as string)
expression error in <...>/type-cast-error-dynamic.zeek, line 11: invalid cast of value with type 'record { data:opaque of Broker::Data; }' to type 'string' (nil $data field) (a as string) expression error in <...>/type-cast-error-dynamic.zeek, line 11: invalid cast of value with type 'record { data:opaque of Broker::Data &optional; }' to type 'string' (nil $data field) (a as string)
data is string, F data is string, F

View file

@ -1,6 +1,6 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
error in int and ./first_set.zeek, line 46: overflow promoting from unsigned/double to signed arithmetic value (int and 9223372036854775808) error in int and ./first_set.zeek, line 46: overflow promoting from unsigned/double to signed arithmetic value (int and 9223372036854775808)
expression error in ./first_set.zeek, line 46: Failed type conversion ((coerce [$ii=9223372036854775808] to record { ii:int; cc:count; dd:double; })) expression error in ./first_set.zeek, line 46: Failed type conversion ((coerce [$ii=9223372036854775808] to record { ii:int &optional; cc:count &optional; dd:double &optional; }))
3 3
int int
4 4

View file

@ -1,6 +1,6 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
warning in <...>/uninitialized-local3.zeek, line 33: possibly used without definition (x4) warning in <...>/uninitialized-local3.zeek, line 38: possibly used without definition (x4)
expression error in <...>/uninitialized-local3.zeek, line 33: value used but not set (x4) expression error in <...>/uninitialized-local3.zeek, line 38: value used but not set (x4)
x$a (x <...>/uninitialized-local3.zeek, line 20) possibly used without being set x$a (x <...>/uninitialized-local3.zeek, line 20) possibly used without being set
x$e (x <...>/uninitialized-local3.zeek, line 20) possibly used without being set x$e (x <...>/uninitialized-local3.zeek, line 20) possibly used without being set
x$e (x <...>/uninitialized-local3.zeek, line 24) possibly used without being set x$e (x <...>/uninitialized-local3.zeek, line 24) possibly used without being set

View file

@ -1,2 +1,2 @@
### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63. ### BTest baseline data generated by btest-diff. Do not edit. Use "btest -U/-u" to update. Requires BTest >= 0.63.
vector of enum, [Red, Green, Blue] vector of enum color, [Red, Green, Blue]

View file

@ -615,14 +615,14 @@
0.000000 MetaHookPost CallFunction(SumStats::add_observe_plugin_dependency, <frame>, (SumStats::VARIANCE, SumStats::AVERAGE)) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::add_observe_plugin_dependency, <frame>, (SumStats::VARIANCE, SumStats::AVERAGE)) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::AVERAGE, lambda_<3452231521688988155>{ if (!SumStats::rv?$average) SumStats::rv$average = SumStats::valelseSumStats::rv$average += (SumStats::val - SumStats::rv$average) / (coerce SumStats::rv$num to double)})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::AVERAGE, lambda_<3452231521688988155>{ if (!SumStats::rv?$average) SumStats::rv$average = SumStats::valelseSumStats::rv$average += (SumStats::val - SumStats::rv$average) / (coerce SumStats::rv$num to double)})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::HLL_UNIQUE, lambda_<943258244234523627>{ if (!SumStats::rv?$card) { SumStats::rv$card = hll_cardinality_init(SumStats::r$hll_error_margin, SumStats::r$hll_confidence)SumStats::rv$hll_error_margin = SumStats::r$hll_error_marginSumStats::rv$hll_confidence = SumStats::r$hll_confidence}hll_cardinality_add(SumStats::rv$card, SumStats::obs)SumStats::rv$hll_unique = double_to_count(hll_cardinality_estimate(SumStats::rv$card))})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::HLL_UNIQUE, lambda_<943258244234523627>{ if (!SumStats::rv?$card) { SumStats::rv$card = hll_cardinality_init(SumStats::r$hll_error_margin, SumStats::r$hll_confidence)SumStats::rv$hll_error_margin = SumStats::r$hll_error_marginSumStats::rv$hll_confidence = SumStats::r$hll_confidence}hll_cardinality_add(SumStats::rv$card, SumStats::obs)SumStats::rv$hll_unique = double_to_count(hll_cardinality_estimate(SumStats::rv$card))})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::LAST, lambda_<14831357773699754131>{ if (0 < SumStats::r$num_last_elements) { if (!SumStats::rv?$last_elements) SumStats::rv$last_elements = Queue::init((coerce [$max_len=SumStats::r$num_last_elements] to Queue::Settings))Queue::put(SumStats::rv$last_elements, SumStats::obs)}})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::LAST, lambda_<6246854644409869026>{ if (0 < SumStats::r$num_last_elements) { if (!SumStats::rv?$last_elements) SumStats::rv$last_elements = Queue::init((coerce [$max_len=SumStats::r$num_last_elements] to Queue::Settings))Queue::put(SumStats::rv$last_elements, SumStats::obs)}})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::MAX, lambda_<9734000075919044397>{ if (!SumStats::rv?$max) SumStats::rv$max = SumStats::valelseif (SumStats::rv$max < SumStats::val) SumStats::rv$max = SumStats::val})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::MAX, lambda_<9734000075919044397>{ if (!SumStats::rv?$max) SumStats::rv$max = SumStats::valelseif (SumStats::rv$max < SumStats::val) SumStats::rv$max = SumStats::val})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::MIN, lambda_<2451066605226214733>{ if (!SumStats::rv?$min) SumStats::rv$min = SumStats::valelseif (SumStats::val < SumStats::rv$min) SumStats::rv$min = SumStats::val})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::MIN, lambda_<2451066605226214733>{ if (!SumStats::rv?$min) SumStats::rv$min = SumStats::valelseif (SumStats::val < SumStats::rv$min) SumStats::rv$min = SumStats::val})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::SAMPLE, lambda_<11888441397542569241>{ SumStats::sample_add_sample(SumStats::obs, SumStats::rv)})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::SAMPLE, lambda_<11888441397542569241>{ SumStats::sample_add_sample(SumStats::obs, SumStats::rv)})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::STD_DEV, lambda_<5704045257244168718>{ SumStats::calc_std_dev(SumStats::rv)})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::STD_DEV, lambda_<5704045257244168718>{ SumStats::calc_std_dev(SumStats::rv)})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::SUM, lambda_<6958532551242393774>{ SumStats::rv$sum += SumStats::val})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::SUM, lambda_<6958532551242393774>{ SumStats::rv$sum += SumStats::val})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::TOPK, lambda_<2861372781530360365>{ topk_add(SumStats::rv$topk, SumStats::obs)})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::TOPK, lambda_<2861372781530360365>{ topk_add(SumStats::rv$topk, SumStats::obs)})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::UNIQUE, lambda_<10387912117292132662>{ if (!SumStats::rv?$unique_vals) SumStats::rv$unique_vals = (coerce set() to set[SumStats::Observation])if (SumStats::r?$unique_max) SumStats::rv$unique_max = SumStats::r$unique_maxif (!SumStats::r?$unique_max || sizeofSumStats::rv$unique_vals <= SumStats::r$unique_max) add SumStats::rv$unique_vals[SumStats::obs]SumStats::rv$unique = sizeofSumStats::rv$unique_vals})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::UNIQUE, lambda_<14393221830775341876>{ if (!SumStats::rv?$unique_vals) SumStats::rv$unique_vals = (coerce set() to set[SumStats::Observation])if (SumStats::r?$unique_max) SumStats::rv$unique_max = SumStats::r$unique_maxif (!SumStats::r?$unique_max || sizeofSumStats::rv$unique_vals <= SumStats::r$unique_max) add SumStats::rv$unique_vals[SumStats::obs]SumStats::rv$unique = sizeofSumStats::rv$unique_vals})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::VARIANCE, lambda_<6557258612059469785>{ if (1 < SumStats::rv$num) SumStats::rv$var_s += ((SumStats::val - SumStats::rv$prev_avg) * (SumStats::val - SumStats::rv$average))SumStats::calc_variance(SumStats::rv)SumStats::rv$prev_avg = SumStats::rv$average})) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::VARIANCE, lambda_<6557258612059469785>{ if (1 < SumStats::rv$num) SumStats::rv$var_s += ((SumStats::val - SumStats::rv$prev_avg) * (SumStats::val - SumStats::rv$average))SumStats::calc_variance(SumStats::rv)SumStats::rv$prev_avg = SumStats::rv$average})) -> <no result>
0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugins, <frame>, ()) -> <no result> 0.000000 MetaHookPost CallFunction(SumStats::register_observe_plugins, <frame>, ()) -> <no result>
0.000000 MetaHookPost CallFunction(__init_primary_bifs, <null>, ()) -> <no result> 0.000000 MetaHookPost CallFunction(__init_primary_bifs, <null>, ()) -> <no result>
@ -1618,14 +1618,14 @@
0.000000 MetaHookPre CallFunction(SumStats::add_observe_plugin_dependency, <frame>, (SumStats::VARIANCE, SumStats::AVERAGE)) 0.000000 MetaHookPre CallFunction(SumStats::add_observe_plugin_dependency, <frame>, (SumStats::VARIANCE, SumStats::AVERAGE))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::AVERAGE, lambda_<3452231521688988155>{ if (!SumStats::rv?$average) SumStats::rv$average = SumStats::valelseSumStats::rv$average += (SumStats::val - SumStats::rv$average) / (coerce SumStats::rv$num to double)})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::AVERAGE, lambda_<3452231521688988155>{ if (!SumStats::rv?$average) SumStats::rv$average = SumStats::valelseSumStats::rv$average += (SumStats::val - SumStats::rv$average) / (coerce SumStats::rv$num to double)}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::HLL_UNIQUE, lambda_<943258244234523627>{ if (!SumStats::rv?$card) { SumStats::rv$card = hll_cardinality_init(SumStats::r$hll_error_margin, SumStats::r$hll_confidence)SumStats::rv$hll_error_margin = SumStats::r$hll_error_marginSumStats::rv$hll_confidence = SumStats::r$hll_confidence}hll_cardinality_add(SumStats::rv$card, SumStats::obs)SumStats::rv$hll_unique = double_to_count(hll_cardinality_estimate(SumStats::rv$card))})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::HLL_UNIQUE, lambda_<943258244234523627>{ if (!SumStats::rv?$card) { SumStats::rv$card = hll_cardinality_init(SumStats::r$hll_error_margin, SumStats::r$hll_confidence)SumStats::rv$hll_error_margin = SumStats::r$hll_error_marginSumStats::rv$hll_confidence = SumStats::r$hll_confidence}hll_cardinality_add(SumStats::rv$card, SumStats::obs)SumStats::rv$hll_unique = double_to_count(hll_cardinality_estimate(SumStats::rv$card))}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::LAST, lambda_<14831357773699754131>{ if (0 < SumStats::r$num_last_elements) { if (!SumStats::rv?$last_elements) SumStats::rv$last_elements = Queue::init((coerce [$max_len=SumStats::r$num_last_elements] to Queue::Settings))Queue::put(SumStats::rv$last_elements, SumStats::obs)}})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::LAST, lambda_<6246854644409869026>{ if (0 < SumStats::r$num_last_elements) { if (!SumStats::rv?$last_elements) SumStats::rv$last_elements = Queue::init((coerce [$max_len=SumStats::r$num_last_elements] to Queue::Settings))Queue::put(SumStats::rv$last_elements, SumStats::obs)}}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::MAX, lambda_<9734000075919044397>{ if (!SumStats::rv?$max) SumStats::rv$max = SumStats::valelseif (SumStats::rv$max < SumStats::val) SumStats::rv$max = SumStats::val})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::MAX, lambda_<9734000075919044397>{ if (!SumStats::rv?$max) SumStats::rv$max = SumStats::valelseif (SumStats::rv$max < SumStats::val) SumStats::rv$max = SumStats::val}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::MIN, lambda_<2451066605226214733>{ if (!SumStats::rv?$min) SumStats::rv$min = SumStats::valelseif (SumStats::val < SumStats::rv$min) SumStats::rv$min = SumStats::val})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::MIN, lambda_<2451066605226214733>{ if (!SumStats::rv?$min) SumStats::rv$min = SumStats::valelseif (SumStats::val < SumStats::rv$min) SumStats::rv$min = SumStats::val}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::SAMPLE, lambda_<11888441397542569241>{ SumStats::sample_add_sample(SumStats::obs, SumStats::rv)})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::SAMPLE, lambda_<11888441397542569241>{ SumStats::sample_add_sample(SumStats::obs, SumStats::rv)}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::STD_DEV, lambda_<5704045257244168718>{ SumStats::calc_std_dev(SumStats::rv)})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::STD_DEV, lambda_<5704045257244168718>{ SumStats::calc_std_dev(SumStats::rv)}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::SUM, lambda_<6958532551242393774>{ SumStats::rv$sum += SumStats::val})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::SUM, lambda_<6958532551242393774>{ SumStats::rv$sum += SumStats::val}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::TOPK, lambda_<2861372781530360365>{ topk_add(SumStats::rv$topk, SumStats::obs)})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::TOPK, lambda_<2861372781530360365>{ topk_add(SumStats::rv$topk, SumStats::obs)}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::UNIQUE, lambda_<10387912117292132662>{ if (!SumStats::rv?$unique_vals) SumStats::rv$unique_vals = (coerce set() to set[SumStats::Observation])if (SumStats::r?$unique_max) SumStats::rv$unique_max = SumStats::r$unique_maxif (!SumStats::r?$unique_max || sizeofSumStats::rv$unique_vals <= SumStats::r$unique_max) add SumStats::rv$unique_vals[SumStats::obs]SumStats::rv$unique = sizeofSumStats::rv$unique_vals})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::UNIQUE, lambda_<14393221830775341876>{ if (!SumStats::rv?$unique_vals) SumStats::rv$unique_vals = (coerce set() to set[SumStats::Observation])if (SumStats::r?$unique_max) SumStats::rv$unique_max = SumStats::r$unique_maxif (!SumStats::r?$unique_max || sizeofSumStats::rv$unique_vals <= SumStats::r$unique_max) add SumStats::rv$unique_vals[SumStats::obs]SumStats::rv$unique = sizeofSumStats::rv$unique_vals}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::VARIANCE, lambda_<6557258612059469785>{ if (1 < SumStats::rv$num) SumStats::rv$var_s += ((SumStats::val - SumStats::rv$prev_avg) * (SumStats::val - SumStats::rv$average))SumStats::calc_variance(SumStats::rv)SumStats::rv$prev_avg = SumStats::rv$average})) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugin, <frame>, (SumStats::VARIANCE, lambda_<6557258612059469785>{ if (1 < SumStats::rv$num) SumStats::rv$var_s += ((SumStats::val - SumStats::rv$prev_avg) * (SumStats::val - SumStats::rv$average))SumStats::calc_variance(SumStats::rv)SumStats::rv$prev_avg = SumStats::rv$average}))
0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugins, <frame>, ()) 0.000000 MetaHookPre CallFunction(SumStats::register_observe_plugins, <frame>, ())
0.000000 MetaHookPre CallFunction(__init_primary_bifs, <null>, ()) 0.000000 MetaHookPre CallFunction(__init_primary_bifs, <null>, ())
@ -2620,14 +2620,14 @@
0.000000 | HookCallFunction SumStats::add_observe_plugin_dependency(SumStats::VARIANCE, SumStats::AVERAGE) 0.000000 | HookCallFunction SumStats::add_observe_plugin_dependency(SumStats::VARIANCE, SumStats::AVERAGE)
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::AVERAGE, lambda_<3452231521688988155>{ if (!SumStats::rv?$average) SumStats::rv$average = SumStats::valelseSumStats::rv$average += (SumStats::val - SumStats::rv$average) / (coerce SumStats::rv$num to double)}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::AVERAGE, lambda_<3452231521688988155>{ if (!SumStats::rv?$average) SumStats::rv$average = SumStats::valelseSumStats::rv$average += (SumStats::val - SumStats::rv$average) / (coerce SumStats::rv$num to double)})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::HLL_UNIQUE, lambda_<943258244234523627>{ if (!SumStats::rv?$card) { SumStats::rv$card = hll_cardinality_init(SumStats::r$hll_error_margin, SumStats::r$hll_confidence)SumStats::rv$hll_error_margin = SumStats::r$hll_error_marginSumStats::rv$hll_confidence = SumStats::r$hll_confidence}hll_cardinality_add(SumStats::rv$card, SumStats::obs)SumStats::rv$hll_unique = double_to_count(hll_cardinality_estimate(SumStats::rv$card))}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::HLL_UNIQUE, lambda_<943258244234523627>{ if (!SumStats::rv?$card) { SumStats::rv$card = hll_cardinality_init(SumStats::r$hll_error_margin, SumStats::r$hll_confidence)SumStats::rv$hll_error_margin = SumStats::r$hll_error_marginSumStats::rv$hll_confidence = SumStats::r$hll_confidence}hll_cardinality_add(SumStats::rv$card, SumStats::obs)SumStats::rv$hll_unique = double_to_count(hll_cardinality_estimate(SumStats::rv$card))})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::LAST, lambda_<14831357773699754131>{ if (0 < SumStats::r$num_last_elements) { if (!SumStats::rv?$last_elements) SumStats::rv$last_elements = Queue::init((coerce [$max_len=SumStats::r$num_last_elements] to Queue::Settings))Queue::put(SumStats::rv$last_elements, SumStats::obs)}}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::LAST, lambda_<6246854644409869026>{ if (0 < SumStats::r$num_last_elements) { if (!SumStats::rv?$last_elements) SumStats::rv$last_elements = Queue::init((coerce [$max_len=SumStats::r$num_last_elements] to Queue::Settings))Queue::put(SumStats::rv$last_elements, SumStats::obs)}})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::MAX, lambda_<9734000075919044397>{ if (!SumStats::rv?$max) SumStats::rv$max = SumStats::valelseif (SumStats::rv$max < SumStats::val) SumStats::rv$max = SumStats::val}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::MAX, lambda_<9734000075919044397>{ if (!SumStats::rv?$max) SumStats::rv$max = SumStats::valelseif (SumStats::rv$max < SumStats::val) SumStats::rv$max = SumStats::val})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::MIN, lambda_<2451066605226214733>{ if (!SumStats::rv?$min) SumStats::rv$min = SumStats::valelseif (SumStats::val < SumStats::rv$min) SumStats::rv$min = SumStats::val}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::MIN, lambda_<2451066605226214733>{ if (!SumStats::rv?$min) SumStats::rv$min = SumStats::valelseif (SumStats::val < SumStats::rv$min) SumStats::rv$min = SumStats::val})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::SAMPLE, lambda_<11888441397542569241>{ SumStats::sample_add_sample(SumStats::obs, SumStats::rv)}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::SAMPLE, lambda_<11888441397542569241>{ SumStats::sample_add_sample(SumStats::obs, SumStats::rv)})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::STD_DEV, lambda_<5704045257244168718>{ SumStats::calc_std_dev(SumStats::rv)}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::STD_DEV, lambda_<5704045257244168718>{ SumStats::calc_std_dev(SumStats::rv)})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::SUM, lambda_<6958532551242393774>{ SumStats::rv$sum += SumStats::val}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::SUM, lambda_<6958532551242393774>{ SumStats::rv$sum += SumStats::val})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::TOPK, lambda_<2861372781530360365>{ topk_add(SumStats::rv$topk, SumStats::obs)}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::TOPK, lambda_<2861372781530360365>{ topk_add(SumStats::rv$topk, SumStats::obs)})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::UNIQUE, lambda_<10387912117292132662>{ if (!SumStats::rv?$unique_vals) SumStats::rv$unique_vals = (coerce set() to set[SumStats::Observation])if (SumStats::r?$unique_max) SumStats::rv$unique_max = SumStats::r$unique_maxif (!SumStats::r?$unique_max || sizeofSumStats::rv$unique_vals <= SumStats::r$unique_max) add SumStats::rv$unique_vals[SumStats::obs]SumStats::rv$unique = sizeofSumStats::rv$unique_vals}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::UNIQUE, lambda_<14393221830775341876>{ if (!SumStats::rv?$unique_vals) SumStats::rv$unique_vals = (coerce set() to set[SumStats::Observation])if (SumStats::r?$unique_max) SumStats::rv$unique_max = SumStats::r$unique_maxif (!SumStats::r?$unique_max || sizeofSumStats::rv$unique_vals <= SumStats::r$unique_max) add SumStats::rv$unique_vals[SumStats::obs]SumStats::rv$unique = sizeofSumStats::rv$unique_vals})
0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::VARIANCE, lambda_<6557258612059469785>{ if (1 < SumStats::rv$num) SumStats::rv$var_s += ((SumStats::val - SumStats::rv$prev_avg) * (SumStats::val - SumStats::rv$average))SumStats::calc_variance(SumStats::rv)SumStats::rv$prev_avg = SumStats::rv$average}) 0.000000 | HookCallFunction SumStats::register_observe_plugin(SumStats::VARIANCE, lambda_<6557258612059469785>{ if (1 < SumStats::rv$num) SumStats::rv$var_s += ((SumStats::val - SumStats::rv$prev_avg) * (SumStats::val - SumStats::rv$average))SumStats::calc_variance(SumStats::rv)SumStats::rv$prev_avg = SumStats::rv$average})
0.000000 | HookCallFunction SumStats::register_observe_plugins() 0.000000 | HookCallFunction SumStats::register_observe_plugins()
0.000000 | HookCallFunction __init_primary_bifs() 0.000000 | HookCallFunction __init_primary_bifs()

View file

@ -9,29 +9,29 @@ error: Input stream filetable: Problem unrolling
The input framework does not support optional record fields: "r" The input framework does not support optional record fields: "r"
error: Input stream optionalrecordtable: Problem unrolling error: Input stream optionalrecordtable: Problem unrolling
Encountered incompatible type "file" in type definition for field "s" in ReaderFrontend. Ignoring optional field. Encountered incompatible type "file" in type definition for field "s" in ReaderFrontend. Ignoring optional field.
error: Input stream optionalfiletable: Table type does not match value type. Need type 'record { i:int; s:file of string; }', got 'record { i:int; r:record { i:int; s:file of string; }; }' error: Input stream optionalfiletable: Table type does not match value type. Need type 'record { i:int; s:file of string &optional; }', got 'record { i:int; r:record { i:int; s:file of string; } &optional; }'
error: Input stream optionalfiletable2: Table type does not match index type. Need type 'count':count, got 'string':string error: Input stream optionalfiletable2: Table type does not match index type. Need type 'count':count, got 'string':string
error: Input stream optionalfiletable3: Stream event is a function, not an event error: Input stream optionalfiletable3: Stream event is a function, not an event
error: Input stream optionalfiletable3: Table event must take 4 arguments error: Input stream optionalfiletable3: Table event must take 4 arguments
error: Input stream optionalfiletable4: Table event's first attribute must be of type Input::TableDescription error: Input stream optionalfiletable4: Table event's first attribute must be of type Input::TableDescription
error: Input stream optionalfiletable5: Table event's second attribute must be of type Input::Event error: Input stream optionalfiletable5: Table event's second attribute must be of type Input::Event
error: Input stream optionalfiletable6: Table event's index attributes do not match. Need 'record { c:count; }', got 'record { i:int; r:record { i:int; s:file of string; }; }' error: Input stream optionalfiletable6: Table event's index attributes do not match. Need 'record { c:count; }', got 'record { i:int; r:record { i:int; s:file of string; } &optional; }'
error: Input stream optionalfiletable7: Table event's value attributes do not match. Need 'record { i:int; s:file of string; }', got 'record { i:int; r:record { i:int; s:file of string; }; }' error: Input stream optionalfiletable7: Table event's value attributes do not match. Need 'record { i:int; s:file of string &optional; }', got 'record { i:int; r:record { i:int; s:file of string; } &optional; }'
error: Input stream optionalfiletable8: Stream does not want a record (want_record=F), but has more then one value field. error: Input stream optionalfiletable8: Stream does not want a record (want_record=F), but has more then one value field.
error: Input stream optionalfiletable9: Table has less elements than index definition error: Input stream optionalfiletable9: Table has less elements than index definition
error: Input stream optionalfiletable10: Table type has more indexes than index definition error: Input stream optionalfiletable10: Table type has more indexes than index definition
error: Input stream optionalfiletable11: Table type does not match value type. Need type 'count', got 'int' error: Input stream optionalfiletable11: Table type does not match value type. Need type 'count', got 'int'
error: Input stream optionalfiletable12: Table type does not match value type. Need type 'count', got 'record { i:int; s:string; a:addr; }' error: Input stream optionalfiletable12: Table type does not match value type. Need type 'count', got 'record { i:int; s:string; a:addr; }'
error: Input stream optionalfiletable14: Table type does not match value type. Need type 'int', got 'record { i:int; s:file of string; }' error: Input stream optionalfiletable14: Table type does not match value type. Need type 'int', got 'record { i:int; s:file of string &optional; }'
error: Input stream optionalfiletable15: Table type does not match value type. Need type 'record { c:count; }', got 'record { i:int; s:string; a:addr; }' error: Input stream optionalfiletable15: Table type does not match value type. Need type 'record { c:count; }', got 'record { i:int; s:string; a:addr; }'
error: Input stream event1: Stream event is a function, not an event error: Input stream event1: Stream event is a function, not an event
error: Input stream event2: Event does not take enough arguments error: Input stream event2: Event does not take enough arguments
error: Input stream event3: Event's first attribute must be of type Input::EventDescription error: Input stream event3: Event's first attribute must be of type Input::EventDescription
error: Input stream event4: Event's second attribute must be of type Input::Event error: Input stream event4: Event's second attribute must be of type Input::Event
error: Input stream event5: Incompatible type 'record':record { i:int; r:record { i:int; s:file of string; }; } for event, which needs type 'record':record { i:int; s:file of string; } error: Input stream event5: Incompatible type 'record':record { i:int; r:record { i:int; s:file of string; } &optional; } for event, which needs type 'record':record { i:int; s:file of string &optional; }
error: Input stream event6: Event has wrong number of arguments error: Input stream event6: Event has wrong number of arguments
error: Input stream event7: Incompatible type for event in field 3. Need type 'int':int, got 'record':record { i:int; r:record { i:int; s:file of string; }; } error: Input stream event7: Incompatible type for event in field 3. Need type 'int':int, got 'record':record { i:int; r:record { i:int; s:file of string; } &optional; }
error: Input stream event8: Incompatible type for event in field 5. Need type 'addr':addr, got 'string':string error: Input stream event8: Incompatible type for event in field 5. Need type 'addr':addr, got 'string':string
error: Input stream event9: Event has wrong number of arguments error: Input stream event9: Event has wrong number of arguments
error: Input stream error1: Error event's first attribute must be of type Input::EventDescription error: Input stream error1: Error event's first attribute must be of type Input::EventDescription

View file

@ -1,7 +1,7 @@
# #
# In "normal" test mode, connection uids should be determistic. # In "normal" test mode, connection uids should be determistic.
# #
# @TEST-EXEC: zeek -b -C -r $TRACES/wikipedia.trace %INPUT >output # @TEST-EXEC: zeek -b -D -C -r $TRACES/wikipedia.trace %INPUT >output
# @TEST-EXEC: btest-diff output # @TEST-EXEC: btest-diff output
# #
# Without a seed, they should differ each time: # Without a seed, they should differ each time:

View file

@ -0,0 +1,47 @@
# @TEST-EXEC: zeek -b %INPUT >out
# @TEST-EXEC: btest-diff out
type mutable_aggregate: record { x: count; };
function reference_capture() : function()
{
local a = 3;
local b = mutable_aggregate($x=11);
local f = function() { print ++a, --b$x; };
f();
++a;
--b$x;
f();
return f;
}
function reference_capture_double() : function() : function()
{
local a = 3;
local b = mutable_aggregate($x=11);
local f = function() : function() {
local c = mutable_aggregate($x=88);
print ++a;
local f2 = function() { print a -= 2, --b$x, c$x += 3; };
c$x = c$x / 2;
return f2;
};
f()();
++a;
--b$x;
f()();
return f;
}
event zeek_init()
{
print "reference capture";
local rc = reference_capture();
rc();
print "reference double capture";
local rc2 = reference_capture_double();
rc2()();
}

View file

@ -3,19 +3,6 @@
type mutable_aggregate: record { x: count; }; type mutable_aggregate: record { x: count; };
function reference_capture() : function()
{
local a = 3;
local b = mutable_aggregate($x=11);
local f = function() { print ++a, --b$x; };
f();
++a;
--b$x;
f();
return f;
}
function shallow_copy_capture() : function() function shallow_copy_capture() : function()
{ {
local a = 3; local a = 3;
@ -68,25 +55,6 @@ function mixed_copy_capture_b() : function()
return f; return f;
} }
function reference_capture_double() : function() : function()
{
local a = 3;
local b = mutable_aggregate($x=11);
local f = function() : function() {
local c = mutable_aggregate($x=88);
print ++a;
local f2 = function() { print a -= 2, --b$x, c$x += 3; };
c$x = c$x / 2;
return f2;
};
f()();
++a;
--b$x;
f()();
return f;
}
function shallow_copy_capture_double() : function() : function() function shallow_copy_capture_double() : function() : function()
{ {
local a = 3; local a = 3;
@ -167,33 +135,35 @@ function deep_copy3_capture_double() : function() : function()
event zeek_init() event zeek_init()
{ {
local rc = reference_capture(); print "shallow copy";
rc();
local scc = shallow_copy_capture(); local scc = shallow_copy_capture();
scc(); scc();
print "deep copy";
local dcc = deep_copy_capture(); local dcc = deep_copy_capture();
dcc(); dcc();
print "mixed copy, case 1";
local mcca = mixed_copy_capture_a(); local mcca = mixed_copy_capture_a();
mcca(); mcca();
print "mixed copy, case 2";
local mccb = mixed_copy_capture_b(); local mccb = mixed_copy_capture_b();
mccb(); mccb();
local rc2 = reference_capture_double(); print "double shallow copy";
rc2()();
local scc2 = shallow_copy_capture_double(); local scc2 = shallow_copy_capture_double();
scc2()(); scc2()();
print "double deep copy, case 1";
local dcc2_1 = deep_copy1_capture_double(); local dcc2_1 = deep_copy1_capture_double();
dcc2_1()(); dcc2_1()();
print "double deep copy, case 2";
local dcc2_2 = deep_copy2_capture_double(); local dcc2_2 = deep_copy2_capture_double();
dcc2_2()(); dcc2_2()();
print "double deep copy, case 3";
local dcc2_3 = deep_copy3_capture_double(); local dcc2_3 = deep_copy3_capture_double();
dcc2_3()(); dcc2_3()();
} }

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT # @TEST-PORT: BROKER_PORT
# #
# @TEST-EXEC: btest-bg-run recv "zeek -B broker -b ../recv.zeek >recv.out" # @TEST-EXEC: btest-bg-run recv "zeek -D -B broker -b ../recv.zeek >recv.out"
# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out" # @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
# #
# @TEST-EXEC: btest-bg-wait 45 # @TEST-EXEC: btest-bg-wait 45
# @TEST-EXEC: btest-diff recv/recv.out # @TEST-EXEC: btest-diff recv/recv.out

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT # @TEST-PORT: BROKER_PORT
# #
# @TEST-EXEC: btest-bg-run recv "zeek -B broker -b ../recv.zeek >recv.out 2>recv.error" # @TEST-EXEC: btest-bg-run recv "zeek -D -B broker -b ../recv.zeek >recv.out 2>recv.error"
# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out" # @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
# #
# @TEST-EXEC: btest-bg-wait 20 # @TEST-EXEC: btest-bg-wait 20
# @TEST-EXEC: btest-diff recv/recv.error # @TEST-EXEC: btest-diff recv/recv.error

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT # @TEST-PORT: BROKER_PORT
# #
# @TEST-EXEC: btest-bg-run recv "zeek -B broker -b ../recv.zeek >recv.out" # @TEST-EXEC: btest-bg-run recv "zeek -D -B broker -b ../recv.zeek >recv.out"
# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out" # @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
# #
# @TEST-EXEC: btest-bg-wait 45 # @TEST-EXEC: btest-bg-wait 45
# @TEST-EXEC: btest-diff recv/recv.out # @TEST-EXEC: btest-diff recv/recv.out

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT # @TEST-PORT: BROKER_PORT
# #
# @TEST-EXEC: btest-bg-run recv "zeek -B broker -b ../recv.zeek >recv.out" # @TEST-EXEC: btest-bg-run recv "zeek -D -B broker -b ../recv.zeek >recv.out"
# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out" # @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
# #
# @TEST-EXEC: btest-bg-wait 20 # @TEST-EXEC: btest-bg-wait 20
# @TEST-EXEC: btest-diff recv/recv.out # @TEST-EXEC: btest-diff recv/recv.out

View file

@ -1,7 +1,7 @@
# @TEST-PORT: BROKER_PORT # @TEST-PORT: BROKER_PORT
# #
# @TEST-EXEC: btest-bg-run recv "zeek -B broker -b ../recv.zeek >recv.out" # @TEST-EXEC: btest-bg-run recv "zeek -D -B broker -b ../recv.zeek >recv.out"
# @TEST-EXEC: btest-bg-run send "zeek -B broker -b ../send.zeek >send.out" # @TEST-EXEC: btest-bg-run send "zeek -D -B broker -b ../send.zeek >send.out"
# #
# @TEST-EXEC: btest-bg-wait 45 # @TEST-EXEC: btest-bg-wait 45
# @TEST-EXEC: btest-diff recv/recv.out # @TEST-EXEC: btest-diff recv/recv.out

View file

@ -30,5 +30,13 @@ event zeek_init()
print x3; print x3;
local x4: count; local x4: count;
print x4; # note, no execution after this point due to error # note, no execution after this point due to error
# We use this slightly baroque expression because compiled code
# may have x4 genuinely uninitialized, and we want deterministic
# output in that case.
if ( x4 > 5 )
print T;
else
print T;
} }