Skip to content

Commit

Permalink
stress: Remove essentially unused library.
Browse files Browse the repository at this point in the history
The "stress" library was introduced years ago.  We intended at the time to
start using it to provoke errors in testing, to make sure that Open vSwitch
was resilient against those errors.  The intention was good, but there were
few actual implementations of stress options, and the testing never
materialized.

Rather than adapt the stress library for thread safety, this seems like a
good opportunity to remove it, so this commit does so.

Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
blp committed Jul 15, 2013
1 parent c649fe5 commit bef3083
Show file tree
Hide file tree
Showing 11 changed files with 0 additions and 434 deletions.
8 changes: 0 additions & 8 deletions lib/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ lib_libopenvswitch_a_SOURCES = \
lib/stream-unix.c \
lib/stream.c \
lib/stream.h \
lib/stress.c \
lib/stress.h \
lib/string.c \
lib/string.h \
lib/svec.c \
Expand Down Expand Up @@ -306,7 +304,6 @@ MAN_FRAGMENTS += \
lib/ssl-peer-ca-cert.man \
lib/ssl.man \
lib/ssl-syn.man \
lib/stress-unixctl.man \
lib/table.man \
lib/unixctl.man \
lib/unixctl-syn.man \
Expand Down Expand Up @@ -383,11 +380,6 @@ lib/coverage.def: $(DIST_SOURCES)
sed -n 's|^COVERAGE_DEFINE(\([_a-zA-Z0-9]\{1,\}\)).*$$|COVERAGE_COUNTER(\1)|p' $(all_sources) | LC_ALL=C sort -u > $@
CLEANFILES += lib/coverage.def

lib/stress.$(OBJEXT): lib/stress.def
lib/stress.def: $(DIST_SOURCES)
sed -n '/^STRESS_OPTION(/,/);$$/{s/);$$/)/;p}' $(all_sources) > $@
CLEANFILES += lib/stress.def

lib/vlog.$(OBJEXT): lib/vlog-modules.def
lib/vlog-modules.def: $(DIST_SOURCES)
sed -n 's|^VLOG_DEFINE_\(THIS_\)\{0,1\}MODULE(\([_a-zA-Z0-9]\{1,\}\)).*$$|VLOG_MODULE(\2)|p' $(all_sources) | LC_ALL=C sort -u > $@
Expand Down
14 changes: 0 additions & 14 deletions lib/netlink-socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "ofpbuf.h"
#include "poll-loop.h"
#include "socket-util.h"
#include "stress.h"
#include "util.h"
#include "vlog.h"

Expand Down Expand Up @@ -309,15 +308,6 @@ nl_sock_send_seq(struct nl_sock *sock, const struct ofpbuf *msg,
return nl_sock_send__(sock, msg, nlmsg_seq, wait);
}

/* This stress option is useful for testing that OVS properly tolerates
* -ENOBUFS on NetLink sockets. Such errors are unavoidable because they can
* occur if the kernel cannot temporarily allocate enough GFP_ATOMIC memory to
* reply to a request. They can also occur if messages arrive on a multicast
* channel faster than OVS can process them. */
STRESS_OPTION(
netlink_overflow, "simulate netlink socket receive buffer overflow",
5, 1, -1, 100);

static int
nl_sock_recv__(struct nl_sock *sock, struct ofpbuf *buf, bool wait)
{
Expand Down Expand Up @@ -373,10 +363,6 @@ nl_sock_recv__(struct nl_sock *sock, struct ofpbuf *buf, bool wait)
return EPROTO;
}

if (STRESS(netlink_overflow)) {
return ENOBUFS;
}

buf->size = MIN(retval, buf->allocated);
if (retval > buf->allocated) {
COVERAGE_INC(netlink_recv_jumbo);
Expand Down
17 changes: 0 additions & 17 deletions lib/stream-fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "fatal-signal.h"
#include "poll-loop.h"
#include "socket-util.h"
#include "stress.h"
#include "util.h"
#include "stream-provider.h"
#include "stream.h"
Expand Down Expand Up @@ -89,38 +88,22 @@ fd_connect(struct stream *stream)
return check_connection_completion(s->fd);
}

STRESS_OPTION(
stream_flaky_recv, "simulate failure of fd stream recvs",
100, 0, -1, 0);

static ssize_t
fd_recv(struct stream *stream, void *buffer, size_t n)
{
struct stream_fd *s = stream_fd_cast(stream);
ssize_t retval;

if (STRESS(stream_flaky_recv)) {
return -EIO;
}

retval = read(s->fd, buffer, n);
return retval >= 0 ? retval : -errno;
}

STRESS_OPTION(
stream_flaky_send, "simulate failure of fd stream sends",
100, 0, -1, 0);

static ssize_t
fd_send(struct stream *stream, const void *buffer, size_t n)
{
struct stream_fd *s = stream_fd_cast(stream);
ssize_t retval;

if (STRESS(stream_flaky_send)) {
return -EIO;
}

retval = write(s->fd, buffer, n);
return (retval > 0 ? retval
: retval == 0 ? -EAGAIN
Expand Down
72 changes: 0 additions & 72 deletions lib/stress-unixctl.man

This file was deleted.

Loading

0 comments on commit bef3083

Please sign in to comment.