- Fixed plugin-module initialized twice in restconf-fcgi
- Test script: wait for restconf to stop
This commit is contained in:
parent
b88722fa25
commit
91a583253e
5 changed files with 29 additions and 6 deletions
|
|
@ -431,9 +431,6 @@ main(int argc,
|
|||
if (dbg)
|
||||
clicon_option_dump(h, dbg);
|
||||
|
||||
/* Initialize plugin module by creating a handle holding plugin and callback lists */
|
||||
if (clixon_plugin_module_init(h) < 0)
|
||||
goto done;
|
||||
/* Call start function in all plugins before we go interactive */
|
||||
if (clixon_plugin_start_all(h) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -1115,6 +1115,10 @@ clixon_plugin_module_init(clicon_handle h)
|
|||
int retval = -1;
|
||||
struct plugin_module_struct *ph;
|
||||
|
||||
if (plugin_module_struct_get(h) != NULL){
|
||||
clicon_err(OE_PLUGIN, EFAULT, "Already initialized");
|
||||
goto done;
|
||||
}
|
||||
if ((ph = malloc(sizeof(*ph))) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "malloc");
|
||||
goto done;
|
||||
|
|
|
|||
19
test/lib.sh
19
test/lib.sh
|
|
@ -386,6 +386,25 @@ function wait_restconf(){
|
|||
fi
|
||||
}
|
||||
|
||||
# Wait for restconf to stop
|
||||
# @note assumes port=80 if RCPROTO=http and port=443 if RCPROTO=https
|
||||
# @see wait_restconf
|
||||
function wait_restconf_stopped(){
|
||||
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf 2> /dev/null)
|
||||
let i=0;
|
||||
while [[ $hdr = *"200 OK"* ]]; do
|
||||
if [ $i -ge $DEMLOOP ]; then
|
||||
err1 "restconf timeout $DEMWAIT seconds"
|
||||
fi
|
||||
sleep $DEMSLEEP
|
||||
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf 2> /dev/null)
|
||||
let i++;
|
||||
done
|
||||
if [ $valgrindtest -eq 3 ]; then
|
||||
sleep 2 # some problems with valgrind
|
||||
fi
|
||||
}
|
||||
|
||||
# End of test, final tests before normal exit of test
|
||||
function endtest()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -223,6 +223,9 @@ new "4. stop restconf RPC"
|
|||
rpcoperation stop
|
||||
if [ $? -ne 0 ]; then exit -1; fi
|
||||
|
||||
new "Wait for restrconf to stop"
|
||||
wait_restconf_stopped
|
||||
|
||||
new "5. Get rpc status stopped"
|
||||
rpcstatus false stopped
|
||||
if [ $pid -ne 0 ]; then err "Pid" "$pid"; fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue