Commit | Line | Data |
c146b63d |
1 | # -*- perl -*- |
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. |
7 | |
8 | # $Id: exporter.t,v 1.1 2001/01/13 06:44:33 muaddib Exp $ |
9 | |
10 | use strict; |
11 | use Test; |
12 | |
13 | BEGIN { plan tests => 5; } |
14 | |
15 | use FCGI::ProcManager qw(:all); |
16 | |
17 | ok pm_state() eq "idle"; |
18 | |
19 | ok pm_parameter('n_processes',100) == 100; |
20 | ok pm_parameter('n_processes',2) == 2; |
21 | ok pm_parameter('n_processes',0) == 0; |
22 | |
23 | ok pm_manage(); |
24 | |
25 | #ok pm_parameter('n_processes',-3); |
26 | #eval { pm_manage(); }; |
27 | #ok $@ =~ /dying from number of processes exception: -3/; |
28 | #undef $@; |
29 | |
30 | pm_parameter('n_processes',20); |
31 | |
32 | #pm_manage(); |
33 | #sample_request_loop(); |
34 | |
35 | exit 0; |
36 | |
37 | sub sample_request_loop { |
38 | |
39 | while (1) { |
40 | # Simulate blocking for a request. |
41 | my $t1 = int(rand(2)+1); |
42 | print "$$ waiting for $t1..\n"; |
43 | sleep $t1; |
44 | # (Here is where accept-fail-on-intr would exit request loop.) |
45 | |
46 | pm_pre_dispatch(); |
47 | |
48 | # Simulate a request dispatch. |
49 | my $t = int(rand(3)+1); |
50 | print "$$ sleeping $t..\n"; |
51 | while (my $nslept = sleep $t) { |
52 | $t -= $nslept; |
53 | last unless $t; |
54 | } |
55 | |
56 | pm_post_dispatch(); |
57 | } |
58 | } |