From: Willem Jan Withagen Date: Mon, 17 Oct 2016 14:42:15 +0000 (+0200) Subject: FreeBSD:test/encoding/readable.sh": fix nproc and ls -v calls X-Git-Tag: v11.1.0~610^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F11522%2Fhead;p=ceph.git FreeBSD:test/encoding/readable.sh": fix nproc and ls -v calls Neither of these is available in FreeBSD. But sort -n is Posix, and does the same ATM. Signed-off-by: Willem Jan Withagen --- diff --git a/src/test/encoding/readable.sh b/src/test/encoding/readable.sh index c3bc06144faf..151152d0d9f6 100755 --- a/src/test/encoding/readable.sh +++ b/src/test/encoding/readable.sh @@ -41,7 +41,7 @@ test_object() { incompat="" incompat_paths="" sawarversion=0 - for iv in `ls -v $dir/archive`; do + for iv in `ls $dir/archive | sort -n`; do if [ "$iv" = "$arversion" ]; then sawarversion=1 fi @@ -53,7 +53,7 @@ test_object() { # all paths for this type into variable. Assuming that this path won't contain any # whitechars (implication of above for loop). if [ -d "$dir/archive/$iv/forward_incompat/$type" ]; then - if [ -n "`ls -v $dir/archive/$iv/forward_incompat/$type/`" ]; then + if [ -n "`ls $dir/archive/$iv/forward_incompat/$type/ | sort -n`" ]; then incompat_paths="$incompat_paths $dir/archive/$iv/forward_incompat/$type" else echo "type $type directory empty, ignoring whole type instead of single objects" @@ -171,9 +171,14 @@ waitall() { # PID... # Using $MAX_PARALLEL_JOBS jobs if defined, unless the number of logical # processors -max_parallel_jobs=${MAX_PARALLEL_JOBS:-$(nproc)} +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 -v $dir/archive`; do +for arversion in `ls $dir/archive | sort -n`; do vdir="$dir/archive/$arversion" #echo $vdir