Whamcloud - gitweb
LU-3906 tests: fix space estimation codes in run_compilebench() 58/8258/4
authorJian Yu <jian.yu@intel.com>
Wed, 13 Nov 2013 12:43:24 +0000 (20:43 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 23 Nov 2013 14:15:11 +0000 (14:15 +0000)
While running compilebench test, the actual space required for each
kernel directory is about 1GB instead of 680MB. This patch fixes this
number in run_compilebench() so as to make the space estimation
more correct.

Test-Parameters: envdefinitions=SLOW=yes,ONLY=compilebench \
testlist=parallel-scale,parallel-scale-nfsv3,parallel-scale-nfsv4

Test-Parameters: envdefinitions=SLOW=yes,ONLY=compilebench \
mdtfilesystemtype=zfs mdsfilesystemtype=zfs ostfilesystemtype=zfs \
ostcount=2 mdtcount=1 \
testlist=parallel-scale,parallel-scale-nfsv3,parallel-scale-nfsv4

Signed-off-by: Jian Yu <jian.yu@intel.com>
Change-Id: I8aa14673b8df99f6b50980ee091acda76da7cd9a
Reviewed-on: http://review.whamcloud.com/8258
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Wei Liu <wei3.liu@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/functions.sh

index 8d99d42..23ff2a4 100644 (file)
@@ -280,10 +280,9 @@ print_opts () {
 }
 
 run_compilebench() {
-
-# Space estimation:
-#        compile dir kernel-1 680MB
-#        required space       680MB * cbench_IDIRS = ~1.4 Gb
+       # Space estimation:
+       # compile dir kernel-0  ~1GB
+       # required space        ~1GB * cbench_IDIRS
 
     cbench_DIR=${cbench_DIR:-""}
     cbench_IDIRS=${cbench_IDIRS:-2}
@@ -297,14 +296,16 @@ run_compilebench() {
     [ -e $cbench_DIR/compilebench ] || \
         { skip_env "No compilebench build" && return; }
 
-    local space=$(df -P $DIR | tail -n 1 | awk '{ print $4 }')
-    if [ $space -le $((680 * 1024 * cbench_IDIRS)) ]; then
-        cbench_IDIRS=$(( space / 680 / 1024))
-        [ $cbench_IDIRS = 0 ] && \
-            skip_env "Need free space atleast 680 Mb, have $space" && return
+       local space=$(lfs_df $DIR | awk '/^filesystem/{ print $4 }')
+       if [[ $space -le $((1024 * 1024 * cbench_IDIRS)) ]]; then
+               cbench_IDIRS=$((space / 1024 / 1024))
+               [[ $cbench_IDIRS -eq 0 ]] &&
+                       skip_env "Need free space at least 1GB, have $space" &&
+                       return
+
+               echo "free space=$space, reducing initial dirs to $cbench_IDIRS"
+       fi
 
-        log free space=$space, reducing initial dirs to $cbench_IDIRS
-    fi
     # FIXME:
     # t-f _base needs to be modifyed to set properly tdir
     # for new "test_foo" functions names