* 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. */
| 1357 | * thus don't do much parameter checking. |
| 1358 | */ |
| 1359 | static int |
| 1360 | test_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(¶m, &acl_param, sizeof(param)); |
| 1385 | param.rule_size = 0; |
| 1386 | |
| 1387 | acx = rte_acl_create(¶m); |
| 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(¶m, &acl_param, sizeof(param)); |
| 1397 | param.max_rule_num = 0; |
| 1398 | |
| 1399 | acx = rte_acl_create(¶m); |
| 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(¶m, &acl_param, sizeof(param)); |
| 1410 | param.socket_id = RTE_MAX_NUMA_NODES + 1; |
| 1411 | |
| 1412 | acx = rte_acl_create(¶m); |
| 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); |
no test coverage detected