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
|
#!/usr/bin/perl
# This script is included for debugging purposes ONLY.
# It sends meta-random commands to ledd trying thus to make
# it crash.
#
# With previous versions (version <= 0.3.0) it was also quite successful
# at it, but it seems that (without knowing it) I have fixed the bug...
# I still have no idea where it was...
#
# You can stop it with:
# killall garbage.pl
# Report on exit
sub catch_zap {
print STDERR "Gave it $n lines.\n";
exit 0;
}
$SIG{HUP} = \&catch_zap;
$SIG{INT} = \&catch_zap;
$SIG{QUIT} = \&catch_zap;
$SIG{TERM} = \&catch_zap;
@cmds=("n1","n6","s5","s9","c","c8","cn3","csn7",
"N","S","C","N","S","C",
"on","off","normal","blink","on","off","normal","blink",
"10","100","200","300","700","900","1000",
"set","set","anim","anim","nop",
"frequency","dutycycle","duty" . chr(4) . "cycle",
"blah","set n7","ncd","fqdn","csnsnCNsNSCssncSCSnscsnCS",
"574893758493075","5543646436","432435","543643",
"loop","loop");
### Generate some random commands:
for ($i=0; $i<3; $i++) {
$rnd=rand()*30;
$str="";
for ($j=0; $j<$rnd; $j++) {
$str=$str . chr(int(rand()*250)+1);
}
push @cmds,$str;
}
for ($i=0; $i<5; $i++) {
$rnd=rand()*20;
$str="";
$letters="ncsNCSncsNCSncsNCSncsNCSxXxX0123456789";
for ($j=0; $j<$rnd; $j++) {
$str=$str . substr($letters,int(rand()*length($letters)),1);
}
push @cmds,$str;
}
for ($n=0; ; $n++) {
$rnd=rand();
if ($rnd<0.4) {
$cmd="set ";
} elsif ($rnd<0.8) {
$cmd="anim ";
} else {
$cmd="";
}
$rnd=rand()*15;
for ($i=0; $i<$rnd; $i++) {
$cmd=join(" ",($cmd,$cmds[int(rand()*($#cmds+1))]));
}
# printf("Giving command >%s<\n",$cmd);
print "$cmd\n";
# sleep 1;
}
|