diff --git a/CHANGELOG.md b/CHANGELOG.md index 65d0b97a..3200cc6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,7 @@ Developers may need to change their code ### Corrected Bugs +* Fixed [clixon_proc can't start new process with PATH env #202](https://github.com/clicon/clixon/issues/202) * Fixed ["aux" folder issue with Windows. #198](https://github.com/clicon/clixon/issues/198) * Fixed [changing interface name not support with openconfig module #195](https://github.com/clicon/clixon/issues/195) * Fixed [making cli_show_options's output more human readable #199](https://github.com/clicon/clixon/issues/199) diff --git a/lib/src/clixon_proc.c b/lib/src/clixon_proc.c index affdf23b..61a5690a 100644 --- a/lib/src/clixon_proc.c +++ b/lib/src/clixon_proc.c @@ -322,7 +322,7 @@ clixon_proc_background(char **argv, } } #endif /* HAVE_SETNS */ - if (execv(argv[0], argv) < 0) { + if (execvp(argv[0], argv) < 0) { clicon_err(OE_UNIX, errno, "execv"); exit(1); } diff --git a/lib/src/clixon_yang.c b/lib/src/clixon_yang.c index 6e0c0ab3..6c5469a3 100644 --- a/lib/src/clixon_yang.c +++ b/lib/src/clixon_yang.c @@ -447,7 +447,7 @@ ys_new(enum rfc_6020 keyw) /*! Free a single yang statement, dont remove children * * @param[in] ys Yang node to remove - * @param[in] self Free own node + * @param[in] self Free own node including child vector * @retval 0 OK * @retval -1 Error * @see ys_free @@ -476,6 +476,8 @@ ys_free1(yang_stmt *ys, free(ys->ys_when_xpath); if (ys->ys_when_nsc) cvec_free(ys->ys_when_nsc); + if (ys->ys_stmt) + free(ys->ys_stmt); if (self) free(ys); return 0; @@ -526,8 +528,6 @@ ys_free(yang_stmt *ys) if ((yc = ys->ys_stmt[i]) != NULL) ys_free(yc); } - if (ys->ys_stmt) - free(ys->ys_stmt); ys_free1(ys, 1); return 0; } diff --git a/test/mem.sh b/test/mem.sh index 8171cc94..bce3e162 100755 --- a/test/mem.sh +++ b/test/mem.sh @@ -50,14 +50,16 @@ function memonce(){ ;; esac - err=0 + + memerr=0 for test in $pattern; do if [ $testnr != 0 ]; then echo; fi + perfnr=1000 # Limit performance tests testfile=$test . ./$test errcode=$? if [ $errcode -ne 0 ]; then - err=1 + memerr=1 echo -e "\e[31mError in $test errcode=$errcode" echo -ne "\e[0m" exit $errcode @@ -100,6 +102,8 @@ done # Then actual run testnr=0 +memerr=0 + for cmd1 in $cmds; do if [ $testnr != 0 ]; then echo; fi println "Mem test $cmd1 begin" @@ -107,7 +111,7 @@ for cmd1 in $cmds; do println "Mem test $cmd1 done" done -if [ $err -eq 0 ]; then +if [ $memerr -eq 0 ]; then echo OK else echo -e "\e[31mError" diff --git a/test/test_perf_mem.sh b/test/test_perf_mem.sh index fe94387e..731f8a5f 100755 --- a/test/test_perf_mem.sh +++ b/test/test_perf_mem.sh @@ -91,7 +91,13 @@ function testrun(){ pid=$(cat $pidfile) new "netconf get stats" - res=$(echo ']]>]]>' | $clixon_netconf -qf $cfg) + res=$(echo "$DEFAULTHELLO]]>]]>" | $clixon_netconf -qf $cfg) + echo "res:$res" + err0=$(echo "$res" | $clixon_util_xpath -p "/rpc-reply/rpc-error") + err=${err0#"nodeset:"} + if [ -n "$err" ]; then + err1 "" "$err" + fi objects=$(echo "$res" | $clixon_util_xpath -p "/rpc-reply/global/xmlnr" | awk -F ">" '{print $2}' | awk -F "<" '{print $1}') echo "Total" @@ -105,8 +111,11 @@ function testrun(){ fi for db in running candidate startup; do echo "$db" - resdb=$(echo "$res" | $clixon_util_xpath -p "/rpc-reply/datastore[name=\"$db\"]") - resdb=${resdb#"nodeset:0:"} + resdb0=$(echo "$res" | $clixon_util_xpath -p "/rpc-reply/datastore[name=\"$db\"]") + resdb=${resdb0#"nodeset:0:"} + if [ "$resdb0" = "$resdb" ]; then + err1 "nodeset:0:" "$resdb0" + fi echo -n " objects: " echo $resdb | $clixon_util_xpath -p "datastore/nr" | awk -F ">" '{print $2}' | awk -F "<" '{print $1}' echo -n " mem: " diff --git a/test/test_restconf_internal_usecases.sh b/test/test_restconf_internal_usecases.sh index 4808e7b6..fc2ab27f 100755 --- a/test/test_restconf_internal_usecases.sh +++ b/test/test_restconf_internal_usecases.sh @@ -169,15 +169,12 @@ pid1=$pid if [ $pid1 -eq 0 ]; then err "Pid" 0; fi new "Check $pid1 exists" -while kill -0 $pid1 2> /dev/null; do +while sudo kill -0 $pid1 2> /dev/null; do new "kill $pid1 externally" sudo kill $pid1 sleep $DEMSLEEP done - - - new "3. get status: Check killed" rpcstatus false stopped if [ $pid -ne 0 ]; then err "Pid" "$pid"; fi @@ -353,7 +350,7 @@ if [ $pid1 -eq $pid2 ]; then fi new "Get restconf config 2: no server" -expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+xml' $RCPROTO://localhost/restconf/data/clixon-restconf:restconf 2>&1)" 7 "Failed to connect" "Connection refused" +expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+xml' $RCPROTO://localhost/restconf/data/clixon-restconf:restconf 2>&1)" 7 # curl 7.58: "Failed to connect" "Connection refused", curl 7.74: "Couldn't connect to server" if [ $BE -ne 0 ]; then new "Kill backend" diff --git a/test/vagrant/Makefile.in b/test/vagrant/Makefile.in index fb0fa68e..0eeadd6d 100644 --- a/test/vagrant/Makefile.in +++ b/test/vagrant/Makefile.in @@ -47,8 +47,8 @@ SHELL = /bin/sh # VAGRANTS += freebsd/FreeBSD-12.1-STABLE VAGRANTS = -# internal or fcgi -RESTCONF=internal +# native or fcgi +RESTCONF=native -include site.mk