2 # Copyright (c) 2000, FundsXpress Financial Network, Inc.
3 # This library is free software released "AS IS WITH ALL FAULTS"
4 # and WITHOUT ANY WARRANTIES under the terms of the GNU Lesser
5 # General Public License, Version 2.1, a copy of which can be
6 # found in the "COPYING" file of this distribution.
8 # $Id: procmanager.t,v 1.2 2000/11/10 01:09:48 muaddib Exp $
13 BEGIN { plan tests => 8; }
15 use FCGI::ProcManager;
19 ok $m = FCGI::ProcManager->new();
20 ok $m->state() eq "idle";
22 ok $m->n_processes(100) == 100;
23 ok $m->n_processes(2) == 2;
24 ok $m->n_processes(0) == 0;
27 ok $m->want_to_die(1);
29 # i'm not sure how to test these
30 #eval { $m->manage(); };
31 #ok $@ =~ /dying from death request/;
34 ok $m->want_to_die(0) == 0;
36 #ok $m->n_processes(-3);
37 #eval { $m->manage(); };
38 #ok $@ =~ /dying from number of processes exception: -3/;
52 $m->state("handling");
54 # Simulate a request dispatch.
55 my $t = int(rand(6)+10);
56 print "$$ sleeping $t..\n";
57 while (my $nslept = sleep $t) {
63 and $m->exit("Process $$ dying from SIGTERM after cleanup.\n");
66 # Simulate blocking for a request.
67 my $t1 = int(rand(5)+3);
68 print "$$ waiting for $t1..\n";