Test modifications

- Remove dependency of IETF YANGs on most tests
- Remove dependnency of example/main in most tests, instead make local copy of example yang
This commit is contained in:
Olof hagsand 2022-01-03 09:21:19 +01:00
parent f92e9609dc
commit dec05e2cae
67 changed files with 516 additions and 149 deletions

View file

@ -15,20 +15,18 @@ APPNAME=example
# include err() and new() functions and creates $dir
cfg=$dir/conf_yang.xml
fyang=$dir/clixon-example.yang
clidir=$dir/clidir
if [ ! -d $clidir ]; then
mkdir $clidir
fi
# Use yang in example
cat <<EOF > $cfg
<clixon-config xmlns="http://clicon.org/config">
<CLICON_CONFIGFILE>$cfg</CLICON_CONFIGFILE>
<CLICON_YANG_DIR>/usr/local/share/clixon</CLICON_YANG_DIR>
<CLICON_YANG_DIR>$IETFRFC</CLICON_YANG_DIR>
<CLICON_YANG_MODULE_MAIN>clixon-example</CLICON_YANG_MODULE_MAIN>
<CLICON_YANG_MAIN_FILE>$fyang</CLICON_YANG_MAIN_FILE>
<CLICON_BACKEND_DIR>/usr/local/lib/$APPNAME/backend</CLICON_BACKEND_DIR>
<CLICON_CLISPEC_DIR>$clidir</CLICON_CLISPEC_DIR>
<CLICON_CLI_DIR>/usr/local/lib/$APPNAME/cli</CLICON_CLI_DIR>
@ -38,6 +36,14 @@ cat <<EOF > $cfg
</clixon-config>
EOF
cat <<EOF > $fyang
module clixon-example{
yang-version 1.1;
namespace "urn:example:clixon";
prefix ex;
}
EOF
# clispec files 1..6 for submodes AAA and BBB as described in top comment
cat <<EOF > $clidir/cli1.cli
@ -92,7 +98,7 @@ for c in 1 2 5; do
done
# Tests using mode AAA that should fail
for c in 3 4 6; do
new "cli mode $m 1 cmd$c Not OK"
new "cli mode $m 1 cmd$c Expect fail"
expectpart "$($clixon_cli -1 -m $m -f $cfg cmd$c)" 255 "^$"
done
@ -104,7 +110,7 @@ for c in 1 3 5 6; do
done
# Tests using mode BBB that should fail
for c in 2 4; do
new "cli mode $m 1 cmd$c Not OK"
new "cli mode $m 1 cmd$c Expect fail"
expectpart "$($clixon_cli -1 -m $m -f $cfg cmd$c)" 255 "^$"
done