mirror of
https://github.com/ceph/ceph
synced 2025-02-22 10:37:15 +00:00
test/encoding/readable.sh: join children at finish
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
1325ba672d
commit
c8a349eb46
@ -169,34 +169,7 @@ waitall() { # PID...
|
||||
# MAIN
|
||||
######
|
||||
|
||||
# Using $MAX_PARALLEL_JOBS jobs if defined, unless the number of logical
|
||||
# processors
|
||||
if [ `uname` == FreeBSD ]; then
|
||||
NPROC=`sysctl -n hw.ncpu`
|
||||
max_parallel_jobs=${MAX_PARALLEL_JOBS:-${NPROC}}
|
||||
else
|
||||
max_parallel_jobs=${MAX_PARALLEL_JOBS:-$(nproc)}
|
||||
fi
|
||||
|
||||
for arversion in `ls $dir/archive | sort -n`; do
|
||||
vdir="$dir/archive/$arversion"
|
||||
#echo $vdir
|
||||
|
||||
if [ ! -d "$vdir/objects" ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
output_file=`mktemp /tmp/typ-XXXXXXXXX`
|
||||
running_jobs=0
|
||||
for type in `ls $vdir/objects`; do
|
||||
test_object $type $output_file.$running_jobs &
|
||||
pids="$pids $!"
|
||||
running_jobs=$(($running_jobs + 1))
|
||||
|
||||
# Once we spawned enough jobs, let's wait them to complete
|
||||
# Every spawned job have almost the same execution time so
|
||||
# it's not a big deal having them not ending at the same time
|
||||
if [ "$running_jobs" -eq "$max_parallel_jobs" ]; then
|
||||
do_join() {
|
||||
waitall $pids
|
||||
pids=""
|
||||
# Reading the output of jobs to compute failed & numtests
|
||||
@ -213,10 +186,44 @@ for arversion in `ls $dir/archive | sort -n`; do
|
||||
running_jobs=$(($running_jobs - 1))
|
||||
done
|
||||
running_jobs=0
|
||||
}
|
||||
|
||||
# Using $MAX_PARALLEL_JOBS jobs if defined, unless the number of logical
|
||||
# processors
|
||||
if [ `uname` == FreeBSD ]; then
|
||||
NPROC=`sysctl -n hw.ncpu`
|
||||
max_parallel_jobs=${MAX_PARALLEL_JOBS:-${NPROC}}
|
||||
else
|
||||
max_parallel_jobs=${MAX_PARALLEL_JOBS:-$(nproc)}
|
||||
fi
|
||||
|
||||
output_file=`mktemp /tmp/typ-XXXXXXXXX`
|
||||
running_jobs=0
|
||||
|
||||
for arversion in `ls $dir/archive | sort -n`; do
|
||||
vdir="$dir/archive/$arversion"
|
||||
#echo $vdir
|
||||
|
||||
if [ ! -d "$vdir/objects" ]; then
|
||||
continue;
|
||||
fi
|
||||
|
||||
for type in `ls $vdir/objects`; do
|
||||
test_object $type $output_file.$running_jobs &
|
||||
pids="$pids $!"
|
||||
running_jobs=$(($running_jobs + 1))
|
||||
|
||||
# Once we spawned enough jobs, let's wait them to complete
|
||||
# Every spawned job have almost the same execution time so
|
||||
# it's not a big deal having them not ending at the same time
|
||||
if [ "$running_jobs" -eq "$max_parallel_jobs" ]; then
|
||||
do_join
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
do_join
|
||||
|
||||
if [ $failed -gt 0 ]; then
|
||||
echo "FAILED $failed / $numtests tests."
|
||||
exit 1
|
||||
|
Loading…
Reference in New Issue
Block a user