]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
FreeBSD:test/encoding/readable.sh": fix nproc and ls -v calls 11522/head
authorWillem Jan Withagen <wjw@digiware.nl>
Mon, 17 Oct 2016 14:42:15 +0000 (16:42 +0200)
committerWillem Jan Withagen <wjw@digiware.nl>
Mon, 17 Oct 2016 14:42:15 +0000 (16:42 +0200)
 Neither of these is available in FreeBSD.
 But sort -n is Posix, and does the same ATM.

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
src/test/encoding/readable.sh

index c3bc06144faf8b67befbb2b314c90f0ec1c349a7..151152d0d9f6dc7713b32c76d75cb7f0a1eb0343 100755 (executable)
@@ -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