diff --git a/docker/main/README.md b/docker/main/README.md index 61febc54..0bb56c1a 100644 --- a/docker/main/README.md +++ b/docker/main/README.md @@ -12,6 +12,11 @@ The directory contains the following files: start.sh Start containers startsystem.sh Internal start script copied to inside the container (dont run from shell) +How to run the tests: +``` + $ make test +``` + How to build and start the container (called clixon-system): ``` $ make docker @@ -60,4 +65,4 @@ You trigger the test scripts inside the container using `make test`. If you want to edit clixon code so it runs in the container? You either (1) "persistent": make your changes in the actual clixon code and commit; make clean to remove the local clone; make test again -(2) "volatile" edit the local clone; make test. \ No newline at end of file +(2) "volatile" edit the local clone, (in the subdir); `make test`. diff --git a/lib/src/clixon_string.c b/lib/src/clixon_string.c index be722930..111ef2f6 100644 --- a/lib/src/clixon_string.c +++ b/lib/src/clixon_string.c @@ -696,8 +696,8 @@ clixon_trim(char *str) * @param[in] s1 String 1 * @param[in] s2 String 2 * @retval 0 Equal - * @retval -1 Not equal - * @retval 1 Not equal + * @retval <0 s1 is less than s2 + * @retval >0 s1 is greater than s2 */ int clicon_strcmp(char *s1, diff --git a/lib/src/clixon_xml_map.c b/lib/src/clixon_xml_map.c index 9d1e2f3a..ae84d09e 100644 --- a/lib/src/clixon_xml_map.c +++ b/lib/src/clixon_xml_map.c @@ -972,7 +972,9 @@ xml_spec_populate(cxobj *x, if (xml2ns(x, xml_prefix(x), &ns) < 0) goto done; if (xp && (yparent = xml_spec(xp)) != NULL){ +#ifdef DEBUG clicon_debug(1, "%s yang parent:%s", __FUNCTION__, yang_argument_get(yparent)); +#endif y = yang_find_datanode(yparent, name); } else if (yspec){ /* XXX this gives false positives */ diff --git a/util/clixon_util_path.c b/util/clixon_util_path.c index b1028f6f..084b9d94 100644 --- a/util/clixon_util_path.c +++ b/util/clixon_util_path.c @@ -219,14 +219,9 @@ main(int argc, /* Populate */ if (xml_apply0(x1, CX_ELMNT, xml_spec_populate, yspec) < 0) goto done; - /* Sort */ - if (xml_apply0(x1, CX_ELMNT, xml_sort, h) < 0) - goto done; /* Add default values */ if (xml_apply(x1, CX_ELMNT, xml_default, h) < 0) goto done; - if (xml_apply0(x1, -1, xml_sort_verify, h) < 0) - clicon_log(LOG_NOTICE, "%s: sort verify failed", __FUNCTION__); if ((ret = xml_yang_validate_all_top(h, x1, &xerr)) < 0) goto done; if (ret > 0 && (ret = xml_yang_validate_add(h, x1, &xerr)) < 0) @@ -242,6 +237,10 @@ main(int argc, goto done; } } + if (xml_apply0(x, CX_ELMNT, xml_sort, h) < 0) + goto done; + if (xml_apply0(x, -1, xml_sort_verify, h) < 0) + clicon_log(LOG_NOTICE, "%s: sort verify failed", __FUNCTION__); } if (api_path_p){ if ((ret = clixon_xml_find_api_path(x, yspec, &xvec, &xlen, "%s", path)) < 0) @@ -264,6 +263,8 @@ main(int argc, } retval = 0; done: + if (yspec != NULL) + yspec_free(yspec); if (cb) cbuf_free(cb); if (xvec) @@ -272,7 +273,11 @@ main(int argc, free(buf); if (x) xml_free(x); + if (xcfg) + xml_free(xcfg); if (fd > 0) close(fd); + if (h) + clicon_handle_exit(h); return retval; } diff --git a/util/clixon_util_xml.c b/util/clixon_util_xml.c index 025a5ede..b6b84201 100644 --- a/util/clixon_util_xml.c +++ b/util/clixon_util_xml.c @@ -120,8 +120,6 @@ main(int argc, goto done; if (clicon_conf_xml_set(h, xcfg) < 0) goto done; - - xcfg = xml_new("clixon-config", NULL, NULL); clicon_conf_xml_set(h, xcfg); optind = 1; @@ -264,6 +262,8 @@ main(int argc, done: if (cbret) cbuf_free(cbret); + if (xcfg) + xml_free(xcfg); if (xt) xml_free(xt); if (cb) diff --git a/util/clixon_util_xpath.c b/util/clixon_util_xpath.c index 85e71b90..4c1bdd9d 100644 --- a/util/clixon_util_xpath.c +++ b/util/clixon_util_xpath.c @@ -355,6 +355,8 @@ main(int argc, xml_nsctx_free(nsc); if (xc) ctx_free(xc); + if (xcfg) + xml_free(xcfg); if (xv) free(xv); if (buf)