This commit is contained in:
Olof hagsand 2018-07-20 23:16:26 +02:00
parent b894c30bfb
commit deb89600ed
23 changed files with 50 additions and 31 deletions

View file

@ -131,7 +131,7 @@ fi
new "start backend -s init -f $cfg -y $fyang"
# start new backend
sudo clixon_backend -s init -f $cfg -y $fyang
sudo $clixon_backend -s init -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi
@ -195,6 +195,7 @@ expecteq "$(curl -u guest:bar -sS -X PUT -d '{"x": 3}' http://localhost/restconf
new "Kill restconf daemon"
sudo pkill -u www-data clixon_restconf
new "Kill backend"
pid=`pgrep clixon_backend`
if [ -z "$pid" ]; then
err "backend already dead"

View file

@ -169,17 +169,18 @@ sudo clixon_backend -zf $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi
sleep 1
new "start backend -s init -f $cfg -y $fyang"
# start new backend
sudo clixon_backend -s init -f $cfg -y $fyang
sudo $clixon_backend -s init -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi
sleep 1
new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf
sleep 1
new "start restconf daemon (-a is enable http basic auth)"
sudo start-stop-daemon -S -q -o -b -x /www-data/clixon_restconf -d /www-data -c www-data -- -f $cfg -y $fyang -- -a
@ -246,6 +247,7 @@ expectfn "$clixon_cli -1 -U guest -l o -f $cfg -y $fyang rpc ipv4" 255 "protocol
new "Kill restconf daemon"
sudo pkill -u www-data clixon_restconf
new "Kill backend"
pid=`pgrep clixon_backend`
if [ -z "$pid" ]; then
err "backend already dead"

View file

@ -37,7 +37,8 @@ if [ $? -ne 0 ]; then
err
fi
new "start backend -s init -f $cfg"
sudo $clixon_backend -s init -f $cfg
sudo $clixon_backend -s init -f $cfg
if [ $? -ne 0 ]; then
err
fi

View file

@ -114,7 +114,7 @@ if [ $? -ne 0 ]; then
fi
new "start backend -s init -f $cfg -y $fyang"
# start new backend
sudo clixon_backend -s init -f $cfg -y $fyang # -D 1
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
if [ $? -ne 0 ]; then
err
fi

View file

@ -1,14 +1,15 @@
#!/bin/bash
# Test: JSON parser tests
#PROG="valgrind --leak-check=full --show-leak-kinds=all ../util/clixon_util_json"
PROG=../util/clixon_util_json
# include err() and new() functions and creates $dir
. ./lib.sh
new "json parse"
expecteof $PROG 0 '{"foo": -23}' "^<foo>-23</foo>$"
expecteof "$PROG" 0 '{"foo": -23}' "^<foo>-23</foo>$"
new "json parse list"
expecteof $PROG 0 '{"a":[0,1,2,3]}' "^<a>0</a><a>1</a><a>2</a><a>3</a>$"
expecteof "$PROG" 0 '{"a":[0,1,2,3]}' "^<a>0</a><a>1</a><a>2</a><a>3</a>$"
rm -rf $dir

View file

@ -78,7 +78,7 @@ fi
new "start backend -s init -f $cfg -y $fyang"
# start new backend
sudo clixon_backend -s init -f $cfg -y $fyang
sudo $clixon_backend -s init -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi

View file

@ -71,7 +71,7 @@ fi
new "start backend -s init -f $cfg -y $fyang"
# start new backend
sudo clixon_backend -s init -f $cfg -y $fyang
sudo $clixon_backend -s init -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi

View file

@ -76,7 +76,7 @@ if [ $? -ne 0 ]; then
fi
new "start backend -s init -f $cfg -y $fyang"
# start new backend
sudo clixon_backend -s init -f $cfg -y $fyang # -D 1
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
if [ $? -ne 0 ]; then
err
fi

View file

@ -112,7 +112,7 @@ fi
new "start backend"
# start new backend
sudo clixon_backend -s running -f $cfg -y $fyang
sudo $clixon_backend -s running -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi

View file

@ -63,7 +63,7 @@ fi
new "start backend -s init -f $cfg -y $fyang"
# start new backend
sudo clixon_backend -s init -f $cfg -y $fyang
sudo $clixon_backend -s init -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi

View file

@ -83,7 +83,7 @@ if [ $? -ne 0 ]; then
err
fi
new "start backend -s init -f $cfg -y $fyang"
sudo clixon_backend -s init -f $cfg -y $fyang # -D 1
sudo $clixon_backend -s init -f $cfg -y $fyang # -D 1
if [ $? -ne 0 ]; then
err
fi
@ -291,7 +291,6 @@ fi
# Cant get shell macros to work, inline matching from lib.sh
new "Kill restconf daemon"
sudo pkill -u www-data clixon_restconf

View file

@ -50,7 +50,8 @@ if [ $? -ne 0 ]; then
err
fi
new "start backend -s init -f $cfg -y $fyang"
sudo clixon_backend -s init -f $cfg -y $fyang
sudo $clixon_backend -s init -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi

View file

@ -144,7 +144,7 @@ if [ $? -ne 0 ]; then
err
fi
new "start backend -s init -f $cfg -y $fyang"
sudo clixon_backend -s init -f $cfg -y $fyang
sudo $clixon_backend -s init -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi

View file

@ -96,7 +96,7 @@ fi
new "start backend -s init -f $cfg -y $fyang"
# start new backend
sudo clixon_backend -s init -f $cfg -y $fyang
sudo $clixon_backend -s init -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi

View file

@ -1,12 +1,13 @@
#!/bin/bash
# Test: XML parser tests
#PROG="valgrind --leak-check=full --show-leak-kinds=all ../util/clixon_util_xml"
PROG=../util/clixon_util_xml
# include err() and new() functions and creates $dir
. ./lib.sh
new "xml parse"
expecteof $PROG 0 "<a><b/></a>" "^<a><b/></a>$"
expecteof "$PROG" 0 "<a><b/></a>" "^<a><b/></a>$"
XML=$(cat <<EOF
<a><description>An example of escaped CENDs</description>
@ -24,7 +25,7 @@ XML=$(cat <<EOF
EOF
)
new "xml CDATA"
expecteof $PROG 0 "$XML" "^<a><description>An example of escaped CENDs</description><sometext>
expecteof "$PROG" 0 "$XML" "^<a><description>An example of escaped CENDs</description><sometext>
<![CDATA[ They're saying \"x < y\" & that \"z > y\" so I guess that means that z > x ]]>
</sometext><data><![CDATA[This text contains a CEND ]]]]><![CDATA[>]]></data><alternative><![CDATA[This text contains a CEND ]]]><![CDATA[]>]]></alternative></a>$"
@ -33,14 +34,14 @@ XML=$(cat <<EOF
EOF
)
new "xml encode <>&"
expecteof $PROG 0 "$XML" "^$XML$"
expecteof "$PROG" 0 "$XML" "^$XML$"
XML=$(cat <<EOF
<message>To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character ' may be represented as &apos; and the double-quote character as &quot; </message>
EOF
)
new "xml optional encode single and double quote"
expecteof $PROG 0 "$XML" "^<message>To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character ' may be represented as ' and the double-quote character as \"</message>$"
expecteof "$PROG" 0 "$XML" "^<message>To allow attribute values to contain both single and double quotes, the apostrophe or single-quote character ' may be represented as ' and the double-quote character as \"</message>$"
rm -rf $dir

View file

@ -1,5 +1,6 @@
#!/bin/bash
# Test: XPATH tests
#PROG="valgrind --leak-check=full --show-leak-kinds=all ../util/clixon_util_xpath"
PROG=../util/clixon_util_xpath
# include err() and new() functions and creates $dir

View file

@ -105,7 +105,7 @@ fi
new "start backend -s init -f $cfg -y $fyang"
# start new backend
sudo clixon_backend -s init -f $cfg -y $fyang
sudo $clixon_backend -s init -f $cfg -y $fyang
if [ $? -ne 0 ]; then
err
fi

View file

@ -1,5 +1,6 @@
#!/bin/bash
# Test: XML parser tests
#PROG="valgrind --leak-check=full --show-leak-kinds=all ../util/clixon_util_yang"
PROG=../util/clixon_util_yang
# include err() and new() functions and creates $dir
@ -12,13 +13,13 @@ module test{
description "Example from RFC 6020";
argument "name";
}
ex:not-defined ARGUMENT;
ex:not-defined ARGUMENT;;
}
EOF
)
new "yang parse"
expecteof $PROG 0 "$YANG" "^$YANG$"
expecteof "$PROG" 0 "$YANG" "^$YANG$"
rm -rf $dir