common: define _require_logstate
authorJaegeuk Kim <jaegeuk@kernel.org>
Thu, 12 Feb 2015 03:20:58 +0000 (14:20 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 12 Feb 2015 03:20:58 +0000 (14:20 +1100)
This patch defines logstate by adding dump.f2fs for f2fs's clean and
dirty logs.  This macro is added into:

  xfs/085
  xfs/086
  xfs/087

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
common/config
common/log
tests/xfs/085
tests/xfs/086
tests/xfs/087

index 235f4a12054d7626612dce516c503ccbe864b0d9..e5c3579cdb9adaae5e7736907a0c913148d870ba 100644 (file)
@@ -220,6 +220,7 @@ case "$HOSTOS" in
         export MKFS_UDF_PROG="`set_prog_path mkudffs`"
         export MKFS_BTRFS_PROG="`set_btrfs_mkfs_prog_path_with_opts`"
         export MKFS_F2FS_PROG="`set_prog_path mkfs.f2fs`"
+        export DUMP_F2FS_PROG="`set_prog_path dump.f2fs`"
         export BTRFS_UTIL_PROG="`set_prog_path btrfs`"
         export BTRFS_SHOW_SUPER_PROG="`set_prog_path btrfs-show-super`"
         export XFS_FSR_PROG="`set_prog_path xfs_fsr`"
index 87074d971e2a1b90edf522d4e4544263d3da4f65..d8b18f86204608f37962171c1a6f3b32c8f61288 100644 (file)
@@ -216,14 +216,35 @@ _check_log()
         | head | grep -q "<CLEAN>" || _fail "DIRTY LOG"
 }
 
+_scratch_xfs_logstate()
+{
+    _scratch_xfs_logprint -t | tee -a $seqres.full | grep -q "<CLEAN>"
+    echo $?
+}
+
+_scratch_f2fs_logstate()
+{
+    $DUMP_F2FS_PROG $SCRATCH_DEV | tee -a $seqres.full | grep -q "unmount"
+    echo $?
+}
+
 _print_logstate()
 {
-    _scratch_xfs_logprint -t | tee -a $seqres.full >$tmp.logprint
-    if grep -q "<DIRTY>" $tmp.logprint; then
-       echo "dirty log"
-    fi
-    if grep -q "<CLEAN>" $tmp.logprint; then
-       echo "clean log"
+    case "$FSTYP" in
+    xfs)
+        dirty=$(_scratch_xfs_logstate)
+        ;;
+    f2fs)
+        dirty=$(_scratch_f2fs_logstate)
+        ;;
+    *)
+        ;;
+    esac
+
+    if [ $dirty -ne 0 ]; then
+        echo "dirty log"
+    else
+        echo "clean log"
     fi
 }
 
@@ -470,6 +491,24 @@ _require_v2log()
     # otherwise presume it does support v2 logs...:)
 }
 
+_require_logstate()
+{
+    case "$FSTYP" in
+    xfs)
+        if [ -z "$XFS_LOGPRINT_PROG" ]; then
+            _notrun "This test requires xfs_logprint utility."
+        fi
+        ;;
+    f2fs)
+        if [ -z "$DUMP_F2FS_PROG" ]; then
+            _notrun "This test requires dump.f2fs utility."
+        fi
+        ;;
+    *)
+        _notrun "$FSTYP does not support log state probing."
+        ;;
+    esac
+}
 
 # make sure this script returns success
 /bin/true
index 539f3245000261744e3e88cd37109c7ec294d8ee..1b6f424dc40a2adfc1715e451ad19f499fcb766b 100755 (executable)
@@ -48,6 +48,7 @@ rm -f $tmp.log
 
 _require_scratch
 _require_scratch_shutdown
+_require_logstate
 
 echo "mkfs"
 _scratch_mkfs_xfs >>$seqres.full 2>&1 \
index 08566d7be16c58738036a17ee8ea855cbbe84803..02977aab7f5bf59411f316b288e3b25f7fad73ae 100755 (executable)
@@ -45,6 +45,7 @@ _supported_os IRIX Linux
 rm -f $seqres.full $tmp.*
 _require_scratch
 _require_scratch_shutdown
+_require_logstate
 _require_v2log
 
 echo "*** init FS"
index 42c7d3be9cc0a8efb58215202310c03d6705acd9..17a999ccb7caa8349507ffa22e1c3304c91dd660 100755 (executable)
@@ -60,6 +60,7 @@ _supported_os IRIX Linux
 rm -f $seqres.full $tmp.*
 _require_scratch
 _require_scratch_shutdown
+_require_logstate
 _require_v2log 
 _require_xfs_quota