Whamcloud - gitweb
LU-4343 tests: mkdir failing in sanity-hsm test 228 42/8542/4
authorJames Nunez <james.a.nunez@intel.com>
Wed, 11 Dec 2013 16:50:21 +0000 (09:50 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 6 Jan 2014 15:42:27 +0000 (15:42 +0000)
sanity-hsm test 228 calls mkdir on $tdir. Currently, the tdir
variable is two directories. This is changed in LU-2524. Until
LU-2524 lands, any call to mkdir with the tdir variable needs
the "-p" flag.

Also added removal of two files that the test creates and a new
routine to create small files with dd using the sync flag.

Signed-off-by: James Nunez <james.a.nunez@intel.com>
Change-Id: Ic78a14625d8c45f405c013b96c84da909b9b9244
Reviewed-on: http://review.whamcloud.com/8542
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/tests/sanity-hsm.sh

index 233db87..919d104 100644 (file)
@@ -479,6 +479,12 @@ make_small() {
         path2fid $1 || error "cannot get fid on $1"
 }
 
         path2fid $1 || error "cannot get fid on $1"
 }
 
+make_small_sync() {
+       dd if=/dev/urandom of=$1 count=1 bs=1M conv=sync ||
+               error "cannot create $1"
+       path2fid $1 || error "cannot get fid on $1"
+}
+
 cleanup_large_files() {
        local ratio=$(df -P $MOUNT | tail -1 | awk '{print $5}' |
                      sed 's/%//g')
 cleanup_large_files() {
        local ratio=$(df -P $MOUNT | tail -1 | awk '{print $5}' |
                      sed 's/%//g')
@@ -3262,10 +3268,9 @@ test_228() {
        # test needs a running copytool
        copytool_setup
 
        # test needs a running copytool
        copytool_setup
 
-       dd if=/dev/urandom of=$DIR/$tfile bs=1M count=1 conv=sync ||
-               error "creating $DIR/$tfile"
+       local fid=$(make_small_sync $DIR/$tfile)
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $DIR/$tfile
        $LFS hsm_archive --archive $HSM_ARCHIVE_NUMBER $DIR/$tfile
-       wait_request_state $(path2fid $DIR/$tfile) ARCHIVE SUCCEED
+       wait_request_state $fid ARCHIVE SUCCEED
 
        $LFS hsm_release $DIR/$tfile
        check_hsm_flags $DIR/$tfile "0x0000000d"
 
        $LFS hsm_release $DIR/$tfile
        check_hsm_flags $DIR/$tfile "0x0000000d"
@@ -3282,13 +3287,15 @@ test_228() {
        $LFS hsm_release $DIR/$tfile
        check_hsm_flags $DIR/$tfile "0x0000000d"
 
        $LFS hsm_release $DIR/$tfile
        check_hsm_flags $DIR/$tfile "0x0000000d"
 
-       mkdir $DIR/$tdir
+       mkdir -p $DIR/$tdir || error "mkdir $tdir failed"
 
        tar cf - --sparse $DIR/$tfile | tar xvf - -C $DIR/$tdir ||
                error "tar failed"
        cmp $DIR/$tfile $DIR/$tdir/$DIR/$tfile ||
                error "comparing untarred $DIR/$tfile"
 
 
        tar cf - --sparse $DIR/$tfile | tar xvf - -C $DIR/$tdir ||
                error "tar failed"
        cmp $DIR/$tfile $DIR/$tdir/$DIR/$tfile ||
                error "comparing untarred $DIR/$tfile"
 
+       rm -f $DIR/$tfile $DIR/$tfile.2 ||
+               error "rm $DIR/$tfile or $DIR/$tfile.2 failed"
        copytool_cleanup
 }
 run_test 228 "On released file, return extend to FIEMAP. For [cp,tar] --sparse"
        copytool_cleanup
 }
 run_test 228 "On released file, return extend to FIEMAP. For [cp,tar] --sparse"