mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Simplify a broker btest
The explicit sorting function definition was a temporary stability workaround with a better fix now being available via https://github.com/zeek/btest/pull/25
This commit is contained in:
parent
b8a47de26c
commit
5ab20dfcb9
4 changed files with 9 additions and 36 deletions
4
CHANGES
4
CHANGES
|
@ -1,4 +1,8 @@
|
||||||
|
|
||||||
|
3.3.0-dev.216 | 2020-08-31 14:57:57 -0700
|
||||||
|
|
||||||
|
* Simplify a broker btest (Jon Siwek, Corelight)
|
||||||
|
|
||||||
3.3.0-dev.215 | 2020-08-28 16:51:40 -0700
|
3.3.0-dev.215 | 2020-08-28 16:51:40 -0700
|
||||||
|
|
||||||
* GH-926: Improve type-checking for ternary conditional operator (Jon Siwek, Corelight)
|
* GH-926: Improve type-checking for ternary conditional operator (Jon Siwek, Corelight)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
3.3.0-dev.215
|
3.3.0-dev.216
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit db71a5ae612dec9daca3b19be7b8bf999310ef72
|
Subproject commit 46a5c362281fadccad7af62600d9d816013c6a2f
|
|
@ -2,9 +2,9 @@
|
||||||
# @TEST-PORT: BROKER_PORT2
|
# @TEST-PORT: BROKER_PORT2
|
||||||
# @TEST-PORT: BROKER_PORT3
|
# @TEST-PORT: BROKER_PORT3
|
||||||
|
|
||||||
# @TEST-EXEC: btest-bg-run manager-1 "ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b -B broker ../common.zeek ../master.zeek >../master.out"
|
# @TEST-EXEC: btest-bg-run manager-1 "ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=manager-1 zeek -b -B broker %DIR/sort-stuff.zeek ../common.zeek ../master.zeek >../master.out"
|
||||||
# @TEST-EXEC: btest-bg-run worker-1 "ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-1 zeek -b -B broker ../common.zeek ../clone.zeek >../clone.out"
|
# @TEST-EXEC: btest-bg-run worker-1 "ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-1 zeek -b -B broker %DIR/sort-stuff.zeek ../common.zeek ../clone.zeek >../clone.out"
|
||||||
# @TEST-EXEC: btest-bg-run worker-2 "ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-2 zeek -b -B broker ../common.zeek ../clone.zeek >../clone2.out"
|
# @TEST-EXEC: btest-bg-run worker-2 "ZEEKPATH=$ZEEKPATH:.. CLUSTER_NODE=worker-2 zeek -b -B broker %DIR/sort-stuff.zeek ../common.zeek ../clone.zeek >../clone2.out"
|
||||||
# @TEST-EXEC: btest-bg-wait 30
|
# @TEST-EXEC: btest-bg-wait 30
|
||||||
#
|
#
|
||||||
# @TEST-EXEC: btest-diff master.out
|
# @TEST-EXEC: btest-diff master.out
|
||||||
|
@ -38,37 +38,6 @@ global t: table[string] of count &backend=Broker::MEMORY;
|
||||||
global s: set[string] &backend=Broker::MEMORY;
|
global s: set[string] &backend=Broker::MEMORY;
|
||||||
global r: table[string] of testrec &broker_allow_complex_type &backend=Broker::MEMORY;
|
global r: table[string] of testrec &broker_allow_complex_type &backend=Broker::MEMORY;
|
||||||
|
|
||||||
function sort_set(s: set[string]): vector of string
|
|
||||||
{
|
|
||||||
local v: vector of string = vector();
|
|
||||||
|
|
||||||
for ( e in s )
|
|
||||||
v += e;
|
|
||||||
|
|
||||||
sort(v, strcmp);
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
type TableEntry: record {
|
|
||||||
key: string;
|
|
||||||
val: any;
|
|
||||||
};
|
|
||||||
|
|
||||||
function sort_table(t: table[string] of any): vector of TableEntry
|
|
||||||
{
|
|
||||||
local vs: vector of string = vector();
|
|
||||||
local rval: vector of TableEntry = vector();
|
|
||||||
|
|
||||||
for ( k, v in t )
|
|
||||||
vs += k;
|
|
||||||
|
|
||||||
sort(vs, strcmp);
|
|
||||||
|
|
||||||
for ( i in vs )
|
|
||||||
rval += TableEntry($key=vs[i], $val=t[vs[i]]);
|
|
||||||
|
|
||||||
return rval;
|
|
||||||
}
|
|
||||||
@TEST-END-FILE
|
@TEST-END-FILE
|
||||||
|
|
||||||
@TEST-START-FILE master.zeek
|
@TEST-START-FILE master.zeek
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue