diff --git a/apps/restconf/README.md b/apps/restconf/README.md index 26935464..35afad43 100644 --- a/apps/restconf/README.md +++ b/apps/restconf/README.md @@ -29,7 +29,7 @@ Edit the nginx config file. (On Ubuntu: `/etc/nginx/sites-available/default`, on ``` server { ... - location /restconf { + location / { fastcgi_pass unix:/www-data/fastcgi_restconf.sock; include fastcgi_params; } diff --git a/test/lib.sh b/test/lib.sh index 87f3d8fb..27c994b6 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -5,6 +5,7 @@ # - expectfn # - expecteq # - expecteof +# - expecteofeq # - expecteofx # - expecteof_file # - expectwait @@ -421,6 +422,10 @@ EOF # Like expecteof but with grep -Fxq instead of -EZq. Ie implicit ^$ # Use this for fixed all line, ie must match exact. +# - Command +# - expected command return value (0 if OK) +# - stdin input +# - expected stdout outcome expecteofx(){ cmd=$1 retval=$2 @@ -463,6 +468,10 @@ EOF # Like expecteof/expecteofx but with test == instead of grep. # No wildcards # Use this for multi-lines +# # - Command +# - expected command return value (0 if OK) +# - stdin input +# - expected stdout outcome expecteofeq(){ cmd=$1 retval=$2 @@ -498,13 +507,24 @@ EOF # clixon tester read from file for large tests +# Arguments: +# - Command +# - Filename to pipe to stdin +# - expected stdout outcome expecteof_file(){ cmd=$1 - file=$2 - expect=$3 + retval=$2 + file=$3 + expect=$4 -# Do while read stuff -ret=$($cmd<$file) + # Run the command, pipe stdin from file + ret=$($cmd<$file) + r=$? + if [ $r != $retval ]; then + echo -e "\e[31m\nError ($r != $retval) in Test$testnr [$testname]:" + echo -e "\e[0m:" + exit -1 + fi # Match if both are empty string if [ -z "$ret" -a -z "$expect" ]; then return diff --git a/test/long.sh b/test/long.sh index d28ed2ec..754561f8 100755 --- a/test/long.sh +++ b/test/long.sh @@ -92,7 +92,7 @@ echo "]]>]]>" >> $fconfig # Now take large config file and write it via netconf to candidate new "netconf write large config" -expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig" "^]]>]]>$" +expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" # Now commit it from candidate to running new "netconf commit large config" diff --git a/test/plot_perf.sh b/test/plot_perf.sh index 8dee007f..2df88683 100755 --- a/test/plot_perf.sh +++ b/test/plot_perf.sh @@ -227,7 +227,7 @@ load(){ # Generate file ($fxml) genfile $1 netconf # Write it to backend in one chunk - expecteof_file "$clixon_netconf -qf $cfg -y $fyang" "$fxml" "^]]>]]>$" + expecteof_file "$clixon_netconf -qf $cfg -y $fyang" 0 "$fxml" "^]]>]]>$" } # Run an operation, iterate from to in increment of diff --git a/test/test_perf.sh b/test/test_perf.sh index 9d5474c7..21d121f1 100755 --- a/test/test_perf.sh +++ b/test/test_perf.sh @@ -98,11 +98,11 @@ echo "]]>]]>" >> $fconfig # Now take large config file and write it via netconf to candidate new "netconf write large config" -expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig" "^]]>]]>$" +expecteof_file "time $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" # Here, there are $perfnr entries in candidate new "netconf write large config again" -expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig" "^]]>]]>$" +expecteof_file "time -f %e $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" # Now commit it from candidate to running new "netconf commit large config" @@ -208,7 +208,7 @@ done echo "]]>]]>" >> $fconfig2 new "netconf replace large list-leaf config" -expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig2" "^]]>]]>$" +expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" 0 "$fconfig2" "^]]>]]>$" new "netconf commit large leaf-list config" expecteof "/usr/bin/time -f %e $clixon_netconf -qf $cfg" 0 "]]>]]>" "^]]>]]>$" diff --git a/test/test_perf_state.sh b/test/test_perf_state.sh index 417136f4..82c55f55 100755 --- a/test/test_perf_state.sh +++ b/test/test_perf_state.sh @@ -76,7 +76,7 @@ echo "]]>]]>" >> $fconfig # Now take large config file and write it via netconf to candidate new "netconf write large config" -expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" "$fconfig" "^]]>]]>$" +expecteof_file "/usr/bin/time -f %e $clixon_netconf -qf $cfg" 0 "$fconfig" "^]]>]]>$" # Now commit it from candidate to running new "netconf commit large config"