Added stress test
This commit is contained in:
@@ -5754,6 +5754,38 @@ void outlierUnitTest() {
|
|||||||
|
|
||||||
/* *********************************************** */
|
/* *********************************************** */
|
||||||
|
|
||||||
|
void loadStressTest() {
|
||||||
|
struct ndpi_detection_module_struct *ndpi_struct_shadow = ndpi_init_detection_module(NULL);
|
||||||
|
NDPI_PROTOCOL_BITMASK all;
|
||||||
|
|
||||||
|
if(ndpi_struct_shadow) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
NDPI_BITMASK_SET_ALL(all);
|
||||||
|
ndpi_set_protocol_detection_bitmask2(ndpi_struct_shadow, &all);
|
||||||
|
|
||||||
|
for(i=1; i<100000; i++) {
|
||||||
|
char name[32];
|
||||||
|
ndpi_protocol_category_t id = CUSTOM_CATEGORY_MALWARE;
|
||||||
|
u_int8_t value = (u_int8_t)i;
|
||||||
|
|
||||||
|
snprintf(name, sizeof(name), "%d.com", i);
|
||||||
|
ndpi_load_hostname_category(ndpi_struct_shadow, name, id);
|
||||||
|
|
||||||
|
snprintf(name, sizeof(name), "%u.%u.%u.%u", value, value, value, value);
|
||||||
|
ndpi_load_ip_category(ndpi_struct_shadow, name, id, (void *)"My list");
|
||||||
|
}
|
||||||
|
|
||||||
|
ndpi_enable_loaded_categories(ndpi_struct_shadow);
|
||||||
|
ndpi_finalize_initialization(ndpi_struct_shadow);
|
||||||
|
ndpi_exit_detection_module(ndpi_struct_shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* *********************************************** */
|
||||||
|
|
||||||
void domainsUnitTest() {
|
void domainsUnitTest() {
|
||||||
NDPI_PROTOCOL_BITMASK all;
|
NDPI_PROTOCOL_BITMASK all;
|
||||||
struct ndpi_detection_module_struct *ndpi_info_mod = ndpi_init_detection_module(NULL);
|
struct ndpi_detection_module_struct *ndpi_info_mod = ndpi_init_detection_module(NULL);
|
||||||
@@ -5870,6 +5902,7 @@ int main(int argc, char **argv) {
|
|||||||
exit(0);
|
exit(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
loadStressTest();
|
||||||
domainsUnitTest();
|
domainsUnitTest();
|
||||||
outlierUnitTest();
|
outlierUnitTest();
|
||||||
pearsonUnitTest();
|
pearsonUnitTest();
|
||||||
|
|||||||
Reference in New Issue
Block a user