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 <kchai@redhat.com>
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
numtests=$(($numtests + 3))
done
-done
+done < <(ceph-dencoder list_types)
rm -f $tmp1 $tmp2 $tmp3 $tmp4