mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-03 15:56:00 +00:00
[master] Updated build to accomodate new unit tests in common
Merges in rt20558_b.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,6 +10,7 @@ client/tests/test-suite.log
|
|||||||
common/tests/alloc_unittest
|
common/tests/alloc_unittest
|
||||||
common/tests/dns_unittest
|
common/tests/dns_unittest
|
||||||
common/tests/misc_unittest
|
common/tests/misc_unittest
|
||||||
|
common/tests/ns_name_unittest
|
||||||
config.log
|
config.log
|
||||||
config.report
|
config.report
|
||||||
config.status
|
config.status
|
||||||
|
@@ -2277,9 +2277,10 @@ void set_option (universe, options, option, op)
|
|||||||
(memcmp(oc->option->format, "Dc", 2) == 0))) {
|
(memcmp(oc->option->format, "Dc", 2) == 0))) {
|
||||||
case 1:
|
case 1:
|
||||||
/* Only one is "Dc", this won't work
|
/* Only one is "Dc", this won't work
|
||||||
* Not sure if you make this occur, but just
|
* Not sure if you can make this occur, but just
|
||||||
* in case. */
|
* in case. */
|
||||||
log_error ("Both options must be Dc format");
|
log_error ("Both options must be Dc format");
|
||||||
|
option_cache_dereference (&noc, MDL);
|
||||||
return;
|
return;
|
||||||
case 2:
|
case 2:
|
||||||
/* Both are "Dc", change the code */
|
/* Both are "Dc", change the code */
|
||||||
|
@@ -8,7 +8,7 @@ ATF_TESTS =
|
|||||||
|
|
||||||
if HAVE_ATF
|
if HAVE_ATF
|
||||||
|
|
||||||
ATF_TESTS += alloc_unittest dns_unittest misc_unittest
|
ATF_TESTS += alloc_unittest dns_unittest misc_unittest ns_name_unittest
|
||||||
|
|
||||||
alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c
|
alloc_unittest_SOURCES = test_alloc.c $(top_srcdir)/tests/t_api_dhcp.c
|
||||||
alloc_unittest_LDADD = $(ATF_LDFLAGS)
|
alloc_unittest_LDADD = $(ATF_LDFLAGS)
|
||||||
@@ -28,6 +28,12 @@ misc_unittest_LDADD += ../libdhcp.a \
|
|||||||
../../omapip/libomapi.a ../../bind/lib/libirs.a \
|
../../omapip/libomapi.a ../../bind/lib/libirs.a \
|
||||||
../../bind/lib/libdns.a ../../bind/lib/libisccfg.a ../../bind/lib/libisc.a
|
../../bind/lib/libdns.a ../../bind/lib/libisccfg.a ../../bind/lib/libisc.a
|
||||||
|
|
||||||
|
ns_name_unittest_SOURCES = ns_name_test.c $(top_srcdir)/tests/t_api_dhcp.c
|
||||||
|
ns_name_unittest_LDADD = $(ATF_LDFLAGS)
|
||||||
|
ns_name_unittest_LDADD += ../libdhcp.a \
|
||||||
|
../../omapip/libomapi.a ../../bind/lib/libirs.a \
|
||||||
|
../../bind/lib/libdns.a ../../bind/lib/libisccfg.a ../../bind/lib/libisc.a
|
||||||
|
|
||||||
check: $(ATF_TESTS)
|
check: $(ATF_TESTS)
|
||||||
atf-run | atf-report
|
atf-run | atf-report
|
||||||
|
|
||||||
|
@@ -77,7 +77,7 @@ PRE_UNINSTALL = :
|
|||||||
POST_UNINSTALL = :
|
POST_UNINSTALL = :
|
||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
@HAVE_ATF_TRUE@am__append_1 = alloc_unittest dns_unittest misc_unittest
|
@HAVE_ATF_TRUE@am__append_1 = alloc_unittest dns_unittest misc_unittest ns_name_unittest
|
||||||
check_PROGRAMS = $(am__EXEEXT_2)
|
check_PROGRAMS = $(am__EXEEXT_2)
|
||||||
subdir = common/tests
|
subdir = common/tests
|
||||||
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
|
||||||
@@ -91,7 +91,8 @@ CONFIG_HEADER = $(top_builddir)/includes/config.h
|
|||||||
CONFIG_CLEAN_FILES =
|
CONFIG_CLEAN_FILES =
|
||||||
CONFIG_CLEAN_VPATH_FILES =
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
@HAVE_ATF_TRUE@am__EXEEXT_1 = alloc_unittest$(EXEEXT) \
|
@HAVE_ATF_TRUE@am__EXEEXT_1 = alloc_unittest$(EXEEXT) \
|
||||||
@HAVE_ATF_TRUE@ dns_unittest$(EXEEXT) misc_unittest$(EXEEXT)
|
@HAVE_ATF_TRUE@ dns_unittest$(EXEEXT) misc_unittest$(EXEEXT) \
|
||||||
|
@HAVE_ATF_TRUE@ ns_name_unittest$(EXEEXT)
|
||||||
am__EXEEXT_2 = $(am__EXEEXT_1)
|
am__EXEEXT_2 = $(am__EXEEXT_1)
|
||||||
am__alloc_unittest_SOURCES_DIST = test_alloc.c \
|
am__alloc_unittest_SOURCES_DIST = test_alloc.c \
|
||||||
$(top_srcdir)/tests/t_api_dhcp.c
|
$(top_srcdir)/tests/t_api_dhcp.c
|
||||||
@@ -124,6 +125,16 @@ misc_unittest_OBJECTS = $(am_misc_unittest_OBJECTS)
|
|||||||
@HAVE_ATF_TRUE@ ../../bind/lib/libirs.a ../../bind/lib/libdns.a \
|
@HAVE_ATF_TRUE@ ../../bind/lib/libirs.a ../../bind/lib/libdns.a \
|
||||||
@HAVE_ATF_TRUE@ ../../bind/lib/libisccfg.a \
|
@HAVE_ATF_TRUE@ ../../bind/lib/libisccfg.a \
|
||||||
@HAVE_ATF_TRUE@ ../../bind/lib/libisc.a
|
@HAVE_ATF_TRUE@ ../../bind/lib/libisc.a
|
||||||
|
am__ns_name_unittest_SOURCES_DIST = ns_name_test.c \
|
||||||
|
$(top_srcdir)/tests/t_api_dhcp.c
|
||||||
|
@HAVE_ATF_TRUE@am_ns_name_unittest_OBJECTS = ns_name_test.$(OBJEXT) \
|
||||||
|
@HAVE_ATF_TRUE@ t_api_dhcp.$(OBJEXT)
|
||||||
|
ns_name_unittest_OBJECTS = $(am_ns_name_unittest_OBJECTS)
|
||||||
|
@HAVE_ATF_TRUE@ns_name_unittest_DEPENDENCIES = $(am__DEPENDENCIES_1) \
|
||||||
|
@HAVE_ATF_TRUE@ ../libdhcp.a ../../omapip/libomapi.a \
|
||||||
|
@HAVE_ATF_TRUE@ ../../bind/lib/libirs.a ../../bind/lib/libdns.a \
|
||||||
|
@HAVE_ATF_TRUE@ ../../bind/lib/libisccfg.a \
|
||||||
|
@HAVE_ATF_TRUE@ ../../bind/lib/libisc.a
|
||||||
AM_V_P = $(am__v_P_@AM_V@)
|
AM_V_P = $(am__v_P_@AM_V@)
|
||||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||||
am__v_P_0 = false
|
am__v_P_0 = false
|
||||||
@@ -157,10 +168,11 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
|||||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||||
am__v_CCLD_1 =
|
am__v_CCLD_1 =
|
||||||
SOURCES = $(alloc_unittest_SOURCES) $(dns_unittest_SOURCES) \
|
SOURCES = $(alloc_unittest_SOURCES) $(dns_unittest_SOURCES) \
|
||||||
$(misc_unittest_SOURCES)
|
$(misc_unittest_SOURCES) $(ns_name_unittest_SOURCES)
|
||||||
DIST_SOURCES = $(am__alloc_unittest_SOURCES_DIST) \
|
DIST_SOURCES = $(am__alloc_unittest_SOURCES_DIST) \
|
||||||
$(am__dns_unittest_SOURCES_DIST) \
|
$(am__dns_unittest_SOURCES_DIST) \
|
||||||
$(am__misc_unittest_SOURCES_DIST)
|
$(am__misc_unittest_SOURCES_DIST) \
|
||||||
|
$(am__ns_name_unittest_SOURCES_DIST)
|
||||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||||
install-data-recursive install-dvi-recursive \
|
install-data-recursive install-dvi-recursive \
|
||||||
@@ -352,6 +364,12 @@ ATF_TESTS = $(am__append_1)
|
|||||||
@HAVE_ATF_TRUE@ ../../bind/lib/libdns.a \
|
@HAVE_ATF_TRUE@ ../../bind/lib/libdns.a \
|
||||||
@HAVE_ATF_TRUE@ ../../bind/lib/libisccfg.a \
|
@HAVE_ATF_TRUE@ ../../bind/lib/libisccfg.a \
|
||||||
@HAVE_ATF_TRUE@ ../../bind/lib/libisc.a
|
@HAVE_ATF_TRUE@ ../../bind/lib/libisc.a
|
||||||
|
@HAVE_ATF_TRUE@ns_name_unittest_SOURCES = ns_name_test.c $(top_srcdir)/tests/t_api_dhcp.c
|
||||||
|
@HAVE_ATF_TRUE@ns_name_unittest_LDADD = $(ATF_LDFLAGS) ../libdhcp.a \
|
||||||
|
@HAVE_ATF_TRUE@ ../../omapip/libomapi.a ../../bind/lib/libirs.a \
|
||||||
|
@HAVE_ATF_TRUE@ ../../bind/lib/libdns.a \
|
||||||
|
@HAVE_ATF_TRUE@ ../../bind/lib/libisccfg.a \
|
||||||
|
@HAVE_ATF_TRUE@ ../../bind/lib/libisc.a
|
||||||
all: all-recursive
|
all: all-recursive
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@@ -402,6 +420,10 @@ misc_unittest$(EXEEXT): $(misc_unittest_OBJECTS) $(misc_unittest_DEPENDENCIES) $
|
|||||||
@rm -f misc_unittest$(EXEEXT)
|
@rm -f misc_unittest$(EXEEXT)
|
||||||
$(AM_V_CCLD)$(LINK) $(misc_unittest_OBJECTS) $(misc_unittest_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(misc_unittest_OBJECTS) $(misc_unittest_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
ns_name_unittest$(EXEEXT): $(ns_name_unittest_OBJECTS) $(ns_name_unittest_DEPENDENCIES) $(EXTRA_ns_name_unittest_DEPENDENCIES)
|
||||||
|
@rm -f ns_name_unittest$(EXEEXT)
|
||||||
|
$(AM_V_CCLD)$(LINK) $(ns_name_unittest_OBJECTS) $(ns_name_unittest_LDADD) $(LIBS)
|
||||||
|
|
||||||
mostlyclean-compile:
|
mostlyclean-compile:
|
||||||
-rm -f *.$(OBJEXT)
|
-rm -f *.$(OBJEXT)
|
||||||
|
|
||||||
@@ -410,6 +432,7 @@ distclean-compile:
|
|||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dns_unittest.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dns_unittest.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc_unittest.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc_unittest.Po@am__quote@
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ns_name_test.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_api_dhcp.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_api_dhcp.Po@am__quote@
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_alloc.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_alloc.Po@am__quote@
|
||||||
|
|
||||||
|
@@ -20,6 +20,9 @@ ATF_TC_HEAD(MRns_name_list_funcs, tc) {
|
|||||||
"compress from text, decompress to text");
|
"compress from text, decompress to text");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void concat_lists (const char* label, struct data_string* list1,
|
||||||
|
struct data_string* list2, const char *refbuf, size_t reflen);
|
||||||
|
|
||||||
ATF_TC_BODY(MRns_name_list_funcs, tc) {
|
ATF_TC_BODY(MRns_name_list_funcs, tc) {
|
||||||
|
|
||||||
const char text_list[] = "one.two.com,three.two.com,four.two.com";
|
const char text_list[] = "one.two.com,three.two.com,four.two.com";
|
||||||
@@ -56,9 +59,102 @@ ATF_TC_BODY(MRns_name_list_funcs, tc) {
|
|||||||
"uncompressed buffer content wrong");
|
"uncompressed buffer content wrong");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ATF_TC(concat_dclists);
|
||||||
|
|
||||||
|
ATF_TC_HEAD(concat_dclists, tc) {
|
||||||
|
atf_tc_set_md_var(tc, "descr", "concat_dclists function test, "
|
||||||
|
"permutate concating empty and non-empty lists");
|
||||||
|
}
|
||||||
|
|
||||||
|
ATF_TC_BODY(concat_dclists, tc) {
|
||||||
|
/* Compressed list version of "booya.com" */
|
||||||
|
const char data[] =
|
||||||
|
{0x05, 0x62, 0x6f, 0x6f, 0x79, 0x61, 0x03, 0x63, 0x6f, 0x6d, 0x00 };
|
||||||
|
|
||||||
|
/* Concatenation of data with itself */
|
||||||
|
const char data2[] =
|
||||||
|
{0x05, 0x62, 0x6f, 0x6f, 0x79, 0x61, 0x03, 0x63, 0x6f, 0x6d, 0x00,
|
||||||
|
0xc0, 0x00 };
|
||||||
|
|
||||||
|
struct data_string nonempty;
|
||||||
|
struct data_string empty;
|
||||||
|
|
||||||
|
/* Make a non-empty compressed list from data[] */
|
||||||
|
nonempty.len = sizeof(data);
|
||||||
|
buffer_allocate(&(nonempty.buffer), nonempty.len, MDL);
|
||||||
|
memcpy(nonempty.buffer->data, data, nonempty.len);
|
||||||
|
nonempty.data = nonempty.buffer->data;
|
||||||
|
|
||||||
|
/* Permutate NULL with non-empty list */
|
||||||
|
concat_lists("null + null", NULL, NULL, "", 1);
|
||||||
|
concat_lists("null + nonempty", NULL, &nonempty, data, sizeof(data));
|
||||||
|
concat_lists("nonempty + null", &nonempty, NULL, data, sizeof(data));
|
||||||
|
|
||||||
|
/* Permutate zeroed-out list with non-empty list */
|
||||||
|
memset (&empty, 0x00, sizeof(struct data_string));
|
||||||
|
concat_lists("zero-list + zero-list", &empty, &empty, "", 1);
|
||||||
|
concat_lists("zero-list + nonempty", &empty, &nonempty, data, sizeof(data));
|
||||||
|
concat_lists("nonempty + zero-list", &nonempty, &empty, data, sizeof(data));
|
||||||
|
|
||||||
|
/* Create an empty list which is a buffer with 1 null in it */
|
||||||
|
/* Make sure those work the same as zeroed out data_strings */
|
||||||
|
buffer_allocate (&empty.buffer, 1, MDL);
|
||||||
|
empty.len = 1;
|
||||||
|
empty.data = empty.buffer->data;
|
||||||
|
|
||||||
|
/* Permutate with empty list */
|
||||||
|
concat_lists("empty + empty", &empty, &empty, "", 1);
|
||||||
|
concat_lists("empty + nonempty", &empty, &nonempty, data, sizeof(data));
|
||||||
|
concat_lists("nonempty + empty", &nonempty, &empty, data, sizeof(data));
|
||||||
|
|
||||||
|
/* Permutate with list len of 0 */
|
||||||
|
empty.len = 0;
|
||||||
|
concat_lists("zero-len + zero-len", &empty, &empty, "", 1);
|
||||||
|
concat_lists("zero-len + nonempty", &empty, &nonempty, data, sizeof(data));
|
||||||
|
concat_lists("nonempty + zero-len", &nonempty, &empty, data, sizeof(data));
|
||||||
|
|
||||||
|
/* Lastly, make sure two non-empty lists concat correctly */
|
||||||
|
concat_lists("nonempty + nonempty", &nonempty, &nonempty,
|
||||||
|
data2, sizeof(data2));
|
||||||
|
|
||||||
|
data_string_forget(&empty, MDL);
|
||||||
|
data_string_forget(&nonempty, MDL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Helper function which tests concatenating two compressed lists
|
||||||
|
*
|
||||||
|
* \param label text to print in error message
|
||||||
|
* \param list1 data_string containing first list
|
||||||
|
* \param list2 data_string containing second list
|
||||||
|
* \param refbuf buffer containing the expected concatentated data
|
||||||
|
* \param reflen length of the expected data
|
||||||
|
*/
|
||||||
|
void concat_lists (const char* label, struct data_string* list1,
|
||||||
|
struct data_string* list2, const char *refbuf, size_t reflen)
|
||||||
|
{
|
||||||
|
struct data_string result;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
memset (&result, 0x00, sizeof(struct data_string));
|
||||||
|
rc = concat_dclists (&result, list1, list2);
|
||||||
|
ATF_REQUIRE_MSG((rc >= 0), "%s concat_dclists call failed %d",
|
||||||
|
label, rc);
|
||||||
|
|
||||||
|
ATF_REQUIRE_MSG(result.len == reflen, "%s result len: %d incorrect",
|
||||||
|
label, result.len);
|
||||||
|
|
||||||
|
if (refbuf != NULL) {
|
||||||
|
ATF_REQUIRE_MSG((memcmp(result.data, refbuf, reflen) == 0),
|
||||||
|
"%s content is incorrect", label);
|
||||||
|
}
|
||||||
|
|
||||||
|
data_string_forget(&result, MDL);
|
||||||
|
}
|
||||||
|
|
||||||
ATF_TP_ADD_TCS(tp)
|
ATF_TP_ADD_TCS(tp)
|
||||||
{
|
{
|
||||||
ATF_TP_ADD_TC(tp, MRns_name_list_funcs);
|
ATF_TP_ADD_TC(tp, MRns_name_list_funcs);
|
||||||
|
ATF_TP_ADD_TC(tp, concat_dclists);
|
||||||
|
|
||||||
return (atf_no_error());
|
return (atf_no_error());
|
||||||
}
|
}
|
||||||
|
@@ -4175,7 +4175,7 @@ int concat_dclists (struct data_string* result,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* If not empty, uncompress first list into the uncompressed buffer */
|
/* If not empty, uncompress first list into the uncompressed buffer */
|
||||||
if ((list1->data) && (list1->len)) {
|
if (list1 && (list1->data) && (list1->len)) {
|
||||||
list_len = MRns_name_uncompress_list(list1->data,
|
list_len = MRns_name_uncompress_list(list1->data,
|
||||||
list1->len, uncomp,
|
list1->len, uncomp,
|
||||||
sizeof(uncompbuf));
|
sizeof(uncompbuf));
|
||||||
@@ -4190,7 +4190,7 @@ int concat_dclists (struct data_string* result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If not empty, uncompress second list into the uncompressed buffer */
|
/* If not empty, uncompress second list into the uncompressed buffer */
|
||||||
if ((list2->data) && (list2->len)) {
|
if (list2 && (list2->data) && (list2->len)) {
|
||||||
/* If first list wasn't empty, add a comma */
|
/* If first list wasn't empty, add a comma */
|
||||||
if (uncomp_len > 0) {
|
if (uncomp_len > 0) {
|
||||||
*uncomp++ = ',';
|
*uncomp++ = ',';
|
||||||
|
Reference in New Issue
Block a user