File: btl_usnic_component_test.h

package info (click to toggle)
openmpi 5.0.8-4
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 201,684 kB
  • sloc: ansic: 613,078; makefile: 42,353; sh: 11,194; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,179; python: 1,859; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (54 lines) | stat: -rw-r--r-- 1,348 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
 * Copyright (c) 2014      Cisco Systems, Inc.  All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "btl_usnic_test.h"

/* see README.test for info about why/how this file is included into another
 * source file */
#if OPAL_BTL_USNIC_UNIT_TESTS

static int test_parse_ifex_str(void *ctx)
{
    usnic_if_filter_t *f;

    f = parse_ifex_str(NULL, "include");
    check(f == NULL);
    free_filter(f);

    f = parse_ifex_str("", "include");
    check(f == NULL);
    free_filter(f);

    f = parse_ifex_str("usnic_1,usnic_0", "include");
    check(f != NULL);
    check(f->n_elt == 2);
    check(f->elts != NULL);
    check(f->elts[0].is_netmask == false);
    check_str_eq(f->elts[0].if_name, "usnic_1");
    check(f->elts[1].is_netmask == false);
    check_str_eq(f->elts[1].if_name, "usnic_0");
    free_filter(f);

    f = parse_ifex_str("usnic_1,1.2.3.0/24", "exclude");
    check(f != NULL);
    check(f->n_elt == 2);
    check(f->elts != NULL);
    check(f->elts[0].is_netmask == false);
    check_str_eq(f->elts[0].if_name, "usnic_1");
    check(f->elts[1].is_netmask == true);
    check(f->elts[1].addr_be == htonl(0x01020300));
    check(f->elts[1].netmask_be == 24);
    free_filter(f);

    return 0;
}

USNIC_REGISTER_TEST("test_parse_ifex_str", test_parse_ifex_str, NULL)

#endif