xmldb
This commit is contained in:
parent
ca18b7f49e
commit
0a812696c2
47 changed files with 1818 additions and 1783 deletions
8
test/README
Normal file
8
test/README
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Some test cases:
|
||||
With and without xmldb_rpc:
|
||||
set a list entry
|
||||
set a nested entry
|
||||
Completion
|
||||
validate with missing mandatory variable
|
||||
commit
|
||||
delete all
|
||||
11
test/all.sh
Executable file
11
test/all.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
for test in test*.sh; do
|
||||
echo "Running $test"
|
||||
./$test
|
||||
errcode=$?
|
||||
if [ $errcode -ne 0 ]; then
|
||||
echo "Error in $test errcode=$errcode"
|
||||
exit $errcode
|
||||
fi
|
||||
done
|
||||
|
||||
32
test/lib.sh
Executable file
32
test/lib.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
|
||||
testnr=0
|
||||
testnname=
|
||||
clixon_cf=/usr/local/etc/routing.conf
|
||||
# error and exit
|
||||
err(){
|
||||
echo "Error in Test$testnr [$testname] $1"
|
||||
exit $testnr
|
||||
}
|
||||
|
||||
# Increment test number and print a nice string
|
||||
new(){
|
||||
testnr=`expr $testnr + 1`
|
||||
testname=$1
|
||||
echo "Test$testnr [$1]"
|
||||
# sleep 1
|
||||
}
|
||||
|
||||
# clicon_cli tester. First arg is command and second is expected outcome
|
||||
clifn(){
|
||||
cmd=$1
|
||||
expect=$2
|
||||
ret=`$cmd`
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
if [ "$ret" != "$expect" ]; then
|
||||
err "\nExpected:\t\"$expect\"\nGot:\t\"$ret\""
|
||||
fi
|
||||
}
|
||||
|
||||
32
test/test1.sh
Executable file
32
test/test1.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/bin/sh
|
||||
|
||||
# include err() and new() functions
|
||||
. ./lib.sh
|
||||
|
||||
# kill old backend (if any)
|
||||
new "kill old backend"
|
||||
sudo clixon_backend -zf $clixon_cf
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
new "start backend"
|
||||
# start new backend
|
||||
sudo clixon_backend -If $clixon_cf -x 0
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
new "cli configure"
|
||||
clifn "clixon_cli -1f $clixon_cf set interfaces interface eth0" ""
|
||||
|
||||
new "cli show configuration"
|
||||
clifn "clixon_cli -1f $clixon_cf show conf cli" "interfaces interface name eth0
|
||||
interfaces interface enabled htrue"
|
||||
|
||||
new "Kill backend"
|
||||
# kill backend
|
||||
sudo clixon_backend -zf $clixon_cf
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue