MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_invalid_parameters

Function test_invalid_parameters

dpdk/app/test/test_acl.c:1359–1582  ·  view source on GitHub ↗

* test functions by passing invalid or * non-workable parameters. * * we do very limited testing of classify functions here * because those are performance-critical and * thus don't do much parameter checking. */

Source from the content-addressed store, hash-verified

1357 * thus don't do much parameter checking.
1358 */
1359static int
1360test_invalid_parameters(void)
1361{
1362 struct rte_acl_param param;
1363 struct rte_acl_ctx *acx;
1364 struct rte_acl_ipv4vlan_rule rule;
1365 int result;
1366
1367 uint32_t layout[RTE_ACL_IPV4VLAN_NUM] = {0};
1368
1369
1370 /**
1371 * rte_ac_create()
1372 */
1373
1374 /* NULL param */
1375 acx = rte_acl_create(NULL);
1376 if (acx != NULL) {
1377 printf("Line %i: ACL context creation with NULL param "
1378 "should have failed!\n", __LINE__);
1379 rte_acl_free(acx);
1380 return -1;
1381 }
1382
1383 /* zero rule size */
1384 memcpy(&param, &acl_param, sizeof(param));
1385 param.rule_size = 0;
1386
1387 acx = rte_acl_create(&param);
1388 if (acx == NULL) {
1389 printf("Line %i: ACL context creation with zero rule len "
1390 "failed!\n", __LINE__);
1391 return -1;
1392 } else
1393 rte_acl_free(acx);
1394
1395 /* zero max rule num */
1396 memcpy(&param, &acl_param, sizeof(param));
1397 param.max_rule_num = 0;
1398
1399 acx = rte_acl_create(&param);
1400 if (acx == NULL) {
1401 printf("Line %i: ACL context creation with zero rule num "
1402 "failed!\n", __LINE__);
1403 return -1;
1404 } else
1405 rte_acl_free(acx);
1406
1407 if (rte_eal_has_hugepages()) {
1408 /* invalid NUMA node */
1409 memcpy(&param, &acl_param, sizeof(param));
1410 param.socket_id = RTE_MAX_NUMA_NODES + 1;
1411
1412 acx = rte_acl_create(&param);
1413 if (acx != NULL) {
1414 printf("Line %i: ACL context creation with invalid "
1415 "NUMA should have failed!\n", __LINE__);
1416 rte_acl_free(acx);

Callers 1

test_aclFunction · 0.70

Calls 11

rte_acl_createFunction · 0.85
rte_acl_freeFunction · 0.85
rte_eal_has_hugepagesFunction · 0.85
rte_acl_find_existingFunction · 0.85
rte_acl_ipv4vlan_buildFunction · 0.85
rte_acl_classifyFunction · 0.85
rte_acl_dumpFunction · 0.85
printfFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected