aboutsummaryrefslogtreecommitdiff
path: root/testcases/kernel/fs/fs_maim/partbeat
blob: 549ddb38a8d716d06e3643819d59391698a02c57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/perl -w
#
#   Copyright (c) International Business Machines  Corp., 2000
#
#   This program is free software;  you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY;  without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
#   the GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program;  if not, write to the Free Software
#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#

#
#  FILE(s)     : partbeat
#  DESCRIPTION : Quick test to test storage management functions like mount and fsck.
#                More can be added later without much trouble.  Command line takes the
#                partition device name (ex: /dev/hda1), an integer for how many iterations
#                of the test you would like to run and the filesystem type to use (jfs or ext2 for now).
#  AUTHOR      : Jeff Martin (martinjn@us.ibm.com)
#  HISTORY     :
#

$target=$ARGV[0];
$iterations=$ARGV[1];
$fstype=$ARGV[2];

print "mkfs:";
if ($fstype =~ /jfs\b/i) {
    $tmp = `mkfs.jfs -f $target`;
    }
elsif ($fstype =~ /ext2\b/i) {
    $tmp=`mkfs $target`;
    }
elsif ($fstype =~ /ext3\b/i) {
    $tmp=`mkfs -t ext3 $target`;
    }
elsif ($fstype =~ /reiserfs\b/i) {
    $tmp=`mkreiserfs --format 3.6 -f $target`;
    }
else {
    $tmp=`mkfs $target`;
    }
print $tmp;

print "fsck:";
$tmp=`fsck -t $fstype -a $target`;
print $tmp;

($junk,$junk,$device)=split(/\//,$target);

`mkdir $device`;

for ($i=1;$i<=$iterations;$i++) {
    print "mount:";
    $tmp=`mount -t $fstype $target $device`;
    print ($tmp."\n");

    `touch $device/indicator$i`;

    print "umount:";
    $tmp=`umount $target`;
    print ($tmp."\n");
    }

print "fsck:";
$tmp=`fsck -t $fstype -a $target`;
print $tmp;

`mount -t $fstype $target $device`;
`rm -f $device/indicator*`;