test: cleaned up stty get/set in tests
This commit is contained in:
parent
2603b6f139
commit
2b6bd4fb5c
4 changed files with 9 additions and 8 deletions
12
test/lib.sh
12
test/lib.sh
|
|
@ -30,6 +30,9 @@
|
||||||
|
|
||||||
>&2 echo "Running $testfile"
|
>&2 echo "Running $testfile"
|
||||||
|
|
||||||
|
# Save stty
|
||||||
|
STTYSETTINGS=$(stty -g)
|
||||||
|
|
||||||
# Generated config file from autotools / configure
|
# Generated config file from autotools / configure
|
||||||
if [ -f ./config.sh ]; then
|
if [ -f ./config.sh ]; then
|
||||||
. ./config.sh
|
. ./config.sh
|
||||||
|
|
@ -580,9 +583,8 @@ function wait_backend(){
|
||||||
# Start restconf daemon
|
# Start restconf daemon
|
||||||
# @see wait_restconf
|
# @see wait_restconf
|
||||||
function start_restconf(){
|
function start_restconf(){
|
||||||
STTYSETTINGS=`stty -g`
|
|
||||||
# Start in background
|
# Start in background
|
||||||
echo "sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $*"
|
# echo "sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $*"
|
||||||
sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $* </dev/null &>/dev/null &
|
sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $* </dev/null &>/dev/null &
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err1 "expected 0" "$?"
|
err1 "expected 0" "$?"
|
||||||
|
|
@ -637,8 +639,6 @@ function wait_restconf(){
|
||||||
if [ $valgrindtest -eq 3 ]; then
|
if [ $valgrindtest -eq 3 ]; then
|
||||||
sleep 2 # some problems with valgrind
|
sleep 2 # some problems with valgrind
|
||||||
fi
|
fi
|
||||||
|
|
||||||
stty $STTYSETTINGS >/dev/null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Wait for restconf to stop
|
# Wait for restconf to stop
|
||||||
|
|
@ -683,6 +683,10 @@ function wait_snmp()
|
||||||
# eg all.sh or mem.sh
|
# eg all.sh or mem.sh
|
||||||
function endtest()
|
function endtest()
|
||||||
{
|
{
|
||||||
|
# Commented from now, it is unclear what destroys the tty, if something does the original
|
||||||
|
# problem should be fixed at the origin.
|
||||||
|
# stty $STTYSETTINGS >/dev/null
|
||||||
|
|
||||||
if [ $valgrindtest -eq 1 ]; then
|
if [ $valgrindtest -eq 1 ]; then
|
||||||
checkvalgrind
|
checkvalgrind
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
# Test skip for leaf, container and list
|
# Test skip for leaf, container and list
|
||||||
# Test alias only for leaf, since it is not implemented for container+list
|
# Test alias only for leaf, since it is not implemented for container+list
|
||||||
# see also test_autocli_hide.sh
|
# see also test_autocli_hide.sh
|
||||||
set -u
|
|
||||||
# Magic line must be first in script (see README.md)
|
# Magic line must be first in script (see README.md)
|
||||||
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
|
||||||
|
|
||||||
APPNAME=example
|
APPNAME=example
|
||||||
|
|
||||||
|
|
||||||
cfg=$dir/conf_yang.xml
|
cfg=$dir/conf_yang.xml
|
||||||
cfdir=$dir/conf.d
|
cfdir=$dir/conf.d
|
||||||
test -d $cfdir || mkdir $cfdir
|
test -d $cfdir || mkdir $cfdir
|
||||||
|
|
@ -72,7 +71,7 @@ new "restconf xml"
|
||||||
expectpart "$(sudo $clixon_restconf -f $cfg -C xml -o CLICON_MODULE_SET=42 -o CLICON_FEATURE="cmdline")" 0 '^<clixon-config xmlns="http://clicon.org/config">' "<CLICON_YANG_MAIN_DIR>$dir</CLICON_YANG_MAIN_DIR>" "<CLICON_MODULE_SET_ID>0</CLICON_MODULE_SET_ID>" "<autocli>" "<list-keyword-default>kw-nokey</list-keyword-default>" "<CLICON_FEATURE>orig</CLICON_FEATURE>" "<CLICON_FEATURE>cmdline</CLICON_FEATURE>" "<CLICON_FEATURE>extradir</CLICON_FEATURE>" --not-- "<CLICON_MODULE_SET_ID>42</CLICON_MODULE_SET_ID>"
|
expectpart "$(sudo $clixon_restconf -f $cfg -C xml -o CLICON_MODULE_SET=42 -o CLICON_FEATURE="cmdline")" 0 '^<clixon-config xmlns="http://clicon.org/config">' "<CLICON_YANG_MAIN_DIR>$dir</CLICON_YANG_MAIN_DIR>" "<CLICON_MODULE_SET_ID>0</CLICON_MODULE_SET_ID>" "<autocli>" "<list-keyword-default>kw-nokey</list-keyword-default>" "<CLICON_FEATURE>orig</CLICON_FEATURE>" "<CLICON_FEATURE>cmdline</CLICON_FEATURE>" "<CLICON_FEATURE>extradir</CLICON_FEATURE>" --not-- "<CLICON_MODULE_SET_ID>42</CLICON_MODULE_SET_ID>"
|
||||||
|
|
||||||
new "cli json"
|
new "cli json"
|
||||||
expectpart "$($clixon_cli -1 -f $cfg -C json -o CLICON_MODULE_SET=42 -o CLICON_FEATURE="cmdline")" 0 '"clixon-config:clixon-config": {' '"CLICON_YANG_MAIN_DIR": "/var/tmp/./test_config_dump.sh",'
|
expectpart "$($clixon_cli -1 -f $cfg -C json -o CLICON_MODULE_SET=42 -o CLICON_FEATURE="cmdline")" 0 '"clixon-config:clixon-config": {' "\"CLICON_YANG_MAIN_DIR\": \"$dir\","
|
||||||
|
|
||||||
new "cli text"
|
new "cli text"
|
||||||
expectpart "$($clixon_cli -1 -f $cfg -C text -o CLICON_MODULE_SET=42 -o CLICON_FEATURE="cmdline")" 0 '^clixon-config:clixon-config {' 'list-keyword-default kw-nokey;' 'CLICON_FEATURE \[' 'extradir' 'orig' 'cmdline'
|
expectpart "$($clixon_cli -1 -f $cfg -C text -o CLICON_MODULE_SET=42 -o CLICON_FEATURE="cmdline")" 0 '^clixon-config:clixon-config {' 'list-keyword-default kw-nokey;' 'CLICON_FEATURE \[' 'extradir' 'orig' 'cmdline'
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,6 @@ function testrun()
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
# inline of start_restconf, cant make quotes to work
|
# inline of start_restconf, cant make quotes to work
|
||||||
echo "sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG -f $cfg -R $RESTCONFIG1"
|
echo "sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG -f $cfg -R $RESTCONFIG1"
|
||||||
STTYSETTINGS=$(stty -g) # reset in wait_restconf
|
|
||||||
sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG -f $cfg -R "$RESTCONFIG1" </dev/null &>/dev/null &
|
sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG -f $cfg -R "$RESTCONFIG1" </dev/null &>/dev/null &
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err1 "expected 0" "$?"
|
err1 "expected 0" "$?"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue