From 06ec75e14b314d225edbad79284bde92270f600c Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sun, 5 Apr 2020 13:51:39 +0200 Subject: [PATCH] test fixes --- test/test_api_path.sh | 10 ---------- test/test_perf_state_only.sh | 8 ++++---- util/clixon_util_path.c | 4 ++-- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/test/test_api_path.sh b/test/test_api_path.sh index 1f9c4b9b..408374e0 100755 --- a/test/test_api_path.sh +++ b/test/test_api_path.sh @@ -145,11 +145,9 @@ done echo -n '' >> $xml1 new "api-path single string key k1=a$rnd" -echo "$clixon_util_path -f $xml1 -y $ydir -p /moda:x1/y=a$rnd" expectpart "$($clixon_util_path -f $xml1 -y $ydir -p /moda:x1/y=a$rnd)" 0 "^0: a$rndfoo$rnd$" new "api-path single string key /x1" -echo "$clixon_util_path -f $xml1 -y $ydir -p /moda:x1" expectpart "$($clixon_util_path -f $xml1 -y $ydir -p /moda:x1)" 0 "0: a0foo0a1foo1" # Assume at least two elements new "api-path single string key omit key" @@ -183,7 +181,6 @@ done echo -n '' >> $xml2 new "api-path single int key k1=$rnd" -echo "$clixon_util_path -f $xml2 -y $ydir -p /moda:x2/y=$rnd" expectpart "$($clixon_util_path -f $xml2 -y $ydir -p /moda:x2/y=$rnd)" 0 "^0: $rndfoo$rnd$" # Double string key @@ -199,15 +196,12 @@ echo -n "a1foo1" >> $xml3 echo -n '' >> $xml3 new "api-path double string key k1=a$rnd,b$rnd" -echo "$clixon_util_path -f $xml3 -y $ydir -p /moda:x3/y=a$rnd,b$rnd" expectpart "$($clixon_util_path -f $xml3 -y $ydir -p /moda:x3/y=a$rnd,b$rnd)" 0 "0: a$rndb$rndfoob$rnd" new "api-path double string key k1=a$rnd, - empty k2 string" -echo "$clixon_util_path -f $xml3 -y $ydir -p /moda:x3/y=a1," expectpart "$($clixon_util_path -f $xml3 -y $ydir -p /moda:x3/y=a1,)" 0 "0: a1foo1" new "api-path double string key k1=a$rnd, - no k2 string - three matches" -echo "$clixon_util_path -f $xml3 -y $ydir -p /moda:x3/y=a1" expecteq "$($clixon_util_path -f $xml3 -y $ydir -p /moda:x3/y=a1)" 0 "0: a1foo1 1: a1a1foo1 2: a1b1foob1" @@ -221,7 +215,6 @@ done echo -n '' >> $xml4 new "api-path leaf-list k1=a$rnd" -echo "$clixon_util_path -f $xml4 -y $ydir -p /moda:x4/y=a$rnd" expectpart "$($clixon_util_path -f $xml4 -y $ydir -p /moda:x4/y=a$rnd)" 0 "^0: a$rnd$" # Single string key direct under root @@ -232,7 +225,6 @@ for (( i=0; i<$nr; i++ )); do done new "api-path direct under root single string key k1=a$rnd" -echo "$clixon_util_path -f $xml5 -y $ydir -p /moda:x5=a$rnd" expectpart "$($clixon_util_path -f $xml5 -y $ydir -p /moda:x5=a$rnd)" 0 "^0: a$rndfoo$rnd$" # Depth and augment @@ -249,11 +241,9 @@ done echo -n '' >> $xml6 new "api-path double string key k1=b$rnd,b$rnd in modb" -echo "$clixon_util_path -f $xml6 -y $ydir -p /modb:x6/yy=b$rnd,b$rnd" expectpart "$($clixon_util_path -f $xml6 -y $ydir -p /modb:x6/yy=b$rnd,b$rnd)" 0 "0: b$rndb$rndfoo$rnda0a0foo0a1a1foo1a2a2foo2" new "api-path double string key k1=a$rnd,b$rnd in modb + augmented in moda" -echo "$clixon_util_path -f $xml6 -y $ydir -p /modb:x6/yy=b$rnd,b$rnd/moda:y=a1,a1" 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 diff --git a/test/test_perf_state_only.sh b/test/test_perf_state_only.sh index c6015c2a..82193cc5 100755 --- a/test/test_perf_state_only.sh +++ b/test/test_perf_state_only.sh @@ -99,10 +99,10 @@ if [ $BE -ne 0 ]; then new "start backend -s init -f $cfg -- -sS $fstate" start_backend -s init -f $cfg -- -sS $fstate -fi -new "waiting" -wait_backend + new "waiting" + wait_backend +fi new "kill old restconf daemon" sudo pkill -u $wwwuser -f clixon_restconf @@ -112,7 +112,7 @@ start_restconf -f $cfg new "waiting" wait_restconf -exit + if false; then new "generate 'large' config with $perfnr list entries" echo -n "foo" > $fconfig diff --git a/util/clixon_util_path.c b/util/clixon_util_path.c index bbe1dea6..7aff8f01 100644 --- a/util/clixon_util_path.c +++ b/util/clixon_util_path.c @@ -223,9 +223,9 @@ main(int argc, if (xml_bind_yang(x, YB_MODULE, yspec, NULL) < 0) goto done; /* sort */ - if (xml_apply(x, CX_ELMNT, xml_sort, h) < 0) + if (xml_apply0(x, CX_ELMNT, xml_sort, h) < 0) goto done; - if (xml_apply(x, -1, xml_sort_verify, h) < 0) + if (xml_apply0(x, -1, xml_sort_verify, h) < 0) clicon_log(LOG_NOTICE, "%s: sort verify failed", __FUNCTION__); /* Add default values */ if (xml_apply(x, CX_ELMNT, xml_default, h) < 0)