From: Kefu Chai Date: Sun, 25 Aug 2019 04:09:24 +0000 (+0800) Subject: test/encoding/check-generated.sh: run loop in the same shell X-Git-Tag: v15.1.0~1760^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=2c5e59c1fb8064078343e1e8b8b491751bcd9245;p=ceph-ci.git test/encoding/check-generated.sh: run loop in the same shell set parent scope variables in the same shell. foo | while read .... in the above statement, `while read ...` is executed in a subshell. so it cannot change the bash variables in its parent shell. in this change, the output of `foo` is redirected to the stdin of `while read` statement. so we can capture the test failures. before this change, the test always succeed, even if there are failures. Signed-off-by: Kefu Chai --- diff --git a/src/test/encoding/check-generated.sh b/src/test/encoding/check-generated.sh index 55a9195db85..2726d64941a 100755 --- a/src/test/encoding/check-generated.sh +++ b/src/test/encoding/check-generated.sh @@ -15,7 +15,7 @@ failed=0 numtests=0 echo "checking ceph-dencoder generated test instances..." echo "numgen type" -ceph-dencoder list_types | while read type; do +while read type; do num=`ceph-dencoder type $type count_tests` echo "$num $type" for n in `seq 1 1 $num 2>/dev/null`; do @@ -90,7 +90,7 @@ ceph-dencoder list_types | while read type; do numtests=$(($numtests + 3)) done -done +done < <(ceph-dencoder list_types) rm -f $tmp1 $tmp2 $tmp3 $tmp4