local nobj=$3
local rfile=$4
remote_shell $host $lctl --device $devno create $nobj > $rfile 2>&1
- n=(`awk < $rfile \
- '/is object id/ {obj=strtonum($6);\
- first=!not_first; not_first=1;\
- if (first) first_obj=obj;
- else if (obj != prev + 1) exit;\
- prev=obj; n++}\
- END {printf "%d %d\n", first_obj, n}'`)
- if ((n[1] != nobj)); then
- echo "ERROR"
- else
- echo ${n[0]}
+ first=0
+ prev=0
+ count=0
+ error=0
+ while read line; do
+ echo "$line" | grep -q 'is object id'
+ if [ $? -ne 0 ]; then
+ continue
+ fi
+ if [ $first -eq 0 ]; then
+ first=$(echo $line | awk '{print $6}')
+ first=$(printf "%d" $first)
+ prev=$first
+ count=1
+ else
+ obj=$(echo $line | awk '{print $6}')
+ obj=$(printf "%d" $obj)
+ diff=$((obj - (prev+1)))
+ if [ $diff -ne 0 ]; then
+ error=1
+ fi
+ prev=$obj
+ count=$((count+1))
+ fi
+ done < $rfile
+ if [ $nobj -ne $count ]; then
+ echo "ERROR: $nobj != $count" >&2
+ cat $rfile >&2
+ echo "ERROR"
+ elif [ $error -ne 0 ]; then
+ echo "ERROR: non contiguous objs found" >&2
+ echo "ERROR"
+ else
+ echo $first
fi
}
first_objs[$idx]=$first_obj
done
# run tests
- for test in write $tests; do
+ for test in ${tests[@]}; do
print_summary -n "$test "
# create per-host script files
for host in ${unique_hosts[@]}; do