#!/usr/bin/perl -w use strict; my $debug_flag = @ARGV && (($ARGV[0] =~ /^-[d|D]$/) ? shift : ''); die "syntax: $0 [-d|-D] n_deployments n_muxes_per_deployment n_mids_per_mux" unless @ARGV == 3; my ($n_deployments, $n_muxes_per_deployment, $n_mids_per_deployment) = @ARGV; die 'need at least 2 mids per deployment (permanent server and client) for this test' if $n_mids_per_deployment < 2; $| = 1; use Benchmark; use IO::Socket; unless (fork()) { exec "perl imip_hub $debug_flag 2345"; } sleep 1; for my $i (0..$n_deployments-1) { for my $j (0..$n_muxes_per_deployment-1) { unless (fork()) { # one customer per box, for this test at the moment exec "perl imip_mux /tmp/imip_mux_${i}_$j.sock localhost 2345 $i c_${i}_$j"; } } } sleep 1; for my $i (0..$n_deployments-1) { for my $j (0..$n_muxes_per_deployment-1) { unless (fork()) { exec "perl test_mid /tmp/imip_mux_${i}_$j.sock $n_deployments $n_muxes_per_deployment server"; } unless (fork()) { exec "perl test_mid /tmp/imip_mux_${i}_$j.sock $n_deployments $n_muxes_per_deployment client"; } for (0..$n_mids_per_deployment-3) { unless (fork()) { exec "perl test_mid /tmp/imip_mux_${i}_$j.sock $n_deployments $n_muxes_per_deployment"; } } } }