Signed-off-by: Zeng Linggang <zenglg...@cn.fujitsu.com>
---
 testcases/lib/test.sh | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/testcases/lib/test.sh b/testcases/lib/test.sh
index 383b54f..1c9b126 100644
--- a/testcases/lib/test.sh
+++ b/testcases/lib/test.sh
@@ -238,6 +238,32 @@ tst_release_device()
        fi
 }
 
+tst_mkfs()
+{
+       local fs_type=$1
+       local device=$2
+       local fs_opts=""
+
+       if [ $fs_type = "xfs" ]; then
+               tst_resm TINFO "Appending '-f' flag to mkfs.$fs_type"
+               fs_opts="-f"
+       fi
+
+       if [ $fs_type = "btrfs" ]; then
+               mkfs.btrfs 2>&1 | grep -q '\\-f' >/dev/null
+               if [ $? -eq 0 ]; then
+                       tst_resm TINFO "Appending '-f' flag to mkfs.$fs_type"
+                       fs_opts="-f"
+               fi
+       fi
+
+       shift 2
+       fs_opts="$fs_opts $@"
+       tst_resm TINFO "Formatting $device with $fs_type extra opts='$fs_opts'"
+
+       ROD_SILENT mkfs.$fs_type $fs_opts $device
+}
+
 # Check that test name is set
 if [ -z "$TCID" ]; then
        tst_brkm TBROK "TCID is not defined"
-- 
1.9.3




------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to