Whamcloud - gitweb
I broke llcleanup earlier. This fixes it.
[fs/lustre-release.git] / lustre / tests / create.pl
1 #!/usr/bin/perl
2
3 sub usage () {
4     print "Usage: $0 <mount point prefix> <mount count> <iterations>\n";
5     print "example: $0 /mnt/lustre 2 50\n";
6     print "         will test in /mnt/lustre1 and /mnt/lustre2\n";
7     exit;
8 }
9
10 my $mtpt = shift || usage();
11 my $mount_count = shift || usage();
12 my $i = shift || usage();
13 my $files = 2;
14
15 while ($i--) {
16     $which = int(rand() * $mount_count) + 1;
17     $d = int(rand() * $files);
18     $path = "$mtpt$which/$d";
19     my $tmp = `./mcreate $path`;
20     if ($tmp) {
21         $tmp =~ /.*error: (.*)\n/;
22         print "Created  $path: $1\n";
23     } else {
24         print "Created  $path: Success\n";
25     }
26
27     $which = int(rand() * $mount_count) + 1;
28     $d = int(rand() * $files);
29     $path = "$mtpt$which/$d";
30     if (unlink($path)) {
31         print "Unlinked $path: Success\n";
32     } else {
33         print "Unlinked $path: $!\n";
34     }
35 }
36 print "Done.\n";