* Added valgrind memory leak tests in testmem.sh for restconf
* Added clicon_socket_set() and clicon_socket_get() functions for cleaning up backend server and restconf FCGI socket on termination. * Removed obsolete `-x` command-line option to clixon_cli.
This commit is contained in:
parent
28bd698968
commit
6e63f0a77b
29 changed files with 193 additions and 131 deletions
|
|
@ -111,6 +111,7 @@
|
|||
* Many hand-crafted validation messages have been removed and replaced with generic validations, which may lead to changed rpc-error messages.
|
||||
* CLICON_XML_SORT option (in clixon-config.yang) has been removed and set to true permanently. Unsorted XML lists leads to slower performance and old obsolete code can be removed.
|
||||
* Strict namespace setting can be a problem when upgrading existing database files, such as startup-db or persistent running-db, or any other saved XML file.
|
||||
* Removed obsolete `-x` command-line option to clixon_cli.
|
||||
* Removed `delete-config` support for candidate db since it is not supported in RFC6241.
|
||||
* Switched the order of `error-type` and `error-tag` in all netconf and restconf error messages to comply to RFC order.
|
||||
* XML namespace handling is corrected (see major changes)
|
||||
|
|
@ -129,14 +130,15 @@
|
|||
* `<!DOCTYPE` (ie DTD) is not supported.
|
||||
* Added Clixon example full system docker container, see [docker/system](docker/system).
|
||||
* Moved datastore/text/ code to datastore/ since there is only one type of datastore.
|
||||
* Added clicon_socket_set() and clicon_socket_get() functions for cleaning up backend server and restconf FCGI socket on termination.
|
||||
* Changed clixon base system container to use Alpine [docker/base](docker/base).
|
||||
* clixon-config YAML file has new revision: 2019-02-06.
|
||||
* Added new log function: `clicon_log_xml()` for logging XML tree
|
||||
* Replaced all calls to (obsolete) `cli_output` with `fprintf`
|
||||
* Added _experimental_ config option `CLICON_CLI_UTF8` default set to 0.
|
||||
* CLIgen UTF8 does not work with scrolling and control editing
|
||||
* Added valgrind memory leak tests in testmem.sh for cli, netconf and backend
|
||||
* remains: restconf
|
||||
* Added valgrind memory leak tests in testmem.sh for cli, netconf, restconf and backend
|
||||
* To run with backend for example: `mem.sh backend`
|
||||
* Added `make test` from top-level Makefile
|
||||
* Added `xml_rootchild_node()` lib function as variant of `xml_rootchild()`
|
||||
* Added -o "<option>=<value>" command-line option to all programs: backend, cli, netconf, restconf.
|
||||
|
|
|
|||
|
|
@ -77,7 +77,10 @@
|
|||
|
||||
#define BACKEND_LOGFILE "/usr/local/var/clixon_backend.log"
|
||||
|
||||
/*! Terminate. Cannot use h after this */
|
||||
/*! Clean and close all state of backend (but dont exit).
|
||||
* Cannot use h after this
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
static int
|
||||
backend_terminate(clicon_handle h)
|
||||
{
|
||||
|
|
@ -87,8 +90,11 @@ backend_terminate(clicon_handle h)
|
|||
char *sockpath = clicon_sock(h);
|
||||
cxobj *x;
|
||||
struct stat st;
|
||||
int ss;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
if ((ss = clicon_socket_get(h)) != -1)
|
||||
close(ss);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
|
|
@ -931,10 +937,11 @@ main(int argc,
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* Initialize server socket */
|
||||
/* Initialize server socket and save it to handle */
|
||||
if ((ss = backend_server_socket(h)) < 0)
|
||||
goto done;
|
||||
|
||||
if (clicon_socket_set(h, ss) < 0)
|
||||
goto done;
|
||||
if (debug)
|
||||
clicon_option_dump(h, debug);
|
||||
|
||||
|
|
@ -945,8 +952,6 @@ main(int argc,
|
|||
retval = 0;
|
||||
done:
|
||||
clicon_log(LOG_NOTICE, "%s: %u Terminated retval:%d", __PROGRAM__, getpid(), retval);
|
||||
if (ss != -1)
|
||||
close(ss);
|
||||
backend_terminate(h); /* Cannot use h after this */
|
||||
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ struct cli_handle {
|
|||
/* ------ end of common handle ------ */
|
||||
|
||||
cligen_handle cl_cligen; /* cligen handle */
|
||||
cli_syntax_t *cl_stx; /* syntax structure */
|
||||
cli_syntax_t *cl_stx; /* CLI syntax structure */
|
||||
};
|
||||
|
||||
/*! Return a clicon handle for other CLICON API calls
|
||||
|
|
|
|||
|
|
@ -71,11 +71,12 @@
|
|||
#include "cli_handle.h"
|
||||
|
||||
/* Command line options to be passed to getopt(3) */
|
||||
#define CLI_OPTS "hD:f:xl:F:1a:u:d:m:qp:GLy:c:U:o:"
|
||||
#define CLI_OPTS "hD:f:l:F:1a:u:d:m:qp:GLy:c:U:o:"
|
||||
|
||||
#define CLI_LOGFILE "/tmp/clixon_cli.log"
|
||||
|
||||
/*! terminate cli application */
|
||||
/*! Clean and close all state of cli process (but dont exit).
|
||||
* Cannot use h after this
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
static int
|
||||
cli_terminate(clicon_handle h)
|
||||
{
|
||||
|
|
@ -144,63 +145,6 @@ cli_interactive(clicon_handle h)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Read file as configuration file and print xml file for migrating to new fmt
|
||||
* @see clicon_option_readfile_xml
|
||||
*/
|
||||
static int
|
||||
dump_configfile_xml_fn(FILE *fout,
|
||||
const char *filename)
|
||||
{
|
||||
struct stat st;
|
||||
char opt[1024];
|
||||
char val[1024];
|
||||
char line[1024];
|
||||
char *cp;
|
||||
FILE *f = NULL;
|
||||
int retval = -1;
|
||||
char *suffix;
|
||||
|
||||
if (filename == NULL || !strlen(filename)){
|
||||
clicon_err(OE_UNIX, 0, "Not specified");
|
||||
goto done;
|
||||
}
|
||||
if ((suffix = rindex(filename, '.')) != NULL &&
|
||||
strcmp((suffix+1), "xml") == 0){
|
||||
clicon_err(OE_CFG, 0, "Configfile %s should not be XML", filename);
|
||||
goto done;
|
||||
}
|
||||
if (stat(filename, &st) < 0){
|
||||
clicon_err(OE_UNIX, errno, "%s", filename);
|
||||
goto done;
|
||||
}
|
||||
if (!S_ISREG(st.st_mode)){
|
||||
clicon_err(OE_UNIX, 0, "%s is not a regular file", filename);
|
||||
goto done;
|
||||
}
|
||||
if ((f = fopen(filename, "r")) == NULL) {
|
||||
clicon_err(OE_UNIX, errno, "configure file: %s", filename);
|
||||
return -1;
|
||||
}
|
||||
clicon_debug(2, "%s: Reading config file %s", __FUNCTION__, filename);
|
||||
fprintf(fout, "<config>\n");
|
||||
while (fgets(line, sizeof(line), f)) {
|
||||
if ((cp = strchr(line, '\n')) != NULL) /* strip last \n */
|
||||
*cp = '\0';
|
||||
/* Trim out comments, strip whitespace, and remove CR */
|
||||
if ((cp = strchr(line, '#')) != NULL)
|
||||
memcpy(cp, "\n", 2);
|
||||
if (sscanf(line, "%s %s", opt, val) < 2)
|
||||
continue;
|
||||
fprintf(fout, "\t<%s>%s</%s>\n", opt, val, opt);
|
||||
}
|
||||
fprintf(fout, "</config>\n");
|
||||
retval = 0;
|
||||
done:
|
||||
if (f)
|
||||
fclose(f);
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
usage(clicon_handle h,
|
||||
char *argv0)
|
||||
|
|
@ -213,7 +157,6 @@ usage(clicon_handle h,
|
|||
"\t-h \t\tHelp\n"
|
||||
"\t-D <level> \tDebug level\n"
|
||||
"\t-f <file> \tConfig-file (mandatory)\n"
|
||||
"\t-x\t\tDump configuration file as XML on stdout (migration utility)\n"
|
||||
"\t-F <file> \tRead commands from file (default stdin)\n"
|
||||
"\t-1\t\tDo not enter interactive mode\n"
|
||||
"\t-a UNIX|IPv4|IPv6\tInternal backend socket family\n"
|
||||
|
|
@ -251,7 +194,6 @@ main(int argc, char **argv)
|
|||
int help = 0;
|
||||
int logdst = CLICON_LOG_STDERR;
|
||||
char *restarg = NULL; /* what remains after options */
|
||||
int dump_configfile_xml = 0;
|
||||
yang_spec *yspec;
|
||||
yang_spec *yspecfg = NULL; /* For config XXX clixon bug */
|
||||
struct passwd *pw;
|
||||
|
|
@ -265,6 +207,7 @@ main(int argc, char **argv)
|
|||
/* Initiate CLICON handle */
|
||||
if ((h = cli_handle_init()) == NULL)
|
||||
goto done;
|
||||
|
||||
/* Set username to clicon handle. Use in all communication to backend
|
||||
* Note, can be overridden by -U
|
||||
*/
|
||||
|
|
@ -301,9 +244,6 @@ main(int argc, char **argv)
|
|||
usage(h, argv[0]);
|
||||
clicon_option_str_set(h, "CLICON_CONFIGFILE", optarg);
|
||||
break;
|
||||
case 'x': /* dump config file as xml (migration from .conf file)*/
|
||||
dump_configfile_xml++;
|
||||
break;
|
||||
case 'l': /* Log destination: s|e|o|f */
|
||||
if ((logdst = clicon_log_opt(optarg[0])) < 0)
|
||||
usage(h, argv[0]);
|
||||
|
|
@ -320,14 +260,6 @@ main(int argc, char **argv)
|
|||
|
||||
clicon_debug_init(debug, NULL);
|
||||
|
||||
/* Use cli as util tool to dump config file as xml for migration */
|
||||
if (dump_configfile_xml) {
|
||||
clicon_hash_t *copt = clicon_options(h);
|
||||
char *configfile = hash_value(copt, "CLICON_CONFIGFILE", NULL);
|
||||
if (dump_configfile_xml_fn(stdout, configfile) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Create top-level yang spec and store as option */
|
||||
if ((yspecfg = yspec_new()) == NULL)
|
||||
goto done;
|
||||
|
|
@ -345,7 +277,6 @@ main(int argc, char **argv)
|
|||
switch (c) {
|
||||
case 'D' : /* debug */
|
||||
case 'f': /* config file */
|
||||
case 'x': /* dump config file as xml */
|
||||
case 'l': /* Log destination */
|
||||
break; /* see above */
|
||||
case 'F': /* read commands from file */
|
||||
|
|
|
|||
|
|
@ -283,6 +283,10 @@ send_hello(clicon_handle h,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Clean and close all state of netconf process (but dont exit).
|
||||
* Cannot use h after this
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
static int
|
||||
netconf_terminate(clicon_handle h)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -471,12 +471,20 @@ api_return_err(clicon_handle h,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Clean and close all state of restconf process (but dont exit).
|
||||
* Cannot use h after this
|
||||
* @param[in] h Clixon handle
|
||||
*/
|
||||
int
|
||||
restconf_terminate(clicon_handle h)
|
||||
{
|
||||
yang_spec *yspec;
|
||||
cxobj *x;
|
||||
int fs; /* fgcx socket */
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
if ((fs = clicon_socket_get(h)) != -1)
|
||||
close(fs);
|
||||
clixon_plugin_exit(h);
|
||||
rpc_callback_delete_all();
|
||||
clicon_rpc_close_session(h);
|
||||
|
|
@ -490,3 +498,4 @@ restconf_terminate(clicon_handle h)
|
|||
clicon_log_exit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -694,6 +694,8 @@ main(int argc,
|
|||
clicon_err(OE_CFG, errno, "FCGX_OpenSocket");
|
||||
goto done;
|
||||
}
|
||||
if (clicon_socket_set(h, sock) < 0)
|
||||
goto done;
|
||||
/* umask settings may interfer: we want group to write: this is 774 */
|
||||
if (chmod(sockpath, S_IRWXU|S_IRWXG|S_IROTH) < 0){
|
||||
clicon_err(OE_UNIX, errno, "chmod");
|
||||
|
|
|
|||
|
|
@ -44,23 +44,38 @@ SUBDIRS = base
|
|||
SUBDIRS += system
|
||||
#SUBDIRS += cluster
|
||||
|
||||
.PHONY: all clean distclean depend install-include install uninstall test
|
||||
.PHONY: all clean distclean depend install-include install uninstall test $(SUBDIRS)
|
||||
|
||||
all: $(SUBDIRS)
|
||||
|
||||
$(SUBDIRS):
|
||||
(cd $@; $(MAKE) $(MFLAGS) all)
|
||||
|
||||
clean:
|
||||
for i in $(SUBDIRS); \
|
||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile *~ .depend
|
||||
for i in $(SUBDIRS); \
|
||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
||||
|
||||
test:
|
||||
(cd system && $(MAKE) $(MFLAGS) test)
|
||||
for i in $(SUBDIRS); \
|
||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
||||
|
||||
depend:
|
||||
for i in $(SUBDIRS); \
|
||||
do (cd $$i; $(MAKE) $(MFLAGS) $@); done
|
||||
|
||||
install-include:
|
||||
for i in $(SUBDIRS); \
|
||||
do (cd $$i && $(MAKE) $(MFLAGS) $@||exit 1); done;
|
||||
|
||||
install:
|
||||
for i in $(SUBDIRS); \
|
||||
do (cd $$i && $(MAKE) $(MFLAGS) $@)||exit 1; done
|
||||
|
||||
uninstall:
|
||||
|
||||
for i in $(SUBDIRS); \
|
||||
do (cd $$i; $(MAKE) $(MFLAGS) $@)||exit 1; done
|
||||
|
|
|
|||
|
|
@ -198,4 +198,8 @@ int clicon_xmldb_handle_set(clicon_handle h, void *xh);
|
|||
char *clicon_username_get(clicon_handle h);
|
||||
int clicon_username_set(clicon_handle h, void *username);
|
||||
|
||||
/* Set and get socket fd (ie backend server socket / restconf fcgx socket */
|
||||
int clicon_socket_get(clicon_handle h);
|
||||
int clicon_socket_set(clicon_handle h, int s);
|
||||
|
||||
#endif /* _CLIXON_OPTIONS_H_ */
|
||||
|
|
|
|||
|
|
@ -66,6 +66,17 @@
|
|||
* @note If you change here, you must also change the structs below:
|
||||
* @see struct cli_handle
|
||||
* @see struct backend_handle
|
||||
* This is the internal definition of a "Clixon handle" which in its external
|
||||
* form is "clicon_handle" and is used in most Clixon API calls.
|
||||
* Some details:
|
||||
* 1) the internal structure contains a header (defined here) whereas higher
|
||||
* order libs (eg cli and backend) introduce more fields appended to this
|
||||
* struct.
|
||||
* 2) ch_options accessed via clicon_data() are clixon config options are
|
||||
* string values appearing in the XML configfile accessed with -f.
|
||||
* Alternatively, these could be accessed via clicon_conf_xml()
|
||||
* 3) ch_data accessed via clicon_data() is more general purpose for any data.
|
||||
* that is, not only strings. And has separate namespace from options.
|
||||
*/
|
||||
struct clicon_handle {
|
||||
int ch_magic; /* magic (HDR) */
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ hash_value(clicon_hash_t *hash,
|
|||
*
|
||||
* @param[in] hash Hash table
|
||||
* @param[in] key Variable name
|
||||
* @param[in] val Variable value
|
||||
* @param[in] val Variable value (pointer to)
|
||||
* @param[in] vlen Length of variable value
|
||||
* @retval variable New hash structure on success
|
||||
* @retval NULL Failure
|
||||
|
|
|
|||
|
|
@ -224,7 +224,6 @@ json_str_escape_cdata(cbuf *cb,
|
|||
char *str)
|
||||
{
|
||||
int retval = -1;
|
||||
char *snew = NULL;
|
||||
int i;
|
||||
int esc = 0; /* cdata escape */
|
||||
|
||||
|
|
@ -261,12 +260,8 @@ json_str_escape_cdata(cbuf *cb,
|
|||
cprintf(cb, "%c", str[i]);
|
||||
break;
|
||||
}
|
||||
if ((snew = strdup(cbuf_get(cb))) ==NULL){
|
||||
clicon_err(OE_XML, errno, "strdup");
|
||||
goto done;
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
// done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,12 @@
|
|||
***** END LICENSE BLOCK *****
|
||||
|
||||
*
|
||||
* CLICON options
|
||||
* This file contains access functions for two types of clixon vars:
|
||||
* - options, ie string based variables from Clixon configuration files.
|
||||
* Accessed with clicon_options(h).
|
||||
* - data. Free-typed values for runtime getting and setting.
|
||||
* Accessed with clicon_data(h).
|
||||
* Consider splitting?
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "clixon_config.h" /* generated by config & autoconf */
|
||||
|
|
@ -359,6 +364,8 @@ clicon_option_str(clicon_handle h,
|
|||
* @param[in] h clicon_handle
|
||||
* @param[in] name option name
|
||||
* @param[in] val option value, must be null-terminated string
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
clicon_option_str_set(clicon_handle h,
|
||||
|
|
@ -883,3 +890,35 @@ clicon_username_set(clicon_handle h,
|
|||
}
|
||||
|
||||
|
||||
/*! Get socket fd (ie backend server socket / restconf fcgx socket)
|
||||
* @param[in] h Clicon handle
|
||||
* @retval -1 No open socket
|
||||
* @retval s Socket
|
||||
*/
|
||||
int
|
||||
clicon_socket_get(clicon_handle h)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
void *p;
|
||||
|
||||
if ((p = hash_value(cdat, "socket", NULL)) == NULL)
|
||||
return -1;
|
||||
return *(int*)p;
|
||||
}
|
||||
|
||||
/*! Set socket fd (ie backend server socket / restconf fcgx socket)
|
||||
* @param[in] h Clicon handle
|
||||
* @param[in] s Open socket (or -1 to close)
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
*/
|
||||
int
|
||||
clicon_socket_set(clicon_handle h,
|
||||
int s)
|
||||
{
|
||||
clicon_hash_t *cdat = clicon_data(h);
|
||||
|
||||
if (s == -1)
|
||||
return hash_del(cdat, "socket");
|
||||
return hash_add(cdat, "socket", &s, sizeof(int))==NULL?-1:0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ These tests use valgrind to check for memory leaks:
|
|||
mem.sh cli
|
||||
mem.sh netconf
|
||||
mem.sh backend
|
||||
# mem.sh restconf # NYI
|
||||
mem.sh restconf
|
||||
```
|
||||
|
||||
## Site.sh
|
||||
|
|
|
|||
25
test/lib.sh
25
test/lib.sh
|
|
@ -52,8 +52,9 @@ testname=
|
|||
#
|
||||
: ${valgrindtest=0}
|
||||
|
||||
# Valgrind log file. This is usually removed automatically
|
||||
: ${valgrindfile=$(mktemp)}
|
||||
# Valgrind log file. This should be removed automatically. Note that mktemp
|
||||
# actually creates a file so do not call it by default
|
||||
#: ${valgrindfile=$(mktemp)}
|
||||
|
||||
# If set to 0, override starting of clixon_backend in test (you bring your own)
|
||||
: ${BE:=1}
|
||||
|
|
@ -135,9 +136,9 @@ start_backend(){
|
|||
if [ $valgrindtest -eq 2 ]; then
|
||||
# Start in background since daemon version creates two traces: parent,
|
||||
# child. If background then only the single relevant.
|
||||
sudo $clixon_backend -F $* -D $DBG &
|
||||
sudo $clixon_backend -F -D $DBG $* &
|
||||
else
|
||||
sudo $clixon_backend $* -D $DBG
|
||||
sudo $clixon_backend -D $DBG $*
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
|
|
@ -155,6 +156,22 @@ stop_backend(){
|
|||
fi
|
||||
}
|
||||
|
||||
start_restconf(){
|
||||
# Start in background
|
||||
sudo su -c "$clixon_restconf $RCLOG -D $DBG $*" -s /bin/sh www-data &
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
}
|
||||
|
||||
stop_restconf(){
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
if [ $valgrindtest -eq 3 ]; then
|
||||
sleep 1
|
||||
checkvalgrind
|
||||
fi
|
||||
}
|
||||
|
||||
# Increment test number and print a nice string
|
||||
new(){
|
||||
if [ $valgrindtest -eq 1 ]; then
|
||||
|
|
|
|||
15
test/mem.sh
15
test/mem.sh
|
|
@ -15,12 +15,12 @@ case "$PROGRAM" in
|
|||
'cli')
|
||||
valgrindtest=1
|
||||
RCWAIT=1
|
||||
clixon_cli="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_cli"
|
||||
clixon_cli="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_cli"
|
||||
;;
|
||||
'netconf')
|
||||
valgrindtest=1
|
||||
RCWAIT=1
|
||||
clixon_netconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_netconf"
|
||||
clixon_netconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile clixon_netconf"
|
||||
;;
|
||||
'backend')
|
||||
valgrindtest=2 # This means backend valgrind test
|
||||
|
|
@ -28,10 +28,19 @@ case "$PROGRAM" in
|
|||
perfnr=100 # test_perf.sh restconf put more or less stops
|
||||
perfreq=10
|
||||
|
||||
clixon_backend="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./clixon.supp --track-fds=yes --trace-children=yes --log-file=$valgrindfile clixon_backend"
|
||||
clixon_backend="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=yes --log-file=$valgrindfile clixon_backend"
|
||||
;;
|
||||
'restconf')
|
||||
valgrindtest=3 # This means backend valgrind test
|
||||
sudo chmod 660 $valgrindfile
|
||||
sudo chown www-data $valgrindfile
|
||||
RCWAIT=5 # valgrind restconf needs some time to get up
|
||||
clixon_restconf="/usr/bin/valgrind --leak-check=full --show-leak-kinds=all --suppressions=./valgrind-clixon.supp --track-fds=yes --trace-children=no --child-silent-after-fork=yes --log-file=$valgrindfile /www-data/clixon_restconf"
|
||||
|
||||
;;
|
||||
*)
|
||||
echo "usage: $0 cli|netconf|restconf|backend" # valgrind memleak checks
|
||||
rm -f $valgrindfile
|
||||
exit -1
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ new "kill old restconf daemon"
|
|||
sudo pkill -u www-data clixon_restconf
|
||||
|
||||
new "start restconf daemon"
|
||||
sudo su -c "$clixon_restconf -f $RCLOG $cfg -y $fyang -D $DBG" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg -y $fyang
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -194,7 +194,7 @@ new "netconf validate mandatory"
|
|||
expecteof "$clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
|||
|
||||
sleep 1
|
||||
new "start restconf daemon (-a is enable basic authentication)"
|
||||
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg -- -a
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -178,7 +178,7 @@ new "guest edit nacm"
|
|||
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"nacm-example:x": 3}' http://localhost/restconf/data/nacm-example:x)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "access denied"}}}
'
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ new "kill old restconf daemon"
|
|||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
|
||||
new "start restconf daemon (-a is enable http basic auth)"
|
||||
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg -- -a
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -207,7 +207,7 @@ new "cli rpc as guest"
|
|||
expectfn "$clixon_cli -1 -U guest -l o -f $cfg rpc ipv4" 255 "protocol access-denied access denied"
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
|||
|
||||
sleep 1
|
||||
new "start restconf daemon (-a is enable basic authentication)"
|
||||
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg -- -a
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -272,7 +272,8 @@ expecteq "$(curl -u guest:bar -sS -X GET http://localhost/restconf/data/clixon-e
|
|||
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
|||
|
||||
sleep 1
|
||||
new "start restconf daemon (-a is enable basic authentication)"
|
||||
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg -- -a
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -254,7 +254,7 @@ new "default delete list deny"
|
|||
expecteq "$(curl -u wilma:bar -sS -X DELETE http://localhost/restconf/data/clixon-example:translate=key42)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "default deny"}}}
'
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
|||
|
||||
sleep 1
|
||||
new "start restconf daemon (-a is enable basic authentication)"
|
||||
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg -- -a
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -216,7 +216,7 @@ new "permit-edit-config: guest fail restconf"
|
|||
expecteq "$(curl -u guest:bar -sS -X PUT -d '{"nacm-example:x": 2}' http://localhost/restconf/data/nacm-example:x)" 0 '{"ietf-restconf:errors" : {"error": {"error-type": "application","error-tag": "access-denied","error-severity": "error","error-message": "default deny"}}}
'
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ new "kill old restconf daemon"
|
|||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
|
||||
new "start restconf daemon"
|
||||
sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg -y $fyang
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -169,7 +169,7 @@ new "netconf get large leaf-list config"
|
|||
expecteof "/usr/bin/time -f %e $clixon_netconf -qf $cfg -y $fyang" 0 "<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>" '^<rpc-reply><data><x xmlns="urn:example:clixon"><c>0</c><c>1</c>'
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ new "kill old restconf daemon"
|
|||
sudo pkill -u www-data clixon_restconf
|
||||
|
||||
new "start restconf daemon"
|
||||
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -265,7 +265,7 @@ if [ -z "$match" ]; then
|
|||
fi
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ new "kill old restconf daemon"
|
|||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
|
||||
new "start restconf daemon"
|
||||
sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg -y $fyang
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -182,7 +182,7 @@ new "restconf POST type x3"
|
|||
expectfn 'curl -s -X GET http://localhost/restconf/data/example:types' 0 '{"example:types": {"tint": 42,"tdec64": 42.123,"tbool": false,"tstr": "str"}}'
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ new "kill old restconf daemon"
|
|||
sudo pkill -u www-data clixon_restconf
|
||||
|
||||
new "start restconf daemon"
|
||||
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -149,7 +149,7 @@ new "netconf edit-config missing config should fail"
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc><edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><target><candidate/></target></edit-config></rpc>]]>]]>' '^<rpc-reply><rpc-error><error-type>application</error-type><error-tag>data-missing</error-tag><error-app-tag>missing-choice</error-app-tag><error-info><missing-choice>edit-content</missing-choice></error-info><error-severity>error</error-severity></rpc-error></rpc-reply>]]>]]>$'
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ new "kill old restconf daemon"
|
|||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
|
||||
new "start restconf daemon"
|
||||
sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg -y $fyang
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
|
@ -274,7 +274,7 @@ echo "Eg: curl -H \"Accept: text/event-stream\" -s -X GET http://localhost/sub/E
|
|||
#-----------------
|
||||
sleep 5
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -82,7 +82,10 @@ new "kill old restconf daemon"
|
|||
sudo pkill -u www-data clixon_restconf
|
||||
|
||||
new "start restconf daemon"
|
||||
sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data &
|
||||
start_restconf -f $cfg
|
||||
|
||||
new "waiting"
|
||||
sleep $RCWAIT
|
||||
|
||||
new "netconf set x in example1"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config><target><candidate/></target><config><x xmlns="urn:example:clixon1">42</x></config></edit-config></rpc>]]>]]>' '^<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>]]>]]>$'
|
||||
|
|
@ -128,7 +131,7 @@ if [ -z "$match" ]; then
|
|||
fi
|
||||
|
||||
new "Kill restconf daemon"
|
||||
sudo pkill -u www-data -f "/www-data/clixon_restconf"
|
||||
stop_restconf
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
supp2
|
||||
supp1
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:*
|
||||
fun:_dl_new_object
|
||||
}
|
||||
{
|
||||
supp3
|
||||
supp2
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:*
|
||||
|
|
@ -14,16 +14,31 @@
|
|||
fun:expand_dynamic_string_token
|
||||
}
|
||||
{
|
||||
supp44
|
||||
supp3
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:*
|
||||
fun:_dlerror_run
|
||||
}
|
||||
{
|
||||
supp5
|
||||
supp4
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:*
|
||||
fun:_dl_check_map_versions
|
||||
}
|
||||
{
|
||||
supp5
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:*
|
||||
fun:*
|
||||
fun:_dl_map_object
|
||||
}
|
||||
{
|
||||
supp6-fcgi
|
||||
Memcheck:Leak
|
||||
match-leak-kinds: reachable
|
||||
fun:*
|
||||
fun:OS_LibInit
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue