usnic: unit test parse_ifex_str
Reviewed-by: Jeff Squyres <jsquyres@cisco.com> cmr=v1.7.5:ticket=trac:4253 This commit was SVN r30846. The following Trac tickets were found above: Ticket 4253 --> https://svn.open-mpi.org/trac/ompi/ticket/4253
Этот коммит содержится в:
родитель
921a29e41f
Коммит
5bf969e63b
@ -27,6 +27,9 @@ EXTRA_DIST = README.txt README.test
|
|||||||
dist_ompidata_DATA = \
|
dist_ompidata_DATA = \
|
||||||
help-mpi-btl-usnic.txt
|
help-mpi-btl-usnic.txt
|
||||||
|
|
||||||
|
test_sources = \
|
||||||
|
test/btl_usnic_component_test.h
|
||||||
|
|
||||||
sources = \
|
sources = \
|
||||||
btl_usnic_compat.h \
|
btl_usnic_compat.h \
|
||||||
btl_usnic_module.c \
|
btl_usnic_module.c \
|
||||||
@ -52,7 +55,8 @@ sources = \
|
|||||||
btl_usnic_util.c \
|
btl_usnic_util.c \
|
||||||
btl_usnic_util.h \
|
btl_usnic_util.h \
|
||||||
btl_usnic_test.c \
|
btl_usnic_test.c \
|
||||||
btl_usnic_test.h
|
btl_usnic_test.h \
|
||||||
|
$(test_sources)
|
||||||
|
|
||||||
if OPAL_HAVE_HWLOC
|
if OPAL_HAVE_HWLOC
|
||||||
sources += btl_usnic_hwloc.c
|
sources += btl_usnic_hwloc.c
|
||||||
|
@ -1584,3 +1584,5 @@ void ompi_btl_usnic_component_debug(void)
|
|||||||
ompi_btl_usnic_print_stats(module, " manual", /*reset=*/false);
|
ompi_btl_usnic_print_stats(module, " manual", /*reset=*/false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "test/btl_usnic_component_test.h"
|
||||||
|
54
ompi/mca/btl/usnic/test/btl_usnic_component_test.h
Обычный файл
54
ompi/mca/btl/usnic/test/btl_usnic_component_test.h
Обычный файл
@ -0,0 +1,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 OMPI_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 == htonl(0x01020300));
|
||||||
|
check(f->elts[1].prefixlen == 24);
|
||||||
|
free_filter(f);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
USNIC_REGISTER_TEST("test_parse_ifex_str", test_parse_ifex_str, NULL)
|
||||||
|
|
||||||
|
#endif
|
Загрузка…
x
Ссылка в новой задаче
Block a user