From f611f923f6039ae2f03e9e65a68bbbc9d3b793b2 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Fri, 25 Feb 2011 08:14:31 +0100 Subject: [PATCH] frsh: Simplify negotiation test and rename the full test as renegotiation It was daunting to look for bugs in the large test, so now, negotiation program performs only a single negotiation and cancelation. --- src/frsh/frsh_api/tests/Makefile.omk | 5 + src/frsh/frsh_api/tests/negotiation.c | 117 +++++------------------ src/frsh/frsh_api/tests/negotiation.sh | 23 ++++- src/frsh/frsh_api/tests/renegotiation.c | 113 ++++++++++++++++++++++ src/frsh/frsh_api/tests/renegotiation.sh | 16 ++++ 5 files changed, 182 insertions(+), 92 deletions(-) create mode 100644 src/frsh/frsh_api/tests/renegotiation.c create mode 100755 src/frsh/frsh_api/tests/renegotiation.sh diff --git a/src/frsh/frsh_api/tests/Makefile.omk b/src/frsh/frsh_api/tests/Makefile.omk index 5949f61d..833f73b5 100644 --- a/src/frsh/frsh_api/tests/Makefile.omk +++ b/src/frsh/frsh_api/tests/Makefile.omk @@ -5,6 +5,11 @@ test_PROGRAMS += negotiation negotiation_SOURCES = negotiation.c negotiation_LIBS = wvtest +wvtest_SCRIPTS += renegotiation.sh +test_PROGRAMS += renegotiation +renegotiation_SOURCES = renegotiation.c +renegotiation_LIBS = wvtest + test_PROGRAMS += spare_capacity spare_capacity_SOURCES = spare_capacity.c diff --git a/src/frsh/frsh_api/tests/negotiation.c b/src/frsh/frsh_api/tests/negotiation.c index 8d45b9d4..cfdd0b77 100644 --- a/src/frsh/frsh_api/tests/negotiation.c +++ b/src/frsh/frsh_api/tests/negotiation.c @@ -5,109 +5,44 @@ #include #include -#define N 3 - -int b[N] = { 10, 20, 30 }; - -// TODO: Allow specifying loglevel in evironment - -// static struct option long_opts[] = { -// { "loglevel", 1, 0, 'l' }, -// { 0, 0, 0, 0} -// }; - -// static void -// usage(void) -// { -// printf("usage: negotiation [ options ]\n"); -// printf(" -l, --loglevel |=,...\n"); -// } - -int ret; -frsh_contract_t contract[N], c; -frsh_vres_id_t vres[N]; -frsh_rel_time_t budget, period, deadline; -int i; - -WVTEST_MAIN("basic negotiation") +WVTEST_MAIN("single negotiation and cancelation") { -// char opt; + int ret; -// while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) { -// switch (opt) { -// case 'l': -// break; -// case 'h': -// /\*default:*\/ -// usage(); -// exit(opt == 'h' ? 0 : 1); -// } -// } + frsh_contract_t contract, c; + frsh_vres_id_t vres; + frsh_rel_time_t budget, period, deadline; setenv("WVTEST_DIE_FAST", "", 1); ret = WVFRSH(frsh_init()); - /* Negotiate N contracts */ - for (i=0; i .gdbinit <server_id, peer->ref.refcount+1 +# bt +# cont +# end + +# break forb_peer_put +# commands +# printf "serverid=%llx refcount=%d\n", *(int64_t*)&peer->server_id, peer->ref.refcount +# bt +# cont +# end +# break forb_destroy +# cont +# layout src +# EOF + +WVPASS negotiation diff --git a/src/frsh/frsh_api/tests/renegotiation.c b/src/frsh/frsh_api/tests/renegotiation.c new file mode 100644 index 00000000..8d45b9d4 --- /dev/null +++ b/src/frsh/frsh_api/tests/renegotiation.c @@ -0,0 +1,113 @@ +#include +#include +#include +#include +#include +#include + +#define N 3 + +int b[N] = { 10, 20, 30 }; + +// TODO: Allow specifying loglevel in evironment + +// static struct option long_opts[] = { +// { "loglevel", 1, 0, 'l' }, +// { 0, 0, 0, 0} +// }; + +// static void +// usage(void) +// { +// printf("usage: negotiation [ options ]\n"); +// printf(" -l, --loglevel |=,...\n"); +// } + +int ret; +frsh_contract_t contract[N], c; +frsh_vres_id_t vres[N]; +frsh_rel_time_t budget, period, deadline; +int i; + +WVTEST_MAIN("basic negotiation") +{ +// char opt; + +// while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) { +// switch (opt) { +// case 'l': +// break; +// case 'h': +// /\*default:*\/ +// usage(); +// exit(opt == 'h' ? 0 : 1); +// } +// } + + setenv("WVTEST_DIE_FAST", "", 1); + ret = WVFRSH(frsh_init()); + + /* Negotiate N contracts */ + for (i=0; i