GH-591: fix reading set[enum] values from input files

This commit is contained in:
Jon Siwek 2019-10-02 21:03:30 -07:00
parent 8ba19cd7d1
commit fd66e7b9f6
4 changed files with 93 additions and 2 deletions

View file

@ -0,0 +1,46 @@
# @TEST-EXEC: btest-bg-run zeek zeek -b %INPUT
# @TEST-EXEC: btest-bg-wait 10
# @TEST-EXEC: btest-diff zeek/.stdout
# @TEST-EXEC: btest-diff zeek/config.log
@TEST-START-FILE configfile4
DPD::ignore_violations Analyzer::ANALYZER_SYSLOG
@TEST-END-FILE
@load base/frameworks/config
@load base/frameworks/dpd
redef exit_only_after_terminate = T;
redef InputConfig::empty_field = "EMPTY";
redef InputConfig::set_separator = "\t";
type Idx: record {
option_name: string;
};
type Val: record {
option_val: string;
};
global currconfig: table[string] of string = table();
event InputConfig::new_value(name: string, source: string, id: string, value: any)
{
print id, lookup_ID(id);
print "---";
print value;
print "---";
Config::set_value(id, value);
print id, lookup_ID(id);
print "---";
}
event Input::end_of_data(name: string, source:string)
{
terminate();
}
event zeek_init()
{
Input::add_table([$reader=Input::READER_CONFIG, $source="../configfile4", $name="configuration", $idx=Idx, $val=Val, $destination=currconfig, $want_record=F]);
}