another directory rename: failstar -> fail

"failstar" sounds like a name for a cruise liner from the 80s.  As "*" isn't a
desirable part of directory names, just name the whole thing "fail/", the core
parts being stored in "fail/core/".

Additionally fixing two build system dependency issues:
 - missing jobserver -> protomessages dependency
 - broken bochs -> fail dependency (add_custom_target DEPENDS only allows plain
   file dependencies ... cmake for the win)


git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@956 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
This commit is contained in:
hsc
2012-03-08 19:43:02 +00:00
commit b70b6fb43a
921 changed files with 473161 additions and 0 deletions

29
scripts/client.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
#
# client.sh
# Starts a single FailBochs client in an endless loop. Adds ./bochslibs to
# LD_LIBRARY_PATH if existent. Terminates if ./stop exists, or bochs
# terminates with exit status 1.
#
# Prerequisite: All necessary FailBochs ingredients (see multiple-clients.sh)
# in the current directory.
#
rm -f stop
LIBDIR=$PWD/bochslibs
if [ -d $LIBDIR ]
then
export LD_LIBRARY_PATH=$LIBDIR
fi
while [ ! -e stop ]
do
#nice -n 19 ./bochs -q 2>&1 | tee log.$$.txt | fgrep Result
#nice -n 18 ./bochs -q 2>&1 | fgrep Result
nice -n 18 ./bochs -q >/dev/null 2>&1
if [ $? -eq 1 ]
then
break
fi
done
echo DONE

132
scripts/colorize.pl Executable file
View File

@ -0,0 +1,132 @@
#! /usr/bin/perl -w
#
# ripped from colorgcc Version: 1.3.2
# http://schlueters.de/colorgcc.1.3.2.txt
#
use Term::ANSIColor;
sub initDefaults
{
$nocolor{"dumb"} = "true";
$colors{"srcColor"} = color("cyan");
$colors{"introColor"} = color("blue");
$colors{"warningFileNameColor"} = color("yellow");
$colors{"warningNumberColor"} = color("yellow");
$colors{"warningMessageColor"} = color("yellow");
$colors{"errorFileNameColor"} = color("bold red");
$colors{"errorNumberColor"} = color("bold red");
$colors{"errorMessageColor"} = color("bold red");
}
sub loadPreferences
{
# Usage: loadPreferences("filename");
my($filename) = @_;
open(PREFS, "<$filename") || return;
while(<PREFS>)
{
next if (m/^\#.*/); # It's a comment.
next if (!m/(.*):\s*(.*)/); # It's not of the form "foo: bar".
$option = $1;
$value = $2;
if ($option eq "nocolor")
{
# The nocolor option lists terminal types, separated by
# spaces, not to do color on.
foreach $termtype (split(/\s+/, $value))
{
$nocolor{$termtype} = "true";
}
}
else
{
$colors{$option} = color($value);
}
}
close(PREFS);
}
sub srcscan
{
# Usage: srcscan($text, $normalColor)
# $text -- the text to colorize
# $normalColor -- The escape sequence to use for non-source text.
# Looks for text between ` and ', and colors it srcColor.
my($line, $normalColor) = @_;
my($srcon) = color("reset") . $colors{"srcColor"};
my($srcoff) = color("reset") . $normalColor;
$line = $normalColor . $line;
# This substitute replaces `foo' with `AfooB' where A is the escape
# sequence that turns on the the desired source color, and B is the
# escape sequence that returns to $normalColor.
$line =~ s/\`(.*?)\'/\`$srcon$1$srcoff\'/g;
print($line, color("reset"));
}
#
# Main program
#
# Set up default values for colors and compilers.
initDefaults();
# Read the configuration file, if there is one.
$configFile = $ENV{"HOME"} . "/.colorgccrc";
if (-f $configFile)
{
loadPreferences($configFile);
}
# Colorize the input
while(<>)
{
if (m/^(.*?):([0-9]+):(.*)$/) # filename:lineno:message
{
$field1 = $1 || "";
$field2 = $2 || "";
$field3 = $3 || "";
if ($field3 =~ m/\s+warning:.*/)
{
# Warning
print($colors{"warningFileNameColor"}, "$field1:", color("reset"));
print($colors{"warningNumberColor"}, "$field2:", color("reset"));
srcscan($field3, $colors{"warningMessageColor"});
}
else
{
# Error
print($colors{"errorFileNameColor"}, "$field1:", color("reset"));
print($colors{"errorNumberColor"}, "$field2:", color("reset"));
srcscan($field3, $colors{"errorMessageColor"});
}
print("\n");
}
elsif (m/^(.*?):(.+):$/) # filename:message:
{
# No line number, treat as an "introductory" line of text.
srcscan($_, $colors{"introColor"});
} elsif (m/No such file or directory/) {
print($colors{"errorFileNameColor"}, $_);
} else # Anything else.
{
# Doesn't seem to be a warning or an error. Print normally.
print(color("reset"), $_);
}
}

View File

@ -0,0 +1,44 @@
#!/bin/bash
#
# distribute-experiment.sh [path/to/experiment-target]
# Distribute necessary FailBochs ingredients for experiment target to
# FAIL_DISTRIBUTE_HOSTS. Defaults to an experiment target in the current
# directory.
#
# Prerequisites:
# - (possibly overridden) env variables from fail-env.sh
#
set -e
# determine absolute path of this script
SCRIPTDIR=$(readlink -f $(dirname $0))
# env variable defaults
source $SCRIPTDIR/fail-env.sh
if [ -n "$1" ]; then cd "$1"; fi
# possibly necessary files
[ ! -e bochsrc ] && echo 'Warning: no bochsrc found' >&2
[ ! -e BIOS-bochs-latest ] && echo 'Warning: no BIOS-bochs-latest found' >&2
[ ! -e vgabios.bin ] && echo 'Warning: no vgabios.bin found' >&2
# necessary files
[ ! -e client.sh ] && cp -v $SCRIPTDIR/client.sh .
[ ! -e multiple-clients.sh ] && cp -v $SCRIPTDIR/multiple-clients.sh .
# add bochs binary if it doesn't exist
if [ ! -e bochs ]
then
cp -v $(which bochs) .
strip bochs
fi
# sync everything to experiment hosts
for h in $FAIL_DISTRIBUTE_HOSTS
do
echo Distributing to $h ...
rsync -az --partial --delete . $h:"$FAIL_EXPERIMENT_TARGETDIR" &
done
wait
echo "Done."

21
scripts/fail-env.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
#
# fail-env.sh
# default values for several Fail* environment variables
# If you want to set your own defaults, or need a script to source from, e.g.,
# your ~/.bashrc, please copy this file and do not edit it in-place.
#
# A whitespace-separated list of hosts to rsync the experiment data to. This
# is not necessarily the same list as FAIL_EXPERIMENT_HOSTS (see below), as
# many hosts may share their homes via NFS.
export FAIL_DISTRIBUTE_HOSTS=${FAIL_DISTRIBUTE_HOSTS:='ios kos virtuos plutonium'}
# A whitespace-separated list of hosts to run experiments on. If the host name
# is followed by a ':' and a number, this specifies the number of clients to
# run on that host (defaults to #CPUs+1).
export FAIL_EXPERIMENT_HOSTS=${FAIL_EXPERIMENT_HOSTS:="plutonium uran virtuos ios:6 kos:6 bohrium polonium radon $(for hostnr in $(seq 100 254); do echo fiws$hostnr; done)"}
# A homedir-relative directory on the distribution hosts where all necessary
# Fail* ingredients reside (see multiple-clients.sh).
export FAIL_EXPERIMENT_TARGETDIR=.fail-experiment

59
scripts/multiple-clients.sh Executable file
View File

@ -0,0 +1,59 @@
#!/bin/bash
#
# multiple-clients.sh [num_clients]
# Starts multiple client.sh instances in a new tmux session. The number of
# clients defaults to #CPUs+1.
#
# Prerequisites:
# - client.sh and all necessary FailBochs ingredients (bochs binary, bochsrc,
# BIOS/VGA-BIOS, boot image, possibly a saved state) in the current
# directory
# - tmux installed somewhere in $PATH
# - possibly missing dynamic libraries in ~/bochslibs (e.g., for running a
# i386 bochs binary in an x86_64 environment)
#
set -e
LIBDIR=~/bochslibs
# cleanup earlier failures
# (FIXME: you probably don't want this on your local machine!)
killall -q bochs || true
# On many machines, ~ is mounted via NFS. To avoid the (severe) performance
# penalty, copy all experiment-related stuff to /tmp.
TMP=/tmp/fail.$(id -nu)
mkdir -p $TMP
rsync -a --delete * $TMP/
if [ -d $LIBDIR ]
then
rsync -a --delete $LIBDIR $TMP/
fi
cd $TMP
# tmux, please shut up.
TMUX='tmux -q'
COMMAND=./client.sh
SESSION=failbochs.$$
# Calculate number of clients from #processors.
PROCESSORS=$(fgrep processor /proc/cpuinfo|wc -l)
if [ -z "$1" ]
then
NWIN=$(($PROCESSORS+1))
#NWIN=$(($NWIN*2))
else
NWIN=$1
fi
# Run $NWIN clients in a new tmux session.
$TMUX new-session -s $SESSION -d "$COMMAND"
for i in $(seq 1 $(($NWIN-1)))
do
$TMUX new-session -t $SESSION -d \; split-window -h "$COMMAND"
$TMUX new-session -t $SESSION -d \; select-layout tiled
done
# Some diagnostics for the operator.
echo "$(uname -n) ($PROCESSORS CPUs @ $(fgrep MHz /proc/cpuinfo|head -n1|awk '{print $(NF)}') MHz): started $NWIN clients"
#$TMUX attach -t $SESSION

31
scripts/rebuild-bochs.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
#
# - needs to be called from within your build directory
# - "rebuild-bochs.sh": rebuild all of both Fail and Bochs
# (e.g., possibly necessary if you don't understand what was changed by others)
# - "rebuild-bochs.sh fail": rebuild all of Fail and re-link Bochs
# (e.g., possibly necessary if you changed Fail-affecting aspects or the
# build system)
# - "rebuild-bochs.sh bochs": rebuild all of Bochs
# (e.g., necessary if you changed Bochs-affecting aspects/code that must be
# inlined in Bochs)
# - "rebuild-bochs.sh -": rebuild only changed parts of Fail and Bochs
# (e.g., sufficient if you only changed experiment code)
# - all of the previous options finally install Bochs
#
set -e
if [ "$1" = fail -o -z "$1" ]
then
make clean
fi
if [ "$1" = bochs -o -z "$1" ]
then
make bochsallclean
fi
#export PATH=/fs/staff/hsc/bin/ccache:$PATH
# even if we only rebuilt fail, we need to link and install bochs again
nice make -j10 bochs 2>&1 | $(dirname $0)/colorize.pl 2>&1
make bochsinstall

53
scripts/runcampaign.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/bash
#
# runcampaign.sh <campaignserver-binary>
# Runs the campaign server, and launches clients on all $FAIL_EXPERIMENT_HOSTS.
#
# Prerequisites:
# - (possibly overridden) env variables from fail-env.sh
#
set -e
# determine absolute path of this script
SCRIPTDIR=$(readlink -f $(dirname $0))
# env variable defaults
source $SCRIPTDIR/fail-env.sh
CMD="killall -q client.sh || true; cd $FAIL_EXPERIMENT_TARGETDIR; ./multiple-clients.sh"
SSH='ssh -o BatchMode=yes -o ConnectTimeout=60'
CONNECTION_ATTEMPTS=2
# runcampaign.sh <campaignserver-binary>
if [ ! -x "$1" ]; then echo "usage: $0 <campaignserver-binary>" >&2; exit 1; fi
CAMPAIGNSERVER_BINARY=$1
date
/usr/bin/time -po .time "$CAMPAIGNSERVER_BINARY" >/dev/null 2>&1 &
sleep .1 # wait until server is likely to have a listening socket opened
for h in $FAIL_EXPERIMENT_HOSTS
do
if [[ $h == *:* ]]
then
# split in host:nclients
NCLIENTS=${h#*:}
h=${h%:*}
else
NCLIENTS=
fi
(
for i in $(seq $CONNECTION_ATTEMPTS)
do
$SSH $h "$CMD $NCLIENTS" && break
# failed? sleep 1-10s and retry.
sleep $(($RANDOM / (32768 / 10) + 1))
echo retrying $h ...
done
) &
disown
done
wait
echo "duration:"
cat .time