diff --git a/test/lib.sh b/test/lib.sh
index 36d3ee40..24e0b8c9 100755
--- a/test/lib.sh
+++ b/test/lib.sh
@@ -679,16 +679,47 @@ function wait_snmp()
# End of single test, final tests before normal exit of test
# Note this is a single test started by new, not a total test suite
+# Unset common variables that may affect next test if run in sequence by
+# eg all.sh or mem.sh
function endtest()
{
if [ $valgrindtest -eq 1 ]; then
checkvalgrind
fi
+ # Unset common variables. More specific should be unset at end of script
+ unset RCPROTO
+ unset HAVE_LIBNGHTTP2
+ unset HVER
+ unset AUTOCLI
+ unset CURLOPTS
+ unset RESTCONFIG
+ unset LOGDST
+ unset fyang
+ unset ret
+ unset count
+ unset nr
+ unset format
+ unset perfnr
+ unset perfreq
+ unset pid
+ unset validatexml
+ unset xpath
+ unset clixon_util_datastore
+ unset clixon_util_json
+ unset clixon_util_xml
+ unset clixon_util_path
+ unset clixon_util_socket
+ unset clixon_util_stream
+ unset clixon_util_xpath
+ unset clixon_util_xml
+ unset clixon_util_xml_mod
}
# Increment test number and print a nice string
function new(){
- endtest # finalize previous test
+ if [ $valgrindtest -eq 1 ]; then
+ checkvalgrind
+ fi
testnr=`expr $testnr + 1`
testi=`expr $testi + 1`
testname=$1
diff --git a/test/test_api.sh b/test/test_api.sh
index 917eef34..40671b9d 100755
--- a/test/test_api.sh
+++ b/test/test_api.sh
@@ -270,12 +270,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# unset conditional parameters
-unset format
-
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_api_path.sh b/test/test_api_path.sh
index 996eb3a5..ff3726e6 100755
--- a/test/test_api_path.sh
+++ b/test/test_api_path.sh
@@ -255,10 +255,6 @@ expectpart "$($clixon_util_path -f $xml6 -y $ydir -p /modb:x6/yy=b$rnd,b$rnd)" 0
new "api-path double string key k1=a$rnd,b$rnd in modb + augmented in moda"
expectpart "$($clixon_util_path -f $xml6 -y $ydir -p /modb:x6/yy=b$rnd,b$rnd/moda:y=a1,a1/z=foo1)" 0 "0: foo1"
-# unset conditional parameters
-unset nr
-unset clixon_util_path
-
rm -rf $dir
new "endtest"
diff --git a/test/test_augment.sh b/test/test_augment.sh
index 2102ed75..4e4e7bca 100755
--- a/test/test_augment.sh
+++ b/test/test_augment.sh
@@ -358,9 +358,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_autocli_obsolete.sh b/test/test_autocli_obsolete.sh
index b30d5d56..9111793f 100755
--- a/test/test_autocli_obsolete.sh
+++ b/test/test_autocli_obsolete.sh
@@ -8,6 +8,8 @@ s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi
APPNAME=example
+echo "AUTOCLI:$AUTOCLI"
+
# include err() and new() functions and creates $dir
cfg=$dir/conf_yang.xml
@@ -139,8 +141,7 @@ cat < $cfg
ietf-netconf:startup
${YANG_INSTALLDIR}
$IETFRFC
- $dir
- /usr/local/lib/$APPNAME/backend
+ $fyang
$APPNAME
/usr/local/lib/$APPNAME/cli
$dir
diff --git a/test/test_autocli_show.sh b/test/test_autocli_show.sh
index 8bb94001..4f66f305 100755
--- a/test/test_autocli_show.sh
+++ b/test/test_autocli_show.sh
@@ -268,7 +268,5 @@ fi
rm -rf $dir
-unset format
-
new "endtest"
endtest
diff --git a/test/test_choice.sh b/test/test_choice.sh
index 1fe4b9bf..15396563 100755
--- a/test/test_choice.sh
+++ b/test/test_choice.sh
@@ -485,9 +485,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_cli_duplicates.sh b/test/test_cli_duplicates.sh
index 311d0830..23cceb4a 100755
--- a/test/test_cli_duplicates.sh
+++ b/test/test_cli_duplicates.sh
@@ -177,8 +177,5 @@ fi
rm -rf $dir
-unset count
-unset ret
-
new "endtest"
endtest
diff --git a/test/test_cli_history.sh b/test/test_cli_history.sh
index f82cdaf2..ac1a1ad1 100755
--- a/test/test_cli_history.sh
+++ b/test/test_cli_history.sh
@@ -141,7 +141,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-unset nr
rm -rf $dir
new "endtest"
diff --git a/test/test_cli_union.sh b/test/test_cli_union.sh
index fc8be923..5430a663 100755
--- a/test/test_cli_union.sh
+++ b/test/test_cli_union.sh
@@ -163,8 +163,5 @@ fi
rm -rf $dir
-unset count
-unset ret
-
new "endtest"
endtest
diff --git a/test/test_client.sh b/test/test_client.sh
index 746ce4c6..6c698373 100755
--- a/test/test_client.sh
+++ b/test/test_client.sh
@@ -183,12 +183,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# unset conditional parameters
-unset format
-
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_confirmed_commit.sh b/test/test_confirmed_commit.sh
index 66015da3..34cca802 100755
--- a/test/test_confirmed_commit.sh
+++ b/test/test_confirmed_commit.sh
@@ -475,8 +475,7 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
+rm -rf $dir
new "endtest"
endtest
diff --git a/test/test_copy_config.sh b/test/test_copy_config.sh
index cddba32d..44cb6be7 100755
--- a/test/test_copy_config.sh
+++ b/test/test_copy_config.sh
@@ -233,9 +233,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
new "Endtest"
endtest
diff --git a/test/test_datastore.sh b/test/test_datastore.sh
index fbe51466..3c2feda1 100755
--- a/test/test_datastore.sh
+++ b/test/test_datastore.sh
@@ -161,9 +161,6 @@ diff $mydir/kalle_db $mydir/candidate_db
new "datastore lock"
expectpart "$($clixon_util_datastore $conf lock 756)" 0 ""
-# unset conditional parameters
-unset clixon_util_datastore
-unset ret
rm -rf $mydir
diff --git a/test/test_db.sh b/test/test_db.sh
index a2e0a833..4bbf163e 100755
--- a/test/test_db.sh
+++ b/test/test_db.sh
@@ -264,9 +264,5 @@ fi
rm -rf $dir
-unset format
-unset pid
-unset ret
-
new "endtest"
endtest
diff --git a/test/test_debug.sh b/test/test_debug.sh
index 42dc17a0..c1398b1e 100755
--- a/test/test_debug.sh
+++ b/test/test_debug.sh
@@ -110,9 +110,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_feature.sh b/test/test_feature.sh
index a4f6b94a..a557fa97 100755
--- a/test/test_feature.sh
+++ b/test/test_feature.sh
@@ -334,8 +334,7 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-unset ret
-
-endtest
-
rm -rf $dir
+
+new "endtest"
+endtest
diff --git a/test/test_feature_startup.sh b/test/test_feature_startup.sh
index ea38e293..f75cb536 100755
--- a/test/test_feature_startup.sh
+++ b/test/test_feature_startup.sh
@@ -94,8 +94,9 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-unset ret
+rm -rf $dir
+new "endtest"
endtest
-rm -rf $dir
+
diff --git a/test/test_http_data.sh b/test/test_http_data.sh
index a0e50549..63229d64 100755
--- a/test/test_http_data.sh
+++ b/test/test_http_data.sh
@@ -303,10 +303,6 @@ for proto in $protos; do
done
done
-# unset conditional parameters
-unset RCPROTO
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_identity.sh b/test/test_identity.sh
index 56b78d68..9ee499ab 100755
--- a/test/test_identity.sh
+++ b/test/test_identity.sh
@@ -401,9 +401,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
new "Endtest"
endtest
diff --git a/test/test_insert.sh b/test/test_insert.sh
index b0dec0e3..b94ee380 100755
--- a/test/test_insert.sh
+++ b/test/test_insert.sh
@@ -214,10 +214,11 @@ testrun "$x0" "32"
new "adv list add leaf-list"
testrun "$x0" "32"
-endtest
-
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_xml_mod
+new "endtest"
+endtest
+
+
+
diff --git a/test/test_instance_id.sh b/test/test_instance_id.sh
index 9859becf..8fbd28b2 100755
--- a/test/test_instance_id.sh
+++ b/test/test_instance_id.sh
@@ -325,8 +325,5 @@ done
rm -rf $dir
-unset nr
-unset clixon_util_path # for other script reusing it
-
new "endtest"
endtest
diff --git a/test/test_instance_id_multi.sh b/test/test_instance_id_multi.sh
index f6da6587..4defd80c 100755
--- a/test/test_instance_id_multi.sh
+++ b/test/test_instance_id_multi.sh
@@ -97,7 +97,6 @@ new "instance-id top-level parameter/next/parameter"
expectpart "$($clixon_util_path -f $xml1 -y $ydir -p /ex:table/ex:parameter/ex:next/ex:parameter)" 0 "0: a11" "1: b22" "2: a33"
rm -rf $dir
-unset clixon_util_path # for other script reusing it
new "endtest"
endtest
diff --git a/test/test_json.sh b/test/test_json.sh
index 1bfaef40..e8a94c91 100755
--- a/test/test_json.sh
+++ b/test/test_json.sh
@@ -140,9 +140,5 @@ expecteofx "$clixon_util_json -j -y $fyang" 0 "$JSON" "$JSON"
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_json
-unset clixon_util_xml
-
new "endtest"
endtest
diff --git a/test/test_json_list.sh b/test/test_json_list.sh
index 2aa3763e..9f1ba16d 100755
--- a/test/test_json_list.sh
+++ b/test/test_json_list.sh
@@ -94,9 +94,5 @@ testrun "three list" '{"json:c":{"l2":[{"name":1,"value":"x"},{"name":2,"value":
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_json
-unset clixon_util_xml
-
new "endtest"
endtest
diff --git a/test/test_json_null.sh b/test/test_json_null.sh
index b402ecd1..c90f78a8 100755
--- a/test/test_json_null.sh
+++ b/test/test_json_null.sh
@@ -194,9 +194,5 @@ expecteofx "$clixon_util_xml -ovJjy $fyang" 255 "$JSON" "" 2> /dev/null
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_json
-unset clixon_util_xml
-
new "endtest"
endtest
diff --git a/test/test_nacm.sh b/test/test_nacm.sh
index 869d4645..3e2584db 100755
--- a/test/test_nacm.sh
+++ b/test/test_nacm.sh
@@ -198,9 +198,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_nacm_credentials.sh b/test/test_nacm_credentials.sh
index 45f6ccf4..db9e269f 100755
--- a/test/test_nacm_credentials.sh
+++ b/test/test_nacm_credentials.sh
@@ -225,8 +225,5 @@ testrun except $USER IPv4 127.0.0.1 "$ERROR" ""
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_socket
-
new "endtest"
endtest
diff --git a/test/test_nacm_datanode.sh b/test/test_nacm_datanode.sh
index 5e5e066d..5f6ca848 100755
--- a/test/test_nacm_datanode.sh
+++ b/test/test_nacm_datanode.sh
@@ -330,9 +330,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_nacm_datanode_paths.sh b/test/test_nacm_datanode_paths.sh
index 1947f3bf..21800f0a 100755
--- a/test/test_nacm_datanode_paths.sh
+++ b/test/test_nacm_datanode_paths.sh
@@ -166,9 +166,6 @@ if [ $BE -ne 0 ]; then # Bring your own backend
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_nacm_datanode_read.sh b/test/test_nacm_datanode_read.sh
index 5131b6e4..1e930684 100755
--- a/test/test_nacm_datanode_read.sh
+++ b/test/test_nacm_datanode_read.sh
@@ -297,9 +297,6 @@ if [ $BE -ne 0 ]; then # Bring your own backend
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_nacm_datanode_write.sh b/test/test_nacm_datanode_write.sh
index 50228097..9a14b0cf 100755
--- a/test/test_nacm_datanode_write.sh
+++ b/test/test_nacm_datanode_write.sh
@@ -295,9 +295,6 @@ if [ $BE -ne 0 ]; then # Bring your own backend
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_nacm_default.sh b/test/test_nacm_default.sh
index 220ad6a4..75228f63 100755
--- a/test/test_nacm_default.sh
+++ b/test/test_nacm_default.sh
@@ -229,13 +229,10 @@ for db in startup init; do
done
-endtest
-
rm -rf $dir
-# Set by restconf_config
-unset RESTCONFIG
+new "endtest"
+endtest
+
+
-# unset conditional parameters
-unset format
-unset ret
diff --git a/test/test_nacm_ext.sh b/test/test_nacm_ext.sh
index 14c781f4..eb4a1d78 100755
--- a/test/test_nacm_ext.sh
+++ b/test/test_nacm_ext.sh
@@ -272,9 +272,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_nacm_module_read.sh b/test/test_nacm_module_read.sh
index 4b37a13e..a95d6e64 100755
--- a/test/test_nacm_module_read.sh
+++ b/test/test_nacm_module_read.sh
@@ -324,10 +324,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-unset ret
-
rm -rf $dir
new "endtest"
diff --git a/test/test_nacm_module_write.sh b/test/test_nacm_module_write.sh
index bd8d51d0..96b54fc2 100755
--- a/test/test_nacm_module_write.sh
+++ b/test/test_nacm_module_write.sh
@@ -299,9 +299,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_nacm_protocol.sh b/test/test_nacm_protocol.sh
index 3fbe5fc9..4a8947fd 100755
--- a/test/test_nacm_protocol.sh
+++ b/test/test_nacm_protocol.sh
@@ -234,9 +234,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_nacm_recovery.sh b/test/test_nacm_recovery.sh
index eb378cba..403b0bff 100755
--- a/test/test_nacm_recovery.sh
+++ b/test/test_nacm_recovery.sh
@@ -225,7 +225,4 @@ testrun $CRED $REALUSER $PSEUDO $RECOVERY false false
new "endtest"
endtest
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
diff --git a/test/test_netconf_monitoring.sh b/test/test_netconf_monitoring.sh
index 4bdb84b6..63b64a60 100755
--- a/test/test_netconf_monitoring.sh
+++ b/test/test_netconf_monitoring.sh
@@ -177,12 +177,12 @@ EOF
continue
fi
# Mask netconf header and footer
- sed -i -e "s///" /var/tmp/test_netconf_monitoring.sh/ex.yang
- sed -i -e 's/<\/data><\/rpc-reply>]]>]]>//' /var/tmp/test_netconf_monitoring.sh/ex.yang
+ sed -i -e "s///" $dir/ex.yang
+ sed -i -e 's/<\/data><\/rpc-reply>]]>]]>//' $dir/ex.yang
# Decode XML
- sed -i -e 's/>/>/g' /var/tmp/test_netconf_monitoring.sh/ex.yang
- sed -i -e 's/<//g' $dir/ex.yang
+ sed -i -e 's/</ /dev/null)" ]; then
fi # expect
-unset validatexml
-unset perfnr
-unset xpath
unset xpath0
rm -rf $dir
diff --git a/test/test_perf_cli.sh b/test/test_perf_cli.sh
index ddc3b84e..ab5739c9 100755
--- a/test/test_perf_cli.sh
+++ b/test/test_perf_cli.sh
@@ -162,10 +162,5 @@ fi
rm -rf $dir
-# unset conditional parameters
-unset format
-unset perfnr
-unset perfreq
-
new "endtest"
endtest
diff --git a/test/test_perf_json.sh b/test/test_perf_json.sh
index f65a7528..b8a35b4a 100755
--- a/test/test_perf_json.sh
+++ b/test/test_perf_json.sh
@@ -25,9 +25,5 @@ expecteof_file "time -p $clixon_util_json" 0 "$fjson" 2>&1 | awk '/real/ {print
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_xml
-unset perfnr
-
new "endtest"
endtest
diff --git a/test/test_perf_netconf.sh b/test/test_perf_netconf.sh
index 0e9493e1..f69acfd4 100755
--- a/test/test_perf_netconf.sh
+++ b/test/test_perf_netconf.sh
@@ -242,10 +242,5 @@ fi
rm -rf $dir
-# unset conditional parameters
-unset format
-unset perfnr
-unset perfreq
-
new "endtest"
endtest
diff --git a/test/test_perf_restconf.sh b/test/test_perf_restconf.sh
index e6416eb9..378f4dc0 100755
--- a/test/test_perf_restconf.sh
+++ b/test/test_perf_restconf.sh
@@ -240,20 +240,8 @@ if [ $BE -ne 0 ]; then
# kill backend
stop_backend -f $cfg
fi
+
rm -rf $dir
-# Set by restconf_config
-unset RESTCONFIG
-unset HAVE_LIBNGHTTP2
-unset RCPROTO
-unset HVER
-unset CURLOPTS
-
-# unset conditional parameters
-unset format
-unset perfnr
-unset perfreq
-unset ret
-
new "endtest"
endtest
diff --git a/test/test_perf_restconf_ssl.sh b/test/test_perf_restconf_ssl.sh
index 7beb0b39..eb00b877 100755
--- a/test/test_perf_restconf_ssl.sh
+++ b/test/test_perf_restconf_ssl.sh
@@ -256,16 +256,5 @@ if [ $BE -ne 0 ]; then
fi
rm -rf $dir
-# Set by restconf_config
-unset RESTCONFIG
-unset HAVE_LIBNGHTTP2
-unset RCPROTO
-
-# unset conditional parameters
-unset format
-unset perfnr
-unset perfreq
-unset ret
-
new "endtest"
endtest
diff --git a/test/test_perf_startup.sh b/test/test_perf_startup.sh
index cd1487c7..517299b3 100755
--- a/test/test_perf_startup.sh
+++ b/test/test_perf_startup.sh
@@ -161,9 +161,5 @@ done
rm -rf $dir
-# unset conditional parameters
-unset perfnr
-unset format
-
new "endtest"
endtest
diff --git a/test/test_perf_state.sh b/test/test_perf_state.sh
index ca8120d1..bcb484a7 100755
--- a/test/test_perf_state.sh
+++ b/test/test_perf_state.sh
@@ -223,13 +223,5 @@ fi
rm -rf $dir
-# unset conditional parameters
-unset format
-unset perfnr
-unset perfreq
-
-# Set by restconf_config
-unset RESTCONFIG
-
new "endtest"
endtest
diff --git a/test/test_perf_state_only.sh b/test/test_perf_state_only.sh
index 3c4b2670..be525860 100755
--- a/test/test_perf_state_only.sh
+++ b/test/test_perf_state_only.sh
@@ -202,13 +202,5 @@ fi
rm -rf $dir
-# Set by restconf_config
-unset RESTCONFIG
-
-# unset conditional parameters
-unset format
-unset perfnr
-unset perfreq
-
new "endtest"
endtest
diff --git a/test/test_perf_xml.sh b/test/test_perf_xml.sh
index 5375704a..1ec8abd3 100755
--- a/test/test_perf_xml.sh
+++ b/test/test_perf_xml.sh
@@ -26,9 +26,5 @@ expecteof_file "time -p $clixon_util_xml" 0 "$fxml" 2>&1 | awk '/real/ {print $2
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_xml
-unset perfnr
-
new "endtest"
endtest
diff --git a/test/test_restconf.sh b/test/test_restconf.sh
index d006a8e6..a9742247 100755
--- a/test/test_restconf.sh
+++ b/test/test_restconf.sh
@@ -696,14 +696,8 @@ for proto in $protos; do
done
done
-# unset conditional parameters
-unset HVER
-unset RCPROTO
-
# Set by restconf_config
-unset RESTCONFIG
unset RESTCONFIG1
-unset ret
rm -rf $dir
diff --git a/test/test_restconf_basic_auth.sh b/test/test_restconf_basic_auth.sh
index 0b6a75dd..f8cbc089 100755
--- a/test/test_restconf_basic_auth.sh
+++ b/test/test_restconf_basic_auth.sh
@@ -288,8 +288,6 @@ if [ $BE -ne 0 ]; then
fi
# unset conditional parameters
-unset RCPROTO
-unset HVER
unset RESTCONFIG1
unset MSGANON
unset MSGWILMA
diff --git a/test/test_restconf_continue.sh b/test/test_restconf_continue.sh
index 24c5c2b2..e3b59b63 100755
--- a/test/test_restconf_continue.sh
+++ b/test/test_restconf_continue.sh
@@ -130,13 +130,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-unset nr
-unset HAVE_LIBNGHTTP2
-unset CURLOPTS
-unset HVER
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_err.sh b/test/test_restconf_err.sh
index 53b7a08d..cd545f64 100755
--- a/test/test_restconf_err.sh
+++ b/test/test_restconf_err.sh
@@ -346,13 +346,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-unset HVER
-unset RCPROTO
-unset CURLOPTS
-unset HAVE_LIBNGHTTP2
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_http_upgrade.sh b/test/test_restconf_http_upgrade.sh
index 66393e19..6de3a890 100755
--- a/test/test_restconf_http_upgrade.sh
+++ b/test/test_restconf_http_upgrade.sh
@@ -192,10 +192,6 @@ testrun false
new "enable plain http/2"
testrun true
-# Set by restconf_config
-unset RESTCONFIG
-unset RCPROTO
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_internal.sh b/test/test_restconf_internal.sh
index c81ec7b1..2bedd838 100755
--- a/test/test_restconf_internal.sh
+++ b/test/test_restconf_internal.sh
@@ -499,13 +499,9 @@ new "endtest"
endtest
# Set by restconf_config
-unset HVER
-unset LOGDST
unset LOGDST_CMD
unset pid
-unset RESTCONFIG
unset RESTCONFDBG
-unset RCPROTO
unset retx
rm -rf $dir
diff --git a/test/test_restconf_internal_usecases.sh b/test/test_restconf_internal_usecases.sh
index f8ffff39..dbffe615 100755
--- a/test/test_restconf_internal_usecases.sh
+++ b/test/test_restconf_internal_usecases.sh
@@ -474,13 +474,10 @@ new "endtest"
endtest
# Set by restconf_config
-unset LOGDST
unset LOGDST_CMD
unset RESTCONFIG1
unset RESTCONFIG2
unset RESTCONFDBG
-unset RCPROTO
-unset HVER
rm -rf $dir
diff --git a/test/test_restconf_jukebox.sh b/test/test_restconf_jukebox.sh
index b362f904..dc6d96a0 100755
--- a/test/test_restconf_jukebox.sh
+++ b/test/test_restconf_jukebox.sh
@@ -270,9 +270,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_listkey.sh b/test/test_restconf_listkey.sh
index 3d3031e5..28ebcd1e 100755
--- a/test/test_restconf_listkey.sh
+++ b/test/test_restconf_listkey.sh
@@ -227,9 +227,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_nmap.sh b/test/test_restconf_nmap.sh
index 3f8ac4c7..e93205f0 100755
--- a/test/test_restconf_nmap.sh
+++ b/test/test_restconf_nmap.sh
@@ -200,13 +200,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# unset conditional parameters
-unset RCPROTO
-
-# Set by restconf_config
-unset result
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_notifications.sh b/test/test_restconf_notifications.sh
index 9ca06510..bc521088 100755
--- a/test/test_restconf_notifications.sh
+++ b/test/test_restconf_notifications.sh
@@ -317,13 +317,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
-# unset conditional parameters
-unset clixon_util_stream
-unset nr
-
new "Endtest"
endtest
diff --git a/test/test_restconf_op.sh b/test/test_restconf_op.sh
index 847e4d66..ed050c76 100755
--- a/test/test_restconf_op.sh
+++ b/test/test_restconf_op.sh
@@ -257,10 +257,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-unset ret
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_plain_patch.sh b/test/test_restconf_plain_patch.sh
index 14c89b8d..1126723a 100755
--- a/test/test_restconf_plain_patch.sh
+++ b/test/test_restconf_plain_patch.sh
@@ -280,9 +280,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_ssl_certs.sh b/test/test_restconf_ssl_certs.sh
index a2e4257e..eb94926a 100755
--- a/test/test_restconf_ssl_certs.sh
+++ b/test/test_restconf_ssl_certs.sh
@@ -347,7 +347,5 @@ testrun
rm -rf $dir
-# unset conditional parameters
-unset RCPROTO
-
+new "endtest"
endtest
diff --git a/test/test_restconf_startup.sh b/test/test_restconf_startup.sh
index 13baa444..75c0605f 100755
--- a/test/test_restconf_startup.sh
+++ b/test/test_restconf_startup.sh
@@ -136,9 +136,6 @@ if [ -f $dir/startup_db ]; then
err "startup should not exist"
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_yang_patch_json.sh b/test/test_restconf_yang_patch_json.sh
index fd417fe4..96d8df09 100755
--- a/test/test_restconf_yang_patch_json.sh
+++ b/test/test_restconf_yang_patch_json.sh
@@ -327,9 +327,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_restconf_yang_patch_xml.sh b/test/test_restconf_yang_patch_xml.sh
index 8e263b35..039ea4f1 100755
--- a/test/test_restconf_yang_patch_xml.sh
+++ b/test/test_restconf_yang_patch_xml.sh
@@ -303,9 +303,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_rpc.sh b/test/test_rpc.sh
index d70d8b28..fa3080b4 100755
--- a/test/test_rpc.sh
+++ b/test/test_rpc.sh
@@ -376,9 +376,6 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_search_index.sh b/test/test_search_index.sh
index 246cf41d..739225e7 100755
--- a/test/test_search_index.sh
+++ b/test/test_search_index.sh
@@ -93,8 +93,5 @@ new "non-index search latency j=$rndi"
rm -rf $dir
-unset nr
-unset clixon_util_path # for other script reusing it
-
new "endtest"
endtest
diff --git a/test/test_sock.sh b/test/test_sock.sh
index d2feadd5..665ca45a 100755
--- a/test/test_sock.sh
+++ b/test/test_sock.sh
@@ -100,8 +100,5 @@ testrun IPv4 127.0.0.1
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_socket
-
new "endtest"
endtest
diff --git a/test/test_startup.sh b/test/test_startup.sh
index 39f694ff..de598dda 100755
--- a/test/test_startup.sh
+++ b/test/test_startup.sh
@@ -232,8 +232,5 @@ fi
rm -rf $dir
-# unset conditional parameters
-unset format
-
new "endtest"
endtest
diff --git a/test/test_submodule.sh b/test/test_submodule.sh
index d2a08c71..c7039422 100755
--- a/test/test_submodule.sh
+++ b/test/test_submodule.sh
@@ -286,9 +286,6 @@ if [ $BE -ne 0 ]; then
sudo pkill -u root -f clixon_backend
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_transaction.sh b/test/test_transaction.sh
index 34d11292..337f8f34 100755
--- a/test/test_transaction.sh
+++ b/test/test_transaction.sh
@@ -459,7 +459,5 @@ fi
rm -rf $dir
-unset nr
-
new "endtest"
endtest
diff --git a/test/test_transaction_restart.sh b/test/test_transaction_restart.sh
index 3f646e5f..c4662b46 100755
--- a/test/test_transaction_restart.sh
+++ b/test/test_transaction_restart.sh
@@ -144,7 +144,5 @@ fi
rm -rf $dir
-unset nr
-
new "endtest"
endtest
diff --git a/test/test_type_range.sh b/test/test_type_range.sh
index 9d8e94d3..536ac6ff 100755
--- a/test/test_type_range.sh
+++ b/test/test_type_range.sh
@@ -330,8 +330,5 @@ fi
rm -rf $dir
-# unset conditional parameters
-unset format
-
new "endtest"
endtest
diff --git a/test/test_upgrade_checkold.sh b/test/test_upgrade_checkold.sh
index fb582c7d..14102853 100755
--- a/test/test_upgrade_checkold.sh
+++ b/test/test_upgrade_checkold.sh
@@ -147,6 +147,7 @@ done
done
rm -rf $dir
+# unset specific variables set in this script
unset j
unset xml
unset xmltag
diff --git a/test/test_upgrade_failsafe.sh b/test/test_upgrade_failsafe.sh
index 8aa98a5a..df132aa5 100755
--- a/test/test_upgrade_failsafe.sh
+++ b/test/test_upgrade_failsafe.sh
@@ -383,8 +383,5 @@ fi # valgrindtest
rm -rf $dir
new "endtest"
-
-unset ret
-
endtest
diff --git a/test/test_xml.sh b/test/test_xml.sh
index 61d917bc..f5634873 100755
--- a/test/test_xml.sh
+++ b/test/test_xml.sh
@@ -214,8 +214,5 @@ expecteof "$clixon_util_xml -o" 0 "$XML" '^12$x0b" "$x0a2<
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_xml
-
new "endtest"
endtest
diff --git a/test/test_xpath.sh b/test/test_xpath.sh
index 044c15c4..1f5c7d18 100755
--- a/test/test_xpath.sh
+++ b/test/test_xpath.sh
@@ -452,8 +452,5 @@ expectpart "$($clixon_util_xpath -D $DBG -f $dir/1.xml -n ex:urn:example:clixon
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_xpath
-
new "endtest"
endtest
diff --git a/test/test_xpath_canonical.sh b/test/test_xpath_canonical.sh
index d869fb9e..dad70c6a 100755
--- a/test/test_xpath_canonical.sh
+++ b/test/test_xpath_canonical.sh
@@ -64,8 +64,5 @@ expectpart "$($clixon_util_xpath -c -y $ydir -p /i:x/j:y -n i:urn:example:c -n j
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_xpath
-
new "endtest"
endtest
diff --git a/test/test_xpath_inverse.sh b/test/test_xpath_inverse.sh
index cb99a6cc..8b786bae 100755
--- a/test/test_xpath_inverse.sh
+++ b/test/test_xpath_inverse.sh
@@ -84,8 +84,5 @@ expectpart "$($clixon_util_xpath -If $xml1 -y $ydir -p /a:x/a:z[a:k='2'] -n b:ur
rm -rf $dir
-# unset conditional parameters
-unset clixon_util_xpath
-
new "endtest"
endtest
diff --git a/test/test_yang_anydata.sh b/test/test_yang_anydata.sh
index be3b5fa9..0d85caa7 100755
--- a/test/test_yang_anydata.sh
+++ b/test/test_yang_anydata.sh
@@ -279,9 +279,6 @@ testrun false true
new "4. startup, treat unknown as anydata----"
testrun true true
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
new "endtest"
diff --git a/test/test_yang_default.sh b/test/test_yang_default.sh
index 761e50ce..f9c32e20 100755
--- a/test/test_yang_default.sh
+++ b/test/test_yang_default.sh
@@ -177,7 +177,5 @@ fi
rm -rf $dir
-unset ret
-
new "endtest"
endtest
diff --git a/test/test_yang_namespace.sh b/test/test_yang_namespace.sh
index 605e5156..720674ed 100755
--- a/test/test_yang_namespace.sh
+++ b/test/test_yang_namespace.sh
@@ -143,12 +143,7 @@ if [ $BE -ne 0 ]; then
stop_backend -f $cfg
fi
-# Set by restconf_config
-unset RESTCONFIG
-
rm -rf $dir
-unset ret
-
new "endtest"
endtest
diff --git a/test/test_yang_wdcc.sh b/test/test_yang_wdcc.sh
index 2b1474d7..fd394f86 100755
--- a/test/test_yang_wdcc.sh
+++ b/test/test_yang_wdcc.sh
@@ -249,7 +249,5 @@ fi
rm -rf $dir
-unset ret
-
new "endtest"
endtest
diff --git a/test/test_yang_with_defaults.sh b/test/test_yang_with_defaults.sh
index 6ffb4da3..194ccf5c 100755
--- a/test/test_yang_with_defaults.sh
+++ b/test/test_yang_with_defaults.sh
@@ -649,7 +649,5 @@ fi
rm -rf $dir
-unset ret
-
new "endtest"
endtest