This source file includes following definitions.
- test_parse_ifex_str
1
2
3
4
5
6
7
8
9
10 #include "btl_usnic_test.h"
11
12
13
14 #if OPAL_BTL_USNIC_UNIT_TESTS
15
16 static int test_parse_ifex_str(void *ctx)
17 {
18 usnic_if_filter_t *f;
19
20 f = parse_ifex_str(NULL, "include");
21 check(f == NULL);
22 free_filter(f);
23
24 f = parse_ifex_str("", "include");
25 check(f == NULL);
26 free_filter(f);
27
28 f = parse_ifex_str("usnic_1,usnic_0", "include");
29 check(f != NULL);
30 check(f->n_elt == 2);
31 check(f->elts != NULL);
32 check(f->elts[0].is_netmask == false);
33 check_str_eq(f->elts[0].if_name, "usnic_1");
34 check(f->elts[1].is_netmask == false);
35 check_str_eq(f->elts[1].if_name, "usnic_0");
36 free_filter(f);
37
38 f = parse_ifex_str("usnic_1,1.2.3.0/24", "exclude");
39 check(f != NULL);
40 check(f->n_elt == 2);
41 check(f->elts != NULL);
42 check(f->elts[0].is_netmask == false);
43 check_str_eq(f->elts[0].if_name, "usnic_1");
44 check(f->elts[1].is_netmask == true);
45 check(f->elts[1].addr_be == htonl(0x01020300));
46 check(f->elts[1].netmask_be == 24);
47 free_filter(f);
48
49 return 0;
50 }
51
52 USNIC_REGISTER_TEST("test_parse_ifex_str", test_parse_ifex_str, NULL)
53
54 #endif