5 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
7 # This program is free software; you can redistribute it and/or modify it
8 # under the terms of version 2 of the GNU General Public License as
9 # published by the Free Software Foundation.
11 # This program is distributed in the hope that it would be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 # Further, this software is distributed without any warranty that it is
16 # free of the rightful claim of any third person regarding infringement
17 # or the like. Any license provided herein, whether implied or
18 # otherwise, applies only to this software file. Patent licenses, if
19 # any, provided herein do not apply to combinations of this program with
20 # other software, or any other product whatsoever.
22 # You should have received a copy of the GNU General Public License along
23 # with this program; if not, write the Free Software Foundation, Inc., 59
24 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
26 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 # Mountain View, CA 94043, or:
31 # For further information regarding this notice, see:
33 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
40 # returns numbers with a normal distribution
46 for (my $i = 0; $i < 12; $i++) {
50 $x = $mean + $stddev * $x;
55 my $fill2="./src/fill2";
57 # for each file attach a random number of attributes
58 # each filled with a random amount of data
59 # attribute name is the checksum of the data stored within
62 my $status = 0; # return status
68 die("Error: $0: $file not found\n") if ( ! -e $file);
70 if ($0 =~ /fill2attr$/) {
72 # attach attributes to this file
73 my $num = abs(int(normal(3, 1)));
76 my $tmp = "/tmp/fill2attr$$";
78 for (my $i = 0; $i < $num; $i++) {
79 my $size = abs(int(normal(256, 200)));
80 my $cmd = "$fill2 -d nbytes=$size,linelength=72,seed=$seed -b 4k $tmp";
81 $cmd .= " > /dev/null 2>&1" if (! $verbose);
83 if (system($cmd) != 0) {
84 die("Error $0: can't create $tmp\n");
87 chomp($_ = `sum -r $tmp`);
88 my ($sum) = split(/\s+/);
89 system("cat $tmp | attr -s $sum $file > /dev/null");
93 elsif ($0 =~ /fill2attr_check/) {
95 # get the attributes for this file
96 my $cmd = "attr -q -l $file |";
99 close LIST or die("Error listing attributes: $!");
102 # check attribute contents
103 foreach my $label (@labels) {
105 ($sum) = split(/\s+/, `attr -q -g $label $file | sum -r`);
106 if ($sum ne $label) {
107 warn("Attribute \"$label\" does not match " .
108 "attribute contents for file $file\n");