test: Corrected and documents -v vs -V transaction testing

This commit is contained in:
Olof hagsand 2025-03-13 14:32:08 +01:00
parent ea64bb3f3d
commit 839077de57
4 changed files with 7 additions and 6 deletions

View file

@ -49,7 +49,7 @@
* -U general-purpose upgrade * -U general-purpose upgrade
* -t enable transaction logging (call syslog for every transaction) * -t enable transaction logging (call syslog for every transaction)
* -V <xpath> Failing validate and commit if <xpath> is present (synthetic error) * -V <xpath> Failing validate and commit if <xpath> is present (synthetic error)
* Note example_backend uses -v
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -39,6 +39,7 @@
* - transaction test * - transaction test
* -t enable transaction logging (call syslog for every transaction) * -t enable transaction logging (call syslog for every transaction)
* -v <xpath> Failing validate and commit if <xpath> is present (synthetic error) * -v <xpath> Failing validate and commit if <xpath> is present (synthetic error)
* Note example_backend uses -V
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -152,8 +152,8 @@ if [ $BE -ne 0 ]; then
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
err err
fi fi
new "start backend -s init -f $cfg -l f$flog -- -t -V \"/x/y[a='$errnr']\"" new "start backend -s init -f $cfg -l f$flog -- -t -v \"/x/y[a='$errnr']\""
start_backend -s init -f $cfg -l f$flog -- -t -V "/x/y[a='$errnr']" # -t means transaction logging start_backend -s init -f $cfg -l f$flog -- -t -v "/x/y[a='$errnr']" # -t means transaction logging
fi fi
new "wait backend" new "wait backend"

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Transaction functionality: Start from startup and ensure # Transaction functionality: Start from startup and ensure
# first transaction is OK including diff # first transaction is OK including diff
# See eg https://github.com/clicon/clixon/issues/596 # See eg https://github.com/clicon/clixon/issues/596
@ -72,7 +72,7 @@ function checklog(){
t=$(grep -n "transaction_log $s" $flog) t=$(grep -n "transaction_log $s" $flog)
if [ -z "$t" ]; then if [ -z "$t" ]; then
echo -e "\e[31m\nError in Test$testnr [$testname]:" echo -e "\e[31m\nError in Test$testnr [$testname]:"
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
echo "Not found \"$s\" on line $l0" echo "Not found \"$s\" on line $l0"
echo echo
fi fi
@ -82,7 +82,7 @@ function checklog(){
l1=$(echo "$t" | awk -F ":" '{print $1}') l1=$(echo "$t" | awk -F ":" '{print $1}')
if [ $l1 -ne $l0 ]; then if [ $l1 -ne $l0 ]; then
echo -e "\e[31m\nError in Test$testnr [$testname]:" echo -e "\e[31m\nError in Test$testnr [$testname]:"
if [ $# -gt 0 ]; then if [ $# -gt 0 ]; then
echo "Expected match on line $l0, found on $l1" echo "Expected match on line $l0, found on $l1"
echo echo
fi fi