3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
9 # returns numbers with a normal distribution
15 for (my $i = 0; $i < 12; $i++) {
19 $x = $mean + $stddev * $x;
24 my $fill2="./src/fill2";
26 # for each file attach a random number of attributes
27 # each filled with a random amount of data
28 # attribute name is the checksum of the data stored within
31 my $status = 0; # return status
37 die("Error: $0: $file not found\n") if ( ! -e $file);
39 if ($0 =~ /fill2attr$/) {
41 # attach attributes to this file
42 my $num = abs(int(normal(3, 1)));
45 my $tmp = "/tmp/fill2attr$$";
47 for (my $i = 0; $i < $num; $i++) {
48 my $size = abs(int(normal(256, 200)));
49 my $cmd = "$fill2 -d nbytes=$size,linelength=72,seed=$seed -b 4k $tmp";
50 $cmd .= " > /dev/null 2>&1" if (! $verbose);
52 if (system($cmd) != 0) {
53 die("Error $0: can't create $tmp\n");
56 chomp($_ = `sum -r $tmp`);
57 my ($sum) = split(/\s+/);
58 system("cat $tmp | attr -s $sum $file > /dev/null");
62 elsif ($0 =~ /fill2attr_check/) {
64 # get the attributes for this file
65 my $cmd = "attr -q -l $file |";
68 close LIST or die("Error listing attributes: $!");
71 # check attribute contents
72 foreach my $label (@labels) {
74 ($sum) = split(/\s+/, `attr -q -g $label $file | sum -r`);
76 warn("Attribute \"$label\" does not match " .
77 "attribute contents for file $file\n");