Making the tests self-contained wrt config file and lib.sh creating test scratch dir.
This commit is contained in:
parent
b5b96cde0c
commit
cefaf4717f
12 changed files with 256 additions and 78 deletions
|
|
@ -6,9 +6,9 @@
|
|||
# - running db starts with a "run" interface
|
||||
# - startup db starts with a "start" interface
|
||||
|
||||
# include err() and new() functions
|
||||
# include err() and new() functions and creates $dir
|
||||
. ./lib.sh
|
||||
cfg=/tmp/conf_startup.xml
|
||||
cfg=$dir/conf_startup.xml
|
||||
|
||||
# For memcheck
|
||||
# clixon_netconf="valgrind --leak-check=full --show-leak-kinds=all clixon_netconf"
|
||||
|
|
@ -42,7 +42,8 @@ run(){
|
|||
mode=$1
|
||||
expect=$2
|
||||
|
||||
cat <<EOF > /tmp/db
|
||||
dbdir=$dir/db
|
||||
cat <<EOF > $dbdir
|
||||
<config>
|
||||
<interfaces>
|
||||
<interface>
|
||||
|
|
@ -52,9 +53,9 @@ run(){
|
|||
</interfaces>
|
||||
</config>
|
||||
EOF
|
||||
sudo mv /tmp/db /usr/local/var/routing/running_db
|
||||
sudo mv $dbdir /usr/local/var/routing/running_db
|
||||
|
||||
cat <<EOF > /tmp/db
|
||||
cat <<EOF > $dbdir
|
||||
<config>
|
||||
<interfaces>
|
||||
<interface>
|
||||
|
|
@ -64,9 +65,9 @@ EOF
|
|||
</interfaces>
|
||||
</config>
|
||||
EOF
|
||||
sudo mv /tmp/db /usr/local/var/routing/startup_db
|
||||
sudo mv $dbdir /usr/local/var/routing/startup_db
|
||||
|
||||
cat <<EOF > /tmp/config
|
||||
cat <<EOF > $dir/config
|
||||
<config>
|
||||
<interfaces>
|
||||
<interface>
|
||||
|
|
@ -84,8 +85,8 @@ EOF
|
|||
err
|
||||
fi
|
||||
|
||||
new "start backend -f $cfg -s $mode -c /tmp/config"
|
||||
sudo clixon_backend -f $cfg -s $mode -c /tmp/config
|
||||
new "start backend -f $cfg -s $mode -c $dir/config"
|
||||
sudo clixon_backend -f $cfg -s $mode -c $dir/config
|
||||
if [ $? -ne 0 ]; then
|
||||
err
|
||||
fi
|
||||
|
|
@ -111,3 +112,4 @@ run none '<data><interfaces><interface><name>run</name><type>eth</type><enabl
|
|||
run running '<data><interfaces><interface><name>extra</name><type>eth</type><enabled>true</enabled></interface><interface><name>lo</name><type>local</type><enabled>true</enabled></interface><interface><name>run</name><type>eth</type><enabled>true</enabled></interface></interfaces></data>'
|
||||
run startup '<data><interfaces><interface><name>extra</name><type>eth</type><enabled>true</enabled></interface><interface><name>lo</name><type>local</type><enabled>true</enabled></interface><interface><name>startup</name><type>eth</type><enabled>true</enabled></interface></interfaces></data>'
|
||||
|
||||
rm -rf $dir
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue