1#!/bin/sh 2 3################################################################################ 4## ## 5## Copyright (c) 2009 FUJITSU LIMITED ## 6## ## 7## This program is free software; you can redistribute it and#or modify ## 8## it under the terms of the GNU General Public License as published by ## 9## the Free Software Foundation; either version 2 of the License, or ## 10## (at your option) any later version. ## 11## ## 12## This program is distributed in the hope that it will be useful, but ## 13## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ## 14## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ## 15## for more details. ## 16## ## 17## You should have received a copy of the GNU General Public License ## 18## along with this program; if not, write to the Free Software ## 19## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ## 20## ## 21## Author: Li Zefan <lizf@cn.fujitsu.com> ## 22## Miao Xie <miaox@cn.fujitsu.com> ## 23## ## 24################################################################################ 25 26. test.sh 27 28ext4_setup() 29{ 30 if tst_kvcmp -lt "2.6.31"; then 31 tst_brkm TCONF "kernel is below 2.6.31" 32 fi 33 34 tst_require_root 35 36 EXT4_KERNEL_SUPPORT=`grep -w ext4 /proc/filesystems | cut -f2` 37 if [ "$EXT4_KERNEL_SUPPORT" != "ext4" ]; then 38 modprobe ext4 > /dev/null 2>&1 39 if [ $? -ne 0 ]; then 40 tst_brkm TCONF "Ext4 is not supported" 41 fi 42 fi 43 44 if [ -z "$LTP_BIG_DEV" ];then 45 tst_brkm TCONF "tests need a big block device(5G-10G)" 46 else 47 export EXT4_DEV=$LTP_BIG_DEV 48 if mount | cut -d' ' -f1 | grep -q ^$EXT4_DEV$; then 49 tst_brkm TBROK "$EXT4_DEV should be umounted before test" 50 fi 51 fi 52 53 tst_tmpdir 54 TST_CLEANUP=ext4_cleanup 55 56 mkdir mnt_point 57} 58 59ext4_cleanup() 60{ 61 rm -rf mnt_point 62 tst_rmdir 63} 64