-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestset.pl
59 lines (50 loc) · 1.26 KB
/
testset.pl
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
#!/usr/bin/perl
use strict;
use warnings;
require './util.pl';
sub testThreeClassSet {
my ($sock) = @_;
my $byte = int(rand(200)) + 50;
my $leftitems = 10;
my $keyprefix = 'k';
my $keynum = 0;
my $freeitems = -1;
&commFlushAll($sock);
do {
&commSet($sock, $keyprefix.$keynum, $byte, 0);
if ($keynum % 10) {
my @status = &getStatus($sock);
$freeitems = $items{$status[1]}{free_chunks};
}
$keynum++;
} until ($freeitems eq $leftitems);
do {
&commSet($sock, $keyprefix.$keynum, int($byte / 1.25), 0);
if ($keynum % 10) {
my @status = &getStatus($sock);
$freeitems = $items{$status[1]}{free_chunks};
}
$keynum++;
} until ($freeitems eq $leftitems);
do {
&commSet($sock, $keyprefix.$keynum, int($byte * 1.25), 0);
if ($keynum % 10) {
my @status = &getStatus($sock);
$freeitems = $items{$status[1]}{free_chunks};
}
$keynum++;
} until ($freeitems eq $leftitems);
for my $n (0..1000) {
$class = int(rand(3)) + 1;
if ($class == 1) {
&commSet($sock, $keyprefix.$keynum, int($byte / 1.25), 0);
}
elsif ($class == 2) {
&commSet($sock, $keyprefix.$keynum, $byte, 0);
}
elsif ($class == 3) {
&commSet($sock, $keyprefix.$keynum, int($byte * 1.25), 0);
}
$keynum++;
}
}