Created
September 23, 2019 17:10
-
-
Save grigorescu/3a02153e03896697a96178eac067b50c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test 1 | |
######## | |
# Fails: warning: Value '{}' for stream 'configuration' is not a valid enum. | |
# internal error: null value given to CompositeHash::ComputeHash | |
# @TEST-EXEC: btest-bg-run zeek zeek %INPUT | |
# @TEST-EXEC: btest-bg-wait 10 | |
@TEST-START-FILE configfile1 | |
DPD::ignore_violations {} | |
@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); | |
Config::set_value(id, value); | |
print id, lookup_ID(id); | |
} | |
event Input::end_of_data(name: string, source:string) | |
{ | |
terminate(); | |
} | |
event zeek_init() | |
{ | |
Input::add_table([$reader=Input::READER_CONFIG, $source="../configfile1", $name="configuration", $idx=Idx, $val=Val, $destination=currconfig, $want_record=F]); | |
} | |
# Test 2 | |
######## | |
# Works | |
# | |
# @TEST-START-NEXT | |
# @TEST-EXEC: btest-bg-run zeek zeek %INPUT | |
# @TEST-EXEC: btest-bg-wait 10 | |
@TEST-START-FILE configfile2 | |
DPD::ignore_violations EMPTY | |
@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); | |
Config::set_value(id, value); | |
print id, lookup_ID(id); | |
} | |
event Input::end_of_data(name: string, source:string) | |
{ | |
terminate(); | |
} | |
event zeek_init() | |
{ | |
Input::add_table([$reader=Input::READER_CONFIG, $source="../configfile2", $name="configuration", $idx=Idx, $val=Val, $destination=currconfig, $want_record=F]); | |
} | |
# Test 3 | |
######## | |
# Fails: Segmentation fault: 11 zeek input_enum_set-3/input_enum_set.zeek | |
# @TEST-START-NEXT | |
# @TEST-EXEC: btest-bg-run zeek zeek %INPUT | |
# @TEST-EXEC: btest-bg-wait 10 | |
@TEST-START-FILE configfile3 | |
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); | |
Config::set_value(id, value); | |
print id, lookup_ID(id); | |
} | |
event Input::end_of_data(name: string, source:string) | |
{ | |
terminate(); | |
} | |
event zeek_init() | |
{ | |
Input::add_table([$reader=Input::READER_CONFIG, $source="../configfile3", $name="configuration", $idx=Idx, $val=Val, $destination=currconfig, $want_record=F]); | |
} | |
# Test 4 | |
######## | |
# Fails: Segmentation fault: 11 zeek input_enum_set-4/input_enum_set.zeek | |
# @TEST-START-NEXT | |
# @TEST-EXEC: btest-bg-run zeek zeek %INPUT | |
# @TEST-EXEC: btest-bg-wait 10 | |
@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 cat(value); | |
} | |
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]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment