Commit a1c355a5 authored by Timothy Stack's avatar Timothy Stack
Browse files

Bring linktest in line with the new event system world order and do some
generic cleanup.  I'm pretty sure I broke backwards compatibility with
old disk images though...

	* configure, configure.in: Remove linktest.h.in from the list of
	template files.

	* event/linktest/GNUmakefile.in: Don't make subdirectories for
	executables since it can mess up the dependencies.  Don't install
	tb_compat.tcl stuff anymore.  Check for '/usr/local/bin/pathrate'
	and friends, and print out a warning if they are not found.  Make
	a version file for the linktest daemon.

	* event/linktest/linktest.c: Only subscribe to the events we care
	about 'STOP/KILL'.  Subscribe to TIME START events and kill any
	linktests that are in progress.  Send events through the local
	elvind instead of running tevc.

	* event/linktest/linktest.pl.in: Don't run the modified NS anymore
	to generate the topology file, use gentopofile to do that.  Send
	COMPLETE events to indicate that the tests were finished instead
	of STOP so it works with event-sequences.  Use emulab-sync to
	report errors between linktest daemons.  In addition to sending
	REPORT events, send LOG events to the SIMULATOR agent so the
	messages end up in the report e-mail.  Fix wait_all so it collects
	child processes immediately and doesn't leave zombies lying
	around.  Make the static route test work with topologies that
	aren't fully connected.  Change ownership of the linktest error
	files from root to the swapper.  Bump latency tolerance up to
	2.5ms.

	* event/linktest/ltevent.c: Use event_schedule instead of
	event_notify so the events go through the scheduler.

	* event/linktest/run_linktest.pl.in: Wait for COMPLETE events
	insetad of STOPs.

	* event/linktest/linktest.h.in: Removed.

	* event/sched/error-record.c: Include linktest error output in the
	report e-mail.

	* event/sched/event-sched.c: Linktest now sends COMPLETE events
	for START events.

	* tbsetup/gentopofile.in, tmcd/common/config/rc.topomap: Piggy
	back the generation and management of the linktest config file
	onto the generation of the topomap.

	* tbsetup/ns2ir/sim.tcl.in: Add "linktest" event to the Simulator
	object that runs linktest at level 3 (latency, static routing, and
	loss).

	* tmcd/common/libsetup.pm: Add TMLTMAP constant that contains the
	path to the node local linktest config file.

	* tmcd/common/rc.linktest: Pass '-u' option to the linktest daemon
	so it knows what user should to change ownership of files to.

	* tmcd/freebsd/jail/mkjail.pl: Copy the linktest config file
	(ltmap) into the jail.
parent 2a5ef456
......@@ -1874,7 +1874,7 @@ else
event/stated/waitForState \
event/stated/GNUmakefile event/stated/stated \
event/linktest/GNUmakefile \
event/linktest/linktest.h event/linktest/linktest.pl \
event/linktest/linktest.pl \
event/linktest/weblinktest event/linktest/linktest.proxy \
event/linktest/linktest_control \
event/linktest/run_linktest.pl";
......
......@@ -537,7 +537,7 @@ else
event/stated/waitForState \
event/stated/GNUmakefile event/stated/stated \
event/linktest/GNUmakefile \
event/linktest/linktest.h event/linktest/linktest.pl \
event/linktest/linktest.pl \
event/linktest/weblinktest event/linktest/linktest.proxy \
event/linktest/linktest_control \
event/linktest/run_linktest.pl";
......
......@@ -52,19 +52,10 @@ endif
ifeq ($(SYSTEM),Linux)
LIBS += -ldl
LOCAL_BINDIR = linux
endif
ifeq ($(SYSTEM),FreeBSD)
LOCAL_BINDIR = fbsd
endif
ifeq ($(SYSTEM),CYGWIN)
LOCAL_BINDIR = windows
endif
LIBTB_OBJS = $(LIBTBDIR)/log.o $(LIBTBDIR)/tbdefs.o
DAEMON_OBJS = linktest.o
DAEMON_OBJS = linktest.o version.o
LTEVENT_OBJS = ltevent.o
# Rules to make sure that some libraries we need from other directories get
......@@ -75,23 +66,23 @@ $(LIBTBDIR)/%.o:
$(LIBEVENTDIR)/%.a:
@$(MAKE) -C $(LIBEVENTDIR) $(@F)
$(LOCAL_BINDIR):
-mkdir -p $(LOCAL_BINDIR)
binaries: $(LOCAL_BINDIR) $(LOCAL_BINDIR)/$(DAEMON) $(LOCAL_BINDIR)/$(LTEVENT)
binaries: $(DAEMON) $(LTEVENT)
$(LOCAL_BINDIR)/$(DAEMON)-debug: $(LOCAL_BINDIR) $(DAEMON_OBJS) $(LIBTB_OBJS)
$(DAEMON)-debug: $(DAEMON_OBJS) $(LIBTB_OBJS)
$(CC) $(LDFLAGS) $(DAEMON_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
$(LOCAL_BINDIR)/$(LTEVENT)-debug: $(LOCAL_BINDIR) $(LTEVENT_OBJS) $(LIBTB_OBJS)
$(LTEVENT)-debug: $(LTEVENT_OBJS) $(LIBTB_OBJS)
$(CC) $(LDFLAGS) $(LTEVENT_OBJS) $(LIBTB_OBJS) $(LIBS) -o $@
$(DAEMON_OBJS): linktest.h ../lib/libevent.a ../lib/event.h
version.c: linktest.c
echo >$@ "char build_info[] = \"Built `date +%d-%b-%Y` by `id -nu`@`hostname | sed 's/\..*//'`:`pwd`\";"
$(DAEMON_OBJS): ../lib/libevent.a ../lib/event.h
$(LTEVENT_OBJS): ../lib/libevent.a ../lib/event.h
# We install just enough to fire off the test from boss and wait.
install: weblinktest $(SCRIPT_CONTROL) $(SCRIPT_RUN) $(SCRIPT_PROXY) $(LOCAL_BINDIR)/$(LTEVENT)
install: weblinktest $(SCRIPT_CONTROL) $(SCRIPT_RUN) $(SCRIPT_PROXY) $(LTEVENT)
$(INSTALL_PROGRAM) weblinktest $(INSTALL_LIBEXECDIR)
$(INSTALL_PROGRAM) $(SCRIPT_CONTROL) $(INSTALL_SBINDIR)
$(INSTALL_DATA) $(SRCDIR)/linktest.html $(INSTALL_WWWDIR)/doc
......@@ -102,7 +93,7 @@ install: weblinktest $(SCRIPT_CONTROL) $(SCRIPT_RUN) $(SCRIPT_PROXY) $(LOCAL_BIN
$(INSTALL_DIR)/opsdir/bin/$(SCRIPT_RUN)
$(INSTALL_PROGRAM) $(SCRIPT_PROXY) \
$(INSTALL_DIR)/opsdir/sbin/$(SCRIPT_PROXY)
$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) \
$(INSTALL_PROGRAM) $(LTEVENT) \
$(INSTALL_DIR)/opsdir/libexec/$(LTEVENT)
@echo "Don't forget to do a post-install as root"
......@@ -111,22 +102,36 @@ post-install:
chmod u+s $(INSTALL_SBINDIR)/$(SCRIPT_CONTROL)
control-install: binaries
$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) $(INSTALL_LIBEXECDIR)
$(INSTALL_PROGRAM) $(LTEVENT) $(INSTALL_LIBEXECDIR)
$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(INSTALL_BINDIR)
$(INSTALL_PROGRAM) $(SCRIPT_PROXY) $(INSTALL_BINDIR)
client: all
client-install: client
$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(DAEMON) $(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) $(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
@if test ! -x '/usr/local/bin/rude' -o \
! -x '/usr/local/bin/crude' -o \
! -x '/usr/local/bin/pathrate_snd' -o \
! -x '/usr/local/bin/pathrate_rcv'; then \
echo "**********************************************************"; \
echo "* *"; \
echo "* WARNING: Some tools needed by linktest were not found. *"; \
echo "* *"; \
echo "* Make sure the following executables are installed: *"; \
echo "* *"; \
echo "* /usr/local/bin/rude *"; \
echo "* /usr/local/bin/crude *"; \
echo "* /usr/local/bin/pathrate_snd *"; \
echo "* /usr/local/bin/pathrate_rcv *"; \
echo "* *"; \
echo "**********************************************************"; \
fi
$(INSTALL_PROGRAM) $(DAEMON) $(DESTDIR)$(CLIENT_BINDIR)/$(DAEMON)
$(INSTALL_PROGRAM) $(LTEVENT) $(DESTDIR)$(CLIENT_BINDIR)/$(LTEVENT)
$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_RUN)
$(INSTALL_PROGRAM) $(SRCDIR)/$(SCRIPT_TBCOMPAT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_TBCOMPAT)
$(INSTALL_PROGRAM) $(NSTOIRDIR)/$(SCRIPT_NSTB_COMPAT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT_NSTB_COMPAT)
lt-install:
$(INSTALL_PROGRAM) $(SCRIPT) $(DESTDIR)$(CLIENT_BINDIR)/$(SCRIPT)
clean:
rm -f *.o $(TESTS) $(SCRIPT) $(SCRIPT_RUN) weblinktest linktest_control
rm -rf $(LOCAL_BINDIR)
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2004 University of Utah and the Flux Group.
* Copyright (c) 2000-2005 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -19,19 +19,25 @@
#include "tbdefs.h"
#include "log.h"
#include "event.h"
#include "linktest.h"
#define TRUE 1;
#define FALSE 0;
#define TRUE 1
#define FALSE 0
#define LINKTEST_SCRIPT CLIENT_BINDIR "/linktest.pl"
#define MAX_ARGS 10
static int debug;
static volatile int locked;
static pid_t linktest_pid;
static char *pideid;
static char *swapper;
static event_handle_t handle;
static unsigned long token = ~0;
static void callback(event_handle_t handle,
event_notification_t notification, void *data);
static void start_callback(event_handle_t handle,
event_notification_t notification,
void *data);
static void exec_linktest(char *args, int);
static void sigchld_handler(int sig);
static void send_group_kill();
......@@ -42,7 +48,7 @@ usage(char *progname)
{
fprintf(stderr,
"Usage: %s [-d] "
"[-s server] [-p port] [-k keyfile] [-l logfile] -e pid/eid\n",
"[-s server] [-p port] [-k keyfile] [-l logfile] [-u user] -e pid/eid\n",
progname);
exit(-1);
}
......@@ -59,11 +65,12 @@ main(int argc, char **argv) {
char *progname;
char c;
char buf[BUFSIZ];
extern char build_info[];
pideid = NULL;
progname = argv[0];
while ((c = getopt(argc, argv, "s:p:e:l:dk:i:")) != -1) {
while ((c = getopt(argc, argv, "s:p:e:l:dk:i:Vu:")) != -1) {
switch (c) {
case 'd':
debug++;
......@@ -86,6 +93,13 @@ main(int argc, char **argv) {
case 'k':
keyfile = optarg;
break;
case 'u':
swapper = optarg;
break;
case 'V':
fprintf(stderr, "%s\n", build_info);
exit(0);
break;
default:
usage(progname);
}
......@@ -130,7 +144,9 @@ main(int argc, char **argv) {
*/
tuple->expt = pideid;
tuple->objtype = TBDB_OBJECTTYPE_LINKTEST;
tuple->eventtype = ADDRESSTUPLE_ANY;
tuple->eventtype =
TBDB_EVENTTYPE_START ","
TBDB_EVENTTYPE_KILL;
/*
* Register with the event system.
......@@ -147,6 +163,17 @@ main(int argc, char **argv) {
fatal("could not subscribe to event");
}
tuple->objtype = TBDB_OBJECTTYPE_TIME;
tuple->objname = ADDRESSTUPLE_ANY;
tuple->eventtype = TBDB_EVENTTYPE_START;
/*
* Subscribe to the TIME start event we specified above.
*/
if (! event_subscribe(handle, start_callback, tuple, NULL)) {
fatal("could not subscribe to event");
}
/*
* Do this now, once we have had a chance to fail on the above
* event system calls.
......@@ -218,6 +245,9 @@ callback(event_handle_t handle, event_notification_t notification, void *data)
return;
}
event_notification_get_int32(handle, notification,
"TOKEN", (int32_t *)&token);
event_notification_get_arguments(handle,
notification, args, sizeof(args));
......@@ -258,11 +288,9 @@ callback(event_handle_t handle, event_notification_t notification, void *data)
exec_linktest(args, sizeof(args));
}
}
} else if(!strcmp(event, TBDB_EVENTTYPE_STOP)) {
/*
* STOP is informational and may be ignored.
*/
else {
info("linktest already in progress\n");
}
} else if (!strcmp(event, TBDB_EVENTTYPE_KILL)) {
/*
......@@ -281,13 +309,40 @@ callback(event_handle_t handle, event_notification_t notification, void *data)
}
}
static void
start_callback(event_handle_t handle,
event_notification_t notification,
void *data)
{
char event[TBDB_FLEN_EVEVENTTYPE];
if (! event_notification_get_eventtype(handle, notification,
event, sizeof(event))) {
error("Could not get event from notification!\n");
return;
}
if (strcmp(event, TBDB_EVENTTYPE_START) == 0) {
/*
* Ignore unless we are running.
*/
if(locked) {
/*
* Reset to a clean state.
*/
send_group_kill();
}
token = ~0;
}
}
/*
* Executes Linktest with arguments received from the Linktest
* start event. Does not return.
*/
static void
exec_linktest(char *args, int buflen) {
char *word, *argv[MAX_ARGS];
char *word, *argv[MAX_ARGS], swapperarg[128], tokenarg[32];
int i,res;
/*
......@@ -296,6 +351,10 @@ exec_linktest(char *args, int buflen) {
*/
word = strtok(args," \t");
i=1;
sprintf(swapperarg, "SWAPPER=%s", swapper);
argv[i++] = swapperarg;
sprintf(tokenarg, "TOKEN=%lu", token);
argv[i++] = tokenarg;
do {
argv[i++] = word;
} while ((word = strtok(NULL," \t"))
......@@ -403,18 +462,21 @@ void send_group_kill() {
static
void send_kill_event() {
/*
* Invoke external program; The local elvind is read-only, so to
* send events we have to contact boss, but do not want a zillion
* linktest daemons keeping a connection to boss open. tevc will
* connect, send event, and exit.
*/
char buf[BUFSIZ];
sprintf(buf, "%s/tevc -e %s now %s %s",
CLIENT_BINDIR, pideid, "linktest", TBDB_EVENTTYPE_KILL);
if (system(buf) != 0) {
error("Could not invoke tevc to send KILL event\n");
event_do(handle,
EA_Experiment, pideid,
EA_Type, TBDB_OBJECTTYPE_LINKTEST,
EA_Name, "linktest",
EA_Event, TBDB_EVENTTYPE_KILL,
EA_TAG_DONE);
if (token != ~0) {
event_do(handle,
EA_Experiment, pideid,
EA_Type, TBDB_OBJECTTYPE_LINKTEST,
EA_Name, "linktest",
EA_Event, TBDB_EVENTTYPE_COMPLETE,
EA_ArgInteger, "ERROR", 1,
EA_ArgInteger, "CTOKEN", token,
EA_TAG_DONE);
token = ~0;
}
}
#ifndef __LINKTEST_H_
#define __LINKTEST_H_
#define LINKTEST_SCRIPT "@CLIENT_BINDIR@" "/linktest.pl"
/* max args to Linktest */
#define MAX_ARGS 10
#endif
......@@ -23,10 +23,10 @@ use English;
#
sub usage()
{
print "Usage: linktest.pl\n".
" [STARTAT=<test step, 1-4>]\n".
" [STOPAT=<test step, 1-4>]\n".
" [DEBUG=<debugging level. 1=on, 0=off>]\n";
print("Usage: linktest.pl\n".
" [STARTAT=<test step, 1-4>]\n".
" [STOPAT=<test step, 1-4>]\n".
" [DEBUG=<debugging level. 1=on, 0=off>]\n");
exit(0);
}
......@@ -49,6 +49,7 @@ use constant PATH_PATHRATE_SND => "/usr/local/bin/pathrate_snd";
use constant PATH_PATHRATE_RCV => "/usr/local/bin/pathrate_rcv";
use constant PATH_EMULAB_SYNC => "@CLIENT_BINDIR@/emulab-sync";
use constant PATH_LTEVENT => "@CLIENT_BINDIR@/ltevent";
use constant PATH_TEVC => "@CLIENT_BINDIR@/tevc";
use constant RUN_PATH => "@CLIENT_BINDIR@"; # where the linktest-ns runs.
use constant EVENTSERVER => "@EVENTSERVER@";
......@@ -64,7 +65,7 @@ use constant LIMIT_BW_LOSS => 0;
# Make sure that we dont get bogged down in being too accurate!
# Make sure the error is a certain significance before we start reporting it.
use constant INSIGNIFICANT_LAT_ERROR => 0.50; # ms
use constant INSIGNIFICANT_LAT_ERROR => 2.50; # ms
use constant INSIGNIFICANT_BW_ERROR => 1.00; # mb
# latency must be corrected for xmit delay under this speed.
......@@ -79,8 +80,9 @@ use constant FAST_SEND => 1002;
use constant BSD => "FreeBSD";
use constant LINUX => "Linux";
use constant RTPROTO_STATIC => "Static";
use constant EVENT_STOP => "STOP";
use constant EVENT_COMPLETE => "COMPLETE";
use constant EVENT_REPORT => "REPORT";
use constant EVENT_LOG => "LOG";
use constant PING_SEND_COUNT => 10;
use constant SYNC_NAMESPACE => "linktest";
......@@ -98,11 +100,11 @@ use constant NAME_BW => "Bandwidth";
# error suffix for logs
use constant SUFFIX_ERROR => ".error";
use constant SUFFIX_TOPO => ".topology";
use constant DEBUG_ALL => 2; # debug level for all debug info, not just msgs.
# exit codes
use constant EXIT_ABORTED => -1;
use constant EXIT_NOT_OK => 1;
use constant EXIT_OK => 0;
......@@ -114,8 +116,13 @@ struct ( edge => {
delay => '$',
loss => '$'});
struct ( host => {
name => '$',
visited => '$',
links => '@'});
# fixes emacs colorization woes introduced by above struct definition.
struct ( unused => { foo => '$'});
# struct ( unused => { foo => '$'});
use constant TRUE => 1;
use constant FALSE => 0;
......@@ -124,7 +131,6 @@ use constant FALSE => 0;
# Globals
##############################################################################
my $ns_file; # location of the customized ns for Linktest
my $topology_file; # location of the topology input file.
my $synserv; # synch server node
my $rtproto; # routing protocol
......@@ -145,14 +151,20 @@ my $log_file; # common logfile for information saved over time.
my @hosts; # hosts: list of text strings containing host names.
# sorted alphabetically
my %hostmap;
my @links; # links: list of edge structs.
# sorted alphabetically by src . dst
my $expt_path; # experiment path (ie, tbdata) set by init.
my $linktest_path; # log path (ie tbdata/linktest) set by init.
# full path to custom NS build.
my $ns_cmd;
my $simname = "ns";
my $swapper = "";
my $swapperid = 0;
my $swappergid = 0;
my $token = -1;
my $error_count = 0;
my $stage_error_count = 0;
my $total_error_count = 0;
##############################################################################
# Main control
......@@ -181,6 +193,13 @@ foreach my $arg (@ARGV) {
if($arg =~ /DEBUG=(\d)/) {
$debug_level=$1;
}
if($arg =~ /TOKEN=(\d+)/) {
$token=$1;
}
if($arg =~ /SWAPPER=(\w+)/) {
$swapper=$1;
(undef,undef,$swapperid,$swappergid) = getpwnam($swapper);
}
}
#
......@@ -210,26 +229,12 @@ $gid = $proj_id;
#
$expt_path = "/proj/$proj_id/exp/$exp_id/tbdata";
$linktest_path = "$expt_path/linktest";
$topology_file = "$linktest_path/$exp_id" . SUFFIX_TOPO;
if(-e "$expt_path/$exp_id-modify.ns") {
$ns_file = "$expt_path/$exp_id-modify.ns";
} elsif (-e "$expt_path/$exp_id.ns") {
$ns_file = "$expt_path/$exp_id.ns";
} else {
die("Could not locate an ns file.\n");
}
$topology_file = "@CLIENT_VARDIR@/boot/ltmap";
#
# Determine location of the customized ns binary for Linktest.
#
($platform) = POSIX::uname();
if($platform eq BSD) {
$ns_cmd = LINKTEST_NSPATH . "/fbsd/ns";
} elsif ($platform eq LINUX) {
$ns_cmd = LINKTEST_NSPATH . "/" . linux_version() . "/ns";
} else {
die ("Platform $platform is not currently supported.\n");
}
#
# Parse the syncserver file to find out which node is the sync server.
......@@ -270,25 +275,9 @@ if(&is_special_node()) {
#
mkdir (&check_filename($linktest_path),0777)
|| die("Could not create directory $linktest_path: $!");
chown($swapperid, $swappergid, $linktest_path);
}
#
# Now, run ns in the same path where the nstb_compat.tcl and
# tb_compat.tcl files are located. Store the output from
# the linktest-modified ns for use in generating the topology file.
#
chdir(RUN_PATH);
@results = &my_tick($ns_cmd,
&check_filename($ns_file));
die("Linktest-NS could not parse $ns_file\n") unless @results;
#
# Use results of ns to write the topology input file
#
&write_file($topology_file,@results);
#
# Call get_topo before the other nodes because
# get_topo is used to initialize @hosts.
......@@ -345,11 +334,17 @@ sleep(int(rand(5)));
&get_topo($topology_file) unless &is_special_node();
&debug_top();
my $msg = "Linktest Starting";
&sim_event(EVENT_LOG,$msg);
&debug("\n$msg\n\n");
if(&dotest(TEST_LATENCY)) {
my $msg = "Testing Single Hop Connectivity and Latency...";
&post_event(EVENT_REPORT,$msg);
&sim_event(EVENT_LOG,$msg);
&debug("\n$msg\n\n");
&latency_test;
&report_status;
}
if(&dotest(TEST_RT_STATIC)
......@@ -357,34 +352,42 @@ if(&dotest(TEST_RT_STATIC)
&& $rtproto eq RTPROTO_STATIC) {
my $msg = "Testing Static Routing...";
&post_event(EVENT_REPORT,$msg);
&sim_event(EVENT_LOG,$msg);
&debug("\n$msg\n\n");
&static_rt_test; # nodes not covered by 1hop test
&report_status;
}
if(&dotest(TEST_LOSS)) {
my $msg = "Testing Loss...";
&post_event(EVENT_REPORT,$msg);
&sim_event(EVENT_LOG,$msg);
&debug("\n$msg\n\n");
&loss_test;
&report_status;
}
if(&dotest(TEST_BW)){
my $msg = "Testing Bandwidth...";
&post_event(EVENT_REPORT,$msg);
&sim_event(EVENT_LOG,$msg);
&debug("\n$msg\n\n");
&bw_test;
&report_status;
}
&cleanup;
&barrier();
$msg = "Linktest Done";
&sim_event(EVENT_LOG,$msg);
&debug("\n$msg\n\n");
#
# Send an event indicating that Linktest has completed normally.
#
&post_event(EVENT_STOP,"");
&debug("Done\n");
&post_event(EVENT_COMPLETE,"ERROR=$total_error_count CTOKEN=$token");
exit(EXIT_OK);
......@@ -605,7 +608,7 @@ sub ping_node {
# For directly connected hosts, checks latency using Ping.
sub latency_test {
my @waitlist;
my %waitlist;
my @edge_copy = @links;
while(&has_elems(\@edge_copy)) {
......@@ -627,6 +630,7 @@ sub latency_test {
if($result_cnt == 0) {
my $errmsg = "No packets were received (n=$n)\n";
&error(NAME_LATENCY, $edge, $errmsg);
exit(EXIT_NOT_OK);
} else {
# facts from analysis in /users/davidand/public/calibrate.
......@@ -685,6 +689,7 @@ sub latency_test {
if($denominator == 0) {
my $errmsg = "Invalid sample standard deviation (possible parse problem, please report). (n=$n, u=$u, x_bar=$x_bar, S=$S)";
&error(NAME_LATENCY, $edge, $errmsg);
exit(EXIT_NOT_OK);
} else {
my $z = $numerator / $denominator;
......@@ -697,6 +702,7 @@ sub latency_test {
) {
my $errmsg = "Probable latency misconfiguration (expected=$u, measured mean=$x_bar).";
&error(NAME_LATENCY, $edge, $errmsg);
exit(EXIT_NOT_OK);
}
}
......@@ -704,7 +710,7 @@ sub latency_test {
exit(EXIT_OK);
} else {
push @waitlist, $pid;
$waitlist{$pid} = 1;
}
} else {
&debug("Skipping latency test for " . &print_link($edge) . " to " . &print_link($other_edge) . "\n");
......@@ -714,7 +720,7 @@ sub latency_test {
}
}
&wait_all(\@waitlist);
&wait_all(%waitlist);
# wait for completion before next test.
&barrier();
}
......@@ -809,59 +815,62 @@ sub bw_test {
# Static Routing Connectivity Test Functions
##############################################################################
# Attempts to reach nodes that are not on a direct link
# with this host. IE, use TTL > 1. Pings are in parallel.
sub static_rt_test {
my @host_copy = @hosts; # copy of all hosts.
my @this_1hops; # 1hop destinations from this host.
foreach my $edge(@links) {
if($edge->src eq $hostname) {
push @this_1hops, $edge->dst;
} elsif ($edge->dst eq $hostname) {