Added util directory containing test applications
This commit is contained in:
parent
cc6c7ae7a4
commit
c71791f168
16 changed files with 130 additions and 32 deletions
|
|
@ -23,7 +23,7 @@
|
||||||
### Minor changes:
|
### Minor changes:
|
||||||
* Added systemd example files under example/systemd
|
* Added systemd example files under example/systemd
|
||||||
* Changed `plugin_init()` backend return semantics: If returns NULL, _without_ calling clicon_err(), the module is disabled.
|
* Changed `plugin_init()` backend return semantics: If returns NULL, _without_ calling clicon_err(), the module is disabled.
|
||||||
* Dedicated standalone xml,json,yang and xpath parser utility test programs added under lib/src/.
|
* Added util subdir, with dedicated standalone xml,json,yang and xpath parser utility test programs.
|
||||||
* CDATA xml support (patch by David Cornejo, Netgate)
|
* CDATA xml support (patch by David Cornejo, Netgate)
|
||||||
* Encode and decode (parsing) support
|
* Encode and decode (parsing) support
|
||||||
* Validation of yang bits type space-separated list value
|
* Validation of yang bits type space-separated list value
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ INSTALL = @INSTALL@
|
||||||
INCLUDES = -I. -I@srcdir@ @INCLUDES@
|
INCLUDES = -I. -I@srcdir@ @INCLUDES@
|
||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
|
|
||||||
SUBDIRS = lib apps include etc datastore yang
|
SUBDIRS = lib apps include etc datastore util yang
|
||||||
|
|
||||||
.PHONY: doc all clean depend $(SUBDIRS) install loc TAGS .config.status docker
|
.PHONY: doc all clean depend $(SUBDIRS) install loc TAGS .config.status docker
|
||||||
|
|
||||||
|
|
|
||||||
3
configure
vendored
3
configure
vendored
|
|
@ -4325,7 +4325,7 @@ _ACEOF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile lib/Makefile lib/src/Makefile lib/clixon/Makefile apps/Makefile apps/cli/Makefile apps/backend/Makefile apps/netconf/Makefile apps/restconf/Makefile include/Makefile etc/Makefile etc/clixonrc example/Makefile example/docker/Makefile extras/rpm/Makefile docker/Makefile docker/cli/Makefile docker/cli/Dockerfile docker/backend/Makefile docker/backend/Dockerfile docker/netconf/Makefile docker/netconf/Dockerfile datastore/Makefile datastore/text/Makefile yang/Makefile doc/Makefile"
|
ac_config_files="$ac_config_files Makefile lib/Makefile lib/src/Makefile lib/clixon/Makefile apps/Makefile apps/cli/Makefile apps/backend/Makefile apps/netconf/Makefile apps/restconf/Makefile include/Makefile etc/Makefile etc/clixonrc example/Makefile example/docker/Makefile extras/rpm/Makefile docker/Makefile docker/cli/Makefile docker/cli/Dockerfile docker/backend/Makefile docker/backend/Dockerfile docker/netconf/Makefile docker/netconf/Dockerfile datastore/Makefile datastore/text/Makefile util/Makefile yang/Makefile doc/Makefile"
|
||||||
|
|
||||||
cat >confcache <<\_ACEOF
|
cat >confcache <<\_ACEOF
|
||||||
# This file is a shell script that caches the results of configure
|
# This file is a shell script that caches the results of configure
|
||||||
|
|
@ -5043,6 +5043,7 @@ do
|
||||||
"docker/netconf/Dockerfile") CONFIG_FILES="$CONFIG_FILES docker/netconf/Dockerfile" ;;
|
"docker/netconf/Dockerfile") CONFIG_FILES="$CONFIG_FILES docker/netconf/Dockerfile" ;;
|
||||||
"datastore/Makefile") CONFIG_FILES="$CONFIG_FILES datastore/Makefile" ;;
|
"datastore/Makefile") CONFIG_FILES="$CONFIG_FILES datastore/Makefile" ;;
|
||||||
"datastore/text/Makefile") CONFIG_FILES="$CONFIG_FILES datastore/text/Makefile" ;;
|
"datastore/text/Makefile") CONFIG_FILES="$CONFIG_FILES datastore/text/Makefile" ;;
|
||||||
|
"util/Makefile") CONFIG_FILES="$CONFIG_FILES util/Makefile" ;;
|
||||||
"yang/Makefile") CONFIG_FILES="$CONFIG_FILES yang/Makefile" ;;
|
"yang/Makefile") CONFIG_FILES="$CONFIG_FILES yang/Makefile" ;;
|
||||||
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
|
"doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,6 +211,7 @@ AC_OUTPUT(Makefile
|
||||||
docker/netconf/Dockerfile
|
docker/netconf/Dockerfile
|
||||||
datastore/Makefile
|
datastore/Makefile
|
||||||
datastore/text/Makefile
|
datastore/text/Makefile
|
||||||
|
util/Makefile
|
||||||
yang/Makefile
|
yang/Makefile
|
||||||
doc/Makefile
|
doc/Makefile
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -80,14 +80,6 @@ YACCOBJS := lex.clixon_xml_parse.o clixon_xml_parse.tab.o \
|
||||||
lex.clixon_json_parse.o clixon_json_parse.tab.o \
|
lex.clixon_json_parse.o clixon_json_parse.tab.o \
|
||||||
lex.clixon_xpath_parse.o clixon_xpath_parse.tab.o
|
lex.clixon_xpath_parse.o clixon_xpath_parse.tab.o
|
||||||
|
|
||||||
# Extra applications. Utilities, unit testings. Not installed.
|
|
||||||
APPSRC = clixon_util_xml.c
|
|
||||||
APPSRC += clixon_util_json.c
|
|
||||||
APPSRC += clixon_util_yang.c
|
|
||||||
APPSRC += clixon_util_xpath.c
|
|
||||||
|
|
||||||
APPS = $(APPSRC:.c=)
|
|
||||||
|
|
||||||
# Generated src
|
# Generated src
|
||||||
GENSRC = build.c
|
GENSRC = build.c
|
||||||
|
|
||||||
|
|
@ -101,10 +93,10 @@ MYLIB = libclixon$(SH_SUFFIX).$(CLIXON_MAJOR).$(CLIXON_MINOR)
|
||||||
MYLIBSO = libclixon$(SH_SUFFIX).$(CLIXON_MAJOR)
|
MYLIBSO = libclixon$(SH_SUFFIX).$(CLIXON_MAJOR)
|
||||||
MYLIBLINK = libclixon$(SH_SUFFIX)
|
MYLIBLINK = libclixon$(SH_SUFFIX)
|
||||||
|
|
||||||
all: $(MYLIB) $(MYLIBLINK) $(APPS)
|
all: $(MYLIB) $(MYLIBLINK)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(MYLIB) $(APPS) $(MYLIBLINK) $(GENOBJS) $(GENSRC) *.core
|
rm -f $(OBJS) $(MYLIB) $(MYLIBLINK) $(GENOBJS) $(GENSRC) *.core
|
||||||
rm -f clixon_xml_parse.tab.[ch] clixon_xml_parse.yy.[co]
|
rm -f clixon_xml_parse.tab.[ch] clixon_xml_parse.yy.[co]
|
||||||
rm -f clixon_yang_parse.tab.[ch] clixon_yang_parse.[co]
|
rm -f clixon_yang_parse.tab.[ch] clixon_yang_parse.[co]
|
||||||
rm -f clixon_json_parse.tab.[ch] clixon_json_parse.[co]
|
rm -f clixon_json_parse.tab.[ch] clixon_json_parse.[co]
|
||||||
|
|
@ -174,19 +166,6 @@ clixon_xpath_parse.tab.c clixon_xpath_parse.tab.h: clixon_xpath_parse.y
|
||||||
lex.clixon_xpath_parse.o : lex.clixon_xpath_parse.c clixon_xpath_parse.tab.h
|
lex.clixon_xpath_parse.o : lex.clixon_xpath_parse.c clixon_xpath_parse.tab.h
|
||||||
$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -Wno-error -c $<
|
$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -Wno-error -c $<
|
||||||
|
|
||||||
# APPS
|
|
||||||
clixon_util_xml: clixon_util_xml.c $(MYLIB)
|
|
||||||
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $^ $(LIBS) -o $@
|
|
||||||
|
|
||||||
clixon_util_json: clixon_util_json.c $(MYLIB)
|
|
||||||
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $^ $(LIBS) -o $@
|
|
||||||
|
|
||||||
clixon_util_yang: clixon_util_yang.c $(MYLIB)
|
|
||||||
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $^ $(LIBS) -o $@
|
|
||||||
|
|
||||||
clixon_util_xpath: clixon_util_xpath.c $(MYLIB)
|
|
||||||
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $^ $(LIBS) -o $@
|
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f Makefile *~ .depend
|
rm -f Makefile *~ .depend
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -697,7 +697,7 @@ xp_relop(xp_ctx *xc1,
|
||||||
case XT_BOOL:
|
case XT_BOOL:
|
||||||
/* comparison on the boolean and the result of converting the
|
/* comparison on the boolean and the result of converting the
|
||||||
node-set to a boolean using the boolean function is true. */
|
node-set to a boolean using the boolean function is true. */
|
||||||
b = ctx2boolean(xc);
|
b = ctx2boolean(xc1);
|
||||||
switch(op){
|
switch(op){
|
||||||
case XO_EQ:
|
case XO_EQ:
|
||||||
xr->xc_bool = (b == xc2->xc_bool);
|
xr->xc_bool = (b == xc2->xc_bool);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test: JSON parser tests
|
# Test: JSON parser tests
|
||||||
PROG=../lib/src/clixon_util_json
|
PROG=../util/clixon_util_json
|
||||||
|
|
||||||
# include err() and new() functions and creates $dir
|
# include err() and new() functions and creates $dir
|
||||||
. ./lib.sh
|
. ./lib.sh
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test: XML parser tests
|
# Test: XML parser tests
|
||||||
PROG=../lib/src/clixon_util_xml
|
PROG=../util/clixon_util_xml
|
||||||
|
|
||||||
# include err() and new() functions and creates $dir
|
# include err() and new() functions and creates $dir
|
||||||
. ./lib.sh
|
. ./lib.sh
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test: XPATH tests
|
# Test: XPATH tests
|
||||||
PROG=../lib/src/clixon_util_xpath
|
PROG=../util/clixon_util_xpath
|
||||||
|
|
||||||
# include err() and new() functions and creates $dir
|
# include err() and new() functions and creates $dir
|
||||||
. ./lib.sh
|
. ./lib.sh
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test: XML parser tests
|
# Test: XML parser tests
|
||||||
PROG=../lib/src/clixon_util_yang
|
PROG=../util/clixon_util_yang
|
||||||
|
|
||||||
# include err() and new() functions and creates $dir
|
# include err() and new() functions and creates $dir
|
||||||
. ./lib.sh
|
. ./lib.sh
|
||||||
|
|
|
||||||
112
util/Makefile.in
Normal file
112
util/Makefile.in
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
#
|
||||||
|
# ***** BEGIN LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
# Copyright (C) 2009-2018 Olof Hagsand and Benny Holmgren
|
||||||
|
#
|
||||||
|
# This file is part of CLIXON
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# Alternatively, the contents of this file may be used under the terms of
|
||||||
|
# the GNU General Public License Version 3 or later (the "GPL"),
|
||||||
|
# in which case the provisions of the GPL are applicable instead
|
||||||
|
# of those above. If you wish to allow use of your version of this file only
|
||||||
|
# under the terms of the GPL, and not to allow others to
|
||||||
|
# use your version of this file under the terms of Apache License version 2,
|
||||||
|
# indicate your decision by deleting the provisions above and replace them with
|
||||||
|
# the notice and other provisions required by the GPL. If you do not delete
|
||||||
|
# the provisions above, a recipient may use your version of this file under
|
||||||
|
# the terms of any one of the Apache License version 2 or the GPL.
|
||||||
|
#
|
||||||
|
# ***** END LICENSE BLOCK *****
|
||||||
|
#
|
||||||
|
prefix = @prefix@
|
||||||
|
datarootdir = @datarootdir@
|
||||||
|
srcdir = @srcdir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
|
exec_prefix = @exec_prefix@
|
||||||
|
bindir = @bindir@
|
||||||
|
libdir = @libdir@
|
||||||
|
dbdir = @prefix@/db
|
||||||
|
mandir = @mandir@
|
||||||
|
libexecdir = @libexecdir@
|
||||||
|
localstatedir = @localstatedir@
|
||||||
|
sysconfdir = @sysconfdir@
|
||||||
|
HOST_VENDOR = @host_vendor@
|
||||||
|
|
||||||
|
SH_SUFFIX = @SH_SUFFIX@
|
||||||
|
|
||||||
|
CLIXON_VERSION = @CLIXON_VERSION@
|
||||||
|
CLIXON_MAJOR = @CLIXON_VERSION_MAJOR@
|
||||||
|
CLIXON_MINOR = @CLIXON_VERSION_MINOR@
|
||||||
|
|
||||||
|
VPATH = @srcdir@
|
||||||
|
CC = @CC@
|
||||||
|
CFLAGS = @CFLAGS@
|
||||||
|
INSTALL = @INSTALL@
|
||||||
|
INSTALL_LIB = @INSTALL@
|
||||||
|
INSTALLFLAGS = @INSTALLFLAGS@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBS = @LIBS@
|
||||||
|
|
||||||
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
|
||||||
|
INCLUDES = -I. @INCLUDES@ -I$(top_srcdir)/lib/clixon -I$(top_srcdir)/include -I$(top_srcdir)
|
||||||
|
|
||||||
|
MYLIB = ../lib/src/libclixon$(SH_SUFFIX).$(CLIXON_MAJOR).$(CLIXON_MINOR)
|
||||||
|
|
||||||
|
# Utilities, unit testings. Not installed.
|
||||||
|
APPSRC = clixon_util_xml.c
|
||||||
|
APPSRC += clixon_util_json.c
|
||||||
|
APPSRC += clixon_util_yang.c
|
||||||
|
APPSRC += clixon_util_xpath.c
|
||||||
|
|
||||||
|
APPS = $(APPSRC:.c=)
|
||||||
|
|
||||||
|
all: $(APPS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(APPS) *.core
|
||||||
|
|
||||||
|
# APPS
|
||||||
|
clixon_util_xml: clixon_util_xml.c $(MYLIB)
|
||||||
|
$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $^ $(LIBS) -o $@
|
||||||
|
|
||||||
|
clixon_util_json: clixon_util_json.c $(MYLIB)
|
||||||
|
$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $^ $(LIBS) -o $@
|
||||||
|
|
||||||
|
clixon_util_yang: clixon_util_yang.c $(MYLIB)
|
||||||
|
$(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $^ $(LIBS) -o $@
|
||||||
|
|
||||||
|
clixon_util_xpath: clixon_util_xpath.c $(MYLIB)
|
||||||
|
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $^ $(LIBS) -o $@
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
rm -f Makefile *~ .depend
|
||||||
|
|
||||||
|
install:
|
||||||
|
|
||||||
|
install-include:
|
||||||
|
|
||||||
|
install-lib:
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
|
||||||
|
TAGS:
|
||||||
|
find . -name '*.[ch]' -print | etags -
|
||||||
|
|
||||||
|
depend:
|
||||||
|
$(CC) $(DEPENDFLAGS) @DEFS@ $(INCLUDES) $(CFLAGS) -MM $(APPSRC) > .depend
|
||||||
|
|
||||||
|
#include .depend
|
||||||
|
|
||||||
5
util/README.md
Normal file
5
util/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Clixon utils
|
||||||
|
|
||||||
|
This directory contains Clixon utility programs, ie, programs that are
|
||||||
|
good to have for testing, analysis, etc, but not an actual part of
|
||||||
|
delivered code.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue