#!/usr/local/bin/perl # # Copyright (c) 1996 Network Appliance, Inc. # # You may distribute under the terms of the Artistic License, as # specified in the README file included in the ttt distribution. # # $Id: //depot/tools/main/p4bench/testAgents#1 $ sub opts { &ttt_add_opt("onhost1", "[a-z-]+", $myhostname, "host to run \\\$oncmd1 on"); &ttt_add_opt("onhost2", "[a-z-]+", $myhostname, "host to run \\\$oncmd2 on"); &ttt_add_opt("onhost3", "[a-z-]+", $myhostname, "host to run \\\$oncmd3 on"); &ttt_add_opt("oncmd1", "^", "date", "command to run on \\\$onhost1"); &ttt_add_opt("oncmd2", "^", "date", "command to run on \\\$onhost2"); &ttt_add_opt("oncmd3", "^", "date", "command to run on \\\$onhost3"); &ttt_add_opt("user1", "^", "$user", "user to run as on \\\$onhost1"); &ttt_add_opt("user2", "^", "$user", "user to run as on \\\$onhost2"); &ttt_add_opt("user3", "^", "$user", "user to run as on \\\$onhost3"); &ttt_add_opt("timeo", ".", "1", "timeout value for &ttt_read_agents()"); } sub prereqchk { 1; } ##### Begin ttt standard preamble - do not change this code! ##### $UNIX = 1; sub dirname { local($dir) = @_; $dir =~ s%^$%.%; $dir = "$dir/"; if ($dir =~ m"^/[^/]*//*$") { return "/"; } if ($dir =~ m"^.*[^/]//*[^/][^/]*//*$") { $dir =~ s"^(.*[^/])//*[^/][^/]*//*$"$1"; { return $dir; } } #" [for cpp] return "."; } $ttt_here = `/bin/pwd`; chop $ttt_here; chdir &dirname($0); $tttroot = `/bin/pwd`; chop $tttroot; chdir $ttt_here; require "$tttroot/tttLib.pl"; ##### End ttt standard preamble - do not change the above code! ##### $rbits = ""; if ($oncmd1) { $agentid1 = &ttt_start_agent($onhost1, $oncmd1, 1, $user1); $rbits = $rbits | $agents{$agentid1,"STDOUTt"} | $agents{$agentid1,"STDERRt"}; } if ($oncmd2) { $agentid2 = &ttt_start_agent($onhost2, $oncmd2, 1, $user2); $rbits = $rbits | $agents{$agentid2,"STDOUTt"} | $agents{$agentid2,"STDERRt"}; } if ($oncmd3) { $agentid3 = &ttt_start_agent($onhost3, $oncmd3, 1, $user3); $rbits = $rbits | $agents{$agentid3,"STDOUTt"} | $agents{$agentid3,"STDERRt"}; } &ttt_read_agents($rbits, $timeo); if ($oncmd1) { $status1 = &ttt_close_agent($agentid1); } if ($oncmd2) { $status2 = &ttt_close_agent($agentid2); } if ($oncmd3) { $status3 = &ttt_close_agent($agentid3); } if ($oncmd1) { &ttt_msg($agentid1, "exit status = $status1\n"); } if ($oncmd2) { &ttt_msg($agentid2, "exit status = $status2\n"); } if ($oncmd3) { &ttt_msg($agentid3, "exit status = $status3\n"); } &ttt_exit("pass");