From 1abc90da8d098524db26d1569f3f8eddbf2eb3ce Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 5 Oct 2023 04:59:08 -0700 Subject: [PATCH 1/8] libflux: rename struct to conform to RFC 7 Problem: flux_t is typedefed to 'struct flux_handle_struct' but name_type style names are forbidden per RFC 7. Rename to 'struct flux_handle'. --- src/common/libflux/handle.c | 2 +- src/common/libflux/handle.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/libflux/handle.c b/src/common/libflux/handle.c index f6929d13556c..bfd7628f2c20 100644 --- a/src/common/libflux/handle.c +++ b/src/common/libflux/handle.c @@ -60,7 +60,7 @@ struct profiling_context { }; #endif -struct flux_handle_struct { +struct flux_handle { flux_t *parent; // if FLUX_O_CLONE, my parent struct aux_item *aux; int usecount; diff --git a/src/common/libflux/handle.h b/src/common/libflux/handle.h index 12f9f1d5df92..3521abbd948a 100644 --- a/src/common/libflux/handle.h +++ b/src/common/libflux/handle.h @@ -22,7 +22,7 @@ extern "C" { #endif -typedef struct flux_handle_struct flux_t; +typedef struct flux_handle flux_t; typedef struct { int request_tx; From 282a37610a8919a0df5324b82194850fdbddf8ae Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 5 Oct 2023 05:06:36 -0700 Subject: [PATCH 2/8] libflux: fix code formatting Problem: some code formatting in libflux is not consistent with modern project practices. Make long parameter lists one per line. --- src/common/libflux/connector.h | 16 +++++++++++----- src/common/libflux/handle.c | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/common/libflux/connector.h b/src/common/libflux/connector.h index c8ff1245b941..ffe5c8b76f24 100644 --- a/src/common/libflux/connector.h +++ b/src/common/libflux/connector.h @@ -24,10 +24,14 @@ typedef flux_t *(connector_init_f)(const char *uri, flux_error_t *errp); struct flux_handle_ops { - int (*setopt)(void *impl, const char *option, - const void *val, size_t len); - int (*getopt)(void *impl, const char *option, - void *val, size_t len); + int (*setopt)(void *impl, + const char *option, + const void *val, + size_t len); + int (*getopt)(void *impl, + const char *option, + void *val, + size_t len); int (*pollfd)(void *impl); int (*pollevents)(void *impl); int (*send)(void *impl, const flux_msg_t *msg, int flags); @@ -37,7 +41,9 @@ struct flux_handle_ops { void (*impl_destroy)(void *impl); }; -flux_t *flux_handle_create (void *impl, const struct flux_handle_ops *ops, int flags); +flux_t *flux_handle_create (void *impl, + const struct flux_handle_ops *ops, + int flags); void flux_handle_destroy (flux_t *hp); #ifdef __cplusplus diff --git a/src/common/libflux/handle.c b/src/common/libflux/handle.c index bfd7628f2c20..f16adbc0fc19 100644 --- a/src/common/libflux/handle.c +++ b/src/common/libflux/handle.c @@ -332,14 +332,18 @@ flux_t *flux_open_ex (const char *uri, int flags, flux_error_t *errp) #endif if ((s = getenv ("FLUX_HANDLE_USERID"))) { uint32_t userid = strtoul (s, NULL, 10); - if (flux_opt_set (h, FLUX_OPT_TESTING_USERID, &userid, - sizeof (userid)) < 0) + if (flux_opt_set (h, + FLUX_OPT_TESTING_USERID, + &userid, + sizeof (userid)) < 0) goto error_handle; } if ((s = getenv ("FLUX_HANDLE_ROLEMASK"))) { uint32_t rolemask = strtoul (s, NULL, 0); - if (flux_opt_set (h, FLUX_OPT_TESTING_ROLEMASK, &rolemask, - sizeof (rolemask)) < 0) + if (flux_opt_set (h, + FLUX_OPT_TESTING_ROLEMASK, + &rolemask, + sizeof (rolemask)) < 0) goto error_handle; } free (scheme); @@ -369,7 +373,9 @@ void flux_close (flux_t *h) flux_handle_destroy (h); } -flux_t *flux_handle_create (void *impl, const struct flux_handle_ops *ops, int flags) +flux_t *flux_handle_create (void *impl, + const struct flux_handle_ops *ops, + int flags) { flux_t *h; From 4cf9c70523824662195a67f0da113809f89dd839 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 5 Oct 2023 09:19:07 -0700 Subject: [PATCH 3/8] connectors: fix code formatting Problem: some connector code formatting is not consistent with modern project practices. Fix the following - make long parameter lists one per line - break long && chains to one per line with one indent --- src/connectors/local/local.c | 12 ++++++++---- src/connectors/ssh/ssh.c | 13 +++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/connectors/local/local.c b/src/connectors/local/local.c index bd24beac499c..c6c5291bcb44 100644 --- a/src/connectors/local/local.c +++ b/src/connectors/local/local.c @@ -91,8 +91,10 @@ static flux_msg_t *op_recv (void *impl, int flags) return usock_client_recv (ctx->uclient, flags); } -static int op_setopt (void *impl, const char *option, - const void *val, size_t size) +static int op_setopt (void *impl, + const char *option, + const void *val, + size_t size) { struct local_connector *ctx = impl; size_t val_size; @@ -123,8 +125,10 @@ static int op_setopt (void *impl, const char *option, return rc; } -static int op_getopt (void *impl, const char *option, - void *val, size_t size) +static int op_getopt (void *impl, + const char *option, + void *val, + size_t size) { struct local_connector *ctx = impl; size_t val_size; diff --git a/src/connectors/ssh/ssh.c b/src/connectors/ssh/ssh.c index 22ccbc6c249b..1ecd2ef91410 100644 --- a/src/connectors/ssh/ssh.c +++ b/src/connectors/ssh/ssh.c @@ -84,8 +84,9 @@ static char *which (const char *prog, char *buf, size_t size) if (cpy) { while ((dir = strtok_r (a1, ":", &saveptr))) { snprintf (buf, size, "%s/%s", dir, prog); - if (stat (buf, &sb) == 0 && S_ISREG (sb.st_mode) - && access (buf, X_OK) == 0) { + if (stat (buf, &sb) == 0 + && S_ISREG (sb.st_mode) + && access (buf, X_OK) == 0) { result = buf; break; } @@ -232,8 +233,12 @@ flux_t *connector_init (const char *path, int flags, flux_error_t *errp) /* Construct argv for ssh command from uri "path" (non-scheme part) * and flux and ssh command paths. */ - if (build_ssh_command (path, ssh_cmd, flux_cmd, ld_lib_path, - &argv, &argbuf) < 0) + if (build_ssh_command (path, + ssh_cmd, + flux_cmd, + ld_lib_path, + &argv, + &argbuf) < 0) goto error; /* Start the ssh command From f27e810a2e93ee7bc890d774ffe7dcbfb405adb2 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 5 Oct 2023 06:13:12 -0700 Subject: [PATCH 4/8] libflux: support builtin connectors Problem: all connector plugins must be built as DSOs which can be inconvenient. The loop:// plugin is rarely used becuase the majority of unit tests that would use it are in libflux and other code in src/common, which is built before src/connectors. Other connectors might be able to take advantage of global state in libflux-core.so to their betterment, were they implemented as builtins. Add an array of builtin connector init functions, currently empty, and search it before we go off looking for DSOs in the file system. --- src/common/libflux/handle.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/common/libflux/handle.c b/src/common/libflux/handle.c index f16adbc0fc19..d73d59859af5 100644 --- a/src/common/libflux/handle.c +++ b/src/common/libflux/handle.c @@ -33,6 +33,8 @@ #include "src/common/libutil/errno_safe.h" #include "src/common/libutil/monotime.h" #include "src/common/libutil/errprintf.h" +#include "ccan/array_size/array_size.h" +#include "ccan/str/str.h" #include "handle.h" #include "reactor.h" @@ -85,6 +87,14 @@ struct flux_handle { struct rpc_track *tracker; }; +struct builtin_connector { + const char *scheme; + connector_init_f *init; +}; + +static struct builtin_connector builtin_connectors[] = { +}; + static void handle_trace (flux_t *h, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); @@ -208,6 +218,14 @@ static void profiling_msg_snapshot (flux_t *h, #endif +static connector_init_f *find_connector_builtin (const char *scheme) +{ + for (int i = 0; i < ARRAY_SIZE (builtin_connectors); i++) + if (streq (scheme, builtin_connectors[i].scheme)) + return builtin_connectors[i].init; + return NULL; +} + static char *find_file (const char *name, const char *searchpath) { char *path; @@ -224,9 +242,9 @@ static char *find_file (const char *name, const char *searchpath) return path; } -static connector_init_f *find_connector (const char *scheme, - void **dsop, - flux_error_t *errp) +static connector_init_f *find_connector_dso (const char *scheme, + void **dsop, + flux_error_t *errp) { char name[PATH_MAX]; const char *searchpath = getenv ("FLUX_CONNECTOR_PATH"); @@ -316,14 +334,16 @@ flux_t *flux_open_ex (const char *uri, int flags, flux_error_t *errp) *path = '\0'; path = strtrim (path + 3, " \t"); } - if (!(connector_init = find_connector (scheme, &dso, errp))) + if (!(connector_init = find_connector_builtin (scheme)) + && !(connector_init = find_connector_dso (scheme, &dso, errp))) goto error; if (getenv ("FLUX_HANDLE_TRACE")) flags |= FLUX_O_TRACE; if (getenv ("FLUX_HANDLE_MATCHDEBUG")) flags |= FLUX_O_MATCHDEBUG; if (!(h = connector_init (path, flags, errp))) { - ERRNO_SAFE_WRAP (dlclose, dso); + if (dso) + ERRNO_SAFE_WRAP (dlclose, dso); goto error; } h->dso = dso; From 2609293e4cd8ed1d5402335c7719ccc1f6b06ef2 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 5 Oct 2023 06:06:52 -0700 Subject: [PATCH 5/8] libflux: make the loop connector builtin Problem: the loop connector is not useful for testing libflux when built as a connector, because connector dsos are built after src/common. Relocate loop connector to libflux and build it in. The only change to loop.c is renaming the generic init function. --- src/common/libflux/Makefile.am | 1 + .../loop/loop.c => common/libflux/connector_loop.c} | 2 +- src/common/libflux/handle.c | 3 +++ src/connectors/Makefile.am | 8 -------- 4 files changed, 5 insertions(+), 9 deletions(-) rename src/{connectors/loop/loop.c => common/libflux/connector_loop.c} (97%) diff --git a/src/common/libflux/Makefile.am b/src/common/libflux/Makefile.am index c4399de00e97..4ffd99112ca5 100644 --- a/src/common/libflux/Makefile.am +++ b/src/common/libflux/Makefile.am @@ -95,6 +95,7 @@ libflux_la_SOURCES = \ flog.c \ attr.c \ handle.c \ + connector_loop.c \ reactor.c \ reactor_private.h \ msg_handler.c \ diff --git a/src/connectors/loop/loop.c b/src/common/libflux/connector_loop.c similarity index 97% rename from src/connectors/loop/loop.c rename to src/common/libflux/connector_loop.c index 032dfaf5f0e7..a54e03bf8f36 100644 --- a/src/connectors/loop/loop.c +++ b/src/common/libflux/connector_loop.c @@ -95,7 +95,7 @@ static void op_fini (void *impl) free (c); } -flux_t *connector_init (const char *path, int flags, flux_error_t *errp) +flux_t *connector_loop_init (const char *path, int flags, flux_error_t *errp) { loop_ctx_t *c = malloc (sizeof (*c)); if (!c) { diff --git a/src/common/libflux/handle.c b/src/common/libflux/handle.c index d73d59859af5..f40901a32b6f 100644 --- a/src/common/libflux/handle.c +++ b/src/common/libflux/handle.c @@ -92,7 +92,10 @@ struct builtin_connector { connector_init_f *init; }; +flux_t *connector_loop_init (const char *uri, int flags, flux_error_t *errp); + static struct builtin_connector builtin_connectors[] = { + { "loop", &connector_loop_init }, }; static void handle_trace (flux_t *h, const char *fmt, ...) diff --git a/src/connectors/Makefile.am b/src/connectors/Makefile.am index c9da63cd5811..e97b71ef95c7 100644 --- a/src/connectors/Makefile.am +++ b/src/connectors/Makefile.am @@ -13,7 +13,6 @@ AM_CPPFLAGS = \ fluxconnector_LTLIBRARIES = \ local.la \ - loop.la \ shmem.la \ ssh.la @@ -28,13 +27,6 @@ local_la_LIBADD = \ $(top_builddir)/src/common/libflux-core.la local_la_LDFLAGS = $(connector_ldflags) -loop_la_SOURCES = \ - loop/loop.c -loop_la_LIBADD = \ - $(top_builddir)/src/common/libflux-internal.la \ - $(top_builddir)/src/common/libflux-core.la -loop_la_LDFLAGS = $(connector_ldflags) - shmem_la_SOURCES = \ shmem/shmem.c shmem_la_CPPFLAGS = \ From 5a34a9faaf7a66af1ed29aa927d87d8b7a33b7f0 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 5 Oct 2023 06:43:02 -0700 Subject: [PATCH 6/8] loop: add support for FLUX_OPT_TESTING cred access Problem: rpc unit tests test relies on connector level accessors for credentials but loop:// doesn't implement them. Add support for FLUX_OPT_TESTING_USERID and FLUX_OPT_TESTING_ROLEMASK options, as implemented in loopback_create(). --- src/common/libflux/connector_loop.c | 56 +++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/src/common/libflux/connector_loop.c b/src/common/libflux/connector_loop.c index a54e03bf8f36..cb5953ff6eaa 100644 --- a/src/common/libflux/connector_loop.c +++ b/src/common/libflux/connector_loop.c @@ -18,6 +18,8 @@ #include +#include "ccan/str/str.h" + typedef struct { flux_t *h; @@ -87,6 +89,56 @@ static flux_msg_t *op_recv (void *impl, int flags) return msg; } +static int op_getopt (void *impl, const char *option, void *val, size_t size) +{ + loop_ctx_t *c = impl; + + if (option && streq (option, FLUX_OPT_TESTING_USERID)) { + if (size != sizeof (c->cred.userid)) + goto error; + memcpy (val, &c->cred.userid, size); + } + else if (option && streq (option, FLUX_OPT_TESTING_ROLEMASK)) { + if (size != sizeof (c->cred.rolemask)) + goto error; + memcpy (val, &c->cred.rolemask, size); + } + else + goto error; + return 0; +error: + errno = EINVAL; + return -1; +} + +static int op_setopt (void *impl, + const char *option, + const void *val, + size_t size) +{ + loop_ctx_t *c = impl; + size_t val_size; + + if (option && streq (option, FLUX_OPT_TESTING_USERID)) { + val_size = sizeof (c->cred.userid); + if (size != val_size) + goto error; + memcpy (&c->cred.userid, val, val_size); + } + else if (option && streq (option, FLUX_OPT_TESTING_ROLEMASK)) { + val_size = sizeof (c->cred.rolemask); + if (size != val_size) + goto error; + memcpy (&c->cred.rolemask, val, val_size); + } + else + goto error; + return 0; +error: + errno = EINVAL; + return -1; +} + static void op_fini (void *impl) { loop_ctx_t *c = impl; @@ -129,8 +181,8 @@ static const struct flux_handle_ops handle_ops = { .pollevents = op_pollevents, .send = op_send, .recv = op_recv, - .getopt = NULL, - .setopt = NULL, + .getopt = op_getopt, + .setopt = op_setopt, .impl_destroy = op_fini, }; From 23fdd4ec4aec9df2722b7e129e6318f9abcfa4dd Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 5 Oct 2023 08:58:56 -0700 Subject: [PATCH 7/8] libflux: check flux_op_set() _get() parameters Problem: NULL parameters to flux_op_set() or flux_op_get() could cause a segfault. Fail with EINVAL If 'h' or 'option' are NULL. Adjust checks in local and loop connectors to fit this interface. Add unit tests that cover both the generic checks at entry and the specific checks in connector_loop. --- src/common/libflux/connector_loop.c | 16 ++++++------- src/common/libflux/handle.c | 8 +++++++ src/common/libflux/test/handle.c | 35 +++++++++++++++++++++++++++++ src/connectors/local/local.c | 12 +++++----- 4 files changed, 57 insertions(+), 14 deletions(-) diff --git a/src/common/libflux/connector_loop.c b/src/common/libflux/connector_loop.c index cb5953ff6eaa..7dca5e3142d1 100644 --- a/src/common/libflux/connector_loop.c +++ b/src/common/libflux/connector_loop.c @@ -93,13 +93,13 @@ static int op_getopt (void *impl, const char *option, void *val, size_t size) { loop_ctx_t *c = impl; - if (option && streq (option, FLUX_OPT_TESTING_USERID)) { - if (size != sizeof (c->cred.userid)) + if (streq (option, FLUX_OPT_TESTING_USERID)) { + if (size != sizeof (c->cred.userid) || !val) goto error; memcpy (val, &c->cred.userid, size); } - else if (option && streq (option, FLUX_OPT_TESTING_ROLEMASK)) { - if (size != sizeof (c->cred.rolemask)) + else if (streq (option, FLUX_OPT_TESTING_ROLEMASK)) { + if (size != sizeof (c->cred.rolemask) || !val) goto error; memcpy (val, &c->cred.rolemask, size); } @@ -119,15 +119,15 @@ static int op_setopt (void *impl, loop_ctx_t *c = impl; size_t val_size; - if (option && streq (option, FLUX_OPT_TESTING_USERID)) { + if (streq (option, FLUX_OPT_TESTING_USERID)) { val_size = sizeof (c->cred.userid); - if (size != val_size) + if (size != val_size || !val) goto error; memcpy (&c->cred.userid, val, val_size); } - else if (option && streq (option, FLUX_OPT_TESTING_ROLEMASK)) { + else if (streq (option, FLUX_OPT_TESTING_ROLEMASK)) { val_size = sizeof (c->cred.rolemask); - if (size != val_size) + if (size != val_size || !val) goto error; memcpy (&c->cred.rolemask, val, val_size); } diff --git a/src/common/libflux/handle.c b/src/common/libflux/handle.c index f40901a32b6f..a6e32e000fbd 100644 --- a/src/common/libflux/handle.c +++ b/src/common/libflux/handle.c @@ -578,6 +578,10 @@ int flux_flags_get (flux_t *h) int flux_opt_get (flux_t *h, const char *option, void *val, size_t len) { + if (!h || !option) { + errno = EINVAL; + return -1; + } h = lookup_clone_ancestor (h); if (!h->ops->getopt) { errno = EINVAL; @@ -588,6 +592,10 @@ int flux_opt_get (flux_t *h, const char *option, void *val, size_t len) int flux_opt_set (flux_t *h, const char *option, const void *val, size_t len) { + if (!h || !option) { + errno = EINVAL; + return -1; + } h = lookup_clone_ancestor (h); if (!h->ops->setopt) { errno = EINVAL; diff --git a/src/common/libflux/test/handle.c b/src/common/libflux/test/handle.c index 51a231463d4d..da9551967a5b 100644 --- a/src/common/libflux/test/handle.c +++ b/src/common/libflux/test/handle.c @@ -108,8 +108,43 @@ int main (int argc, char *argv[]) /* Test flux_opt_set, flux_opt_get. */ errno = 0; + uint32_t uid = 999; + ok (flux_opt_set (NULL, FLUX_OPT_TESTING_USERID, &uid, sizeof (uid)) < 0 + && errno == EINVAL, + "flux_opt_set h=NULL fails with EINVAL"); + errno = 0; + ok (flux_opt_set (h, NULL, &uid, sizeof (uid)) < 0 + && errno == EINVAL, + "flux_opt_set option=NULL fails with EINVAL"); + errno = 0; + ok (flux_opt_set (h, FLUX_OPT_TESTING_USERID, NULL, sizeof (uid)) < 0 + && errno == EINVAL, + "flux_opt_set option=testing_userid val=NULL fails with EINVAL"); + errno = 0; + ok (flux_opt_set (h, FLUX_OPT_TESTING_USERID, &uid, sizeof (uid)+1) < 0 + && errno == EINVAL, + "flux_opt_set option=testing_userid size=wrong fails with EINVAL"); + errno = 0; ok (flux_opt_set (h, "nonexistent", NULL, 0) < 0 && errno == EINVAL, "flux_opt_set fails with EINVAL on unknown option"); + + errno = 0; + ok (flux_opt_get (NULL, FLUX_OPT_TESTING_USERID, &uid, sizeof (uid)) < 0 + && errno == EINVAL, + "flux_opt_get h=NULL fails with EINVAL"); + errno = 0; + ok (flux_opt_get (h, NULL, &uid, sizeof (uid)) < 0 + && errno == EINVAL, + "flux_opt_get option=NULL fails with EINVAL"); + errno = 0; + ok (flux_opt_get (h, FLUX_OPT_TESTING_USERID, NULL, sizeof (uid)) < 0 + && errno == EINVAL, + "flux_opt_get option=testing_userid val=NULL fails with EINVAL"); + errno = 0; + ok (flux_opt_get (h, FLUX_OPT_TESTING_USERID, &uid, sizeof (uid)+1) < 0 + && errno == EINVAL, + "flux_opt_get option=testing_userid size=wrong fails with EINVAL"); + errno = 0; ok (flux_opt_get (h, "nonexistent", NULL, 0) < 0 && errno == EINVAL, "flux_opt_get fails with EINVAL on unknown option"); diff --git a/src/connectors/local/local.c b/src/connectors/local/local.c index c6c5291bcb44..b3d92d089a21 100644 --- a/src/connectors/local/local.c +++ b/src/connectors/local/local.c @@ -100,17 +100,17 @@ static int op_setopt (void *impl, size_t val_size; int rc = -1; - if (option && streq (option, FLUX_OPT_TESTING_USERID)) { + if (streq (option, FLUX_OPT_TESTING_USERID)) { val_size = sizeof (ctx->testing_userid); - if (size != val_size) { + if (size != val_size || !val) { errno = EINVAL; goto done; } memcpy (&ctx->testing_userid, val, val_size); } - else if (option && streq (option, FLUX_OPT_TESTING_ROLEMASK)) { + else if (streq (option, FLUX_OPT_TESTING_ROLEMASK)) { val_size = sizeof (ctx->testing_rolemask); - if (size != val_size) { + if (size != val_size || !val) { errno = EINVAL; goto done; } @@ -134,9 +134,9 @@ static int op_getopt (void *impl, size_t val_size; int rc = -1; - if (option && streq (option, "flux::owner")) { + if (streq (option, "flux::owner")) { val_size = sizeof (ctx->owner); - if (size != val_size) { + if (size != val_size || !val) { errno = EINVAL; goto done; } From adc1bf5b31c62b6b0247b407e07ee9daf8df7090 Mon Sep 17 00:00:00 2001 From: Jim Garlick Date: Thu, 5 Oct 2023 06:58:01 -0700 Subject: [PATCH 8/8] libtestutil: drop loopback_create() Problem: the libtestutil loopback_create() function duplicates loop:// for unit tests that could not rely on loop.so being built, but now that loop:// is built in, it is no longer required. Convert unit tests to use the real loop:// connector and remove the duplicate implementation. --- src/broker/test/overlay.c | 5 +- src/broker/test/runat.c | 5 +- src/common/libflux/test/conf.c | 5 +- src/common/libflux/test/disconnect.c | 5 +- src/common/libflux/test/dispatch.c | 5 +- src/common/libflux/test/event.c | 8 +- src/common/libflux/test/future.c | 11 +- src/common/libflux/test/handle.c | 5 +- src/common/libflux/test/module.c | 4 +- src/common/libflux/test/reactor_loop.c | 4 +- src/common/libflux/test/response.c | 9 +- src/common/libflux/test/rpc_security.c | 5 +- src/common/libflux/test/sync.c | 9 +- src/common/libsdexec/test/channel.c | 13 +- src/common/libsdexec/test/list.c | 5 +- src/common/libsdexec/test/property.c | 5 +- src/common/libsdexec/test/start.c | 5 +- src/common/libsdexec/test/stop.c | 5 +- src/common/libterminus/test/pty.c | 2 +- src/common/libterminus/test/terminus.c | 2 +- src/common/libtestutil/util.c | 159 ------------------------- src/common/libtestutil/util.h | 10 -- 22 files changed, 51 insertions(+), 235 deletions(-) diff --git a/src/broker/test/overlay.c b/src/broker/test/overlay.c index e36de9b17958..50488ffca13e 100644 --- a/src/broker/test/overlay.c +++ b/src/broker/test/overlay.c @@ -22,7 +22,6 @@ #include "src/common/libzmqutil/sockopt.h" #include "src/common/libzmqutil/cert.h" #include "src/common/libczmqcontainers/czmq_containers.h" -#include "src/common/libtestutil/util.h" #include "src/common/libutil/stdlog.h" #include "src/common/libutil/unlink_recursive.h" #include "ccan/str/str.h" @@ -709,8 +708,8 @@ int main (int argc, char *argv[]) if (!(logs = zlist_new ())) BAIL_OUT ("zlist_new failed"); - if (!(h = loopback_create (0))) - BAIL_OUT ("loopback_create failed"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop handle"); if (flux_attr_set_cacheonly (h, "rank", "0") < 0) BAIL_OUT ("flux_attr_set_cacheonly rank failed"); if (flux_attr_set_cacheonly (h, "hostlist", "test") < 0) diff --git a/src/broker/test/runat.c b/src/broker/test/runat.c index 089371e20d97..0cad48249ac3 100644 --- a/src/broker/test/runat.c +++ b/src/broker/test/runat.c @@ -18,7 +18,6 @@ #include "src/common/libtap/tap.h" #include "src/common/libczmqcontainers/czmq_containers.h" -#include "src/common/libtestutil/util.h" #include "src/common/libutil/stdlog.h" #include "src/broker/runat.h" @@ -361,8 +360,8 @@ int main (int argc, char *argv[]) BAIL_OUT ("zlist_new failed"); if (!(r = flux_reactor_create (FLUX_REACTOR_SIGCHLD))) BAIL_OUT ("flux_reactor_create failed"); - if (!(h = loopback_create (0))) - BAIL_OUT ("loopback_create failed"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop handle"); if (flux_set_reactor (h, r) < 0) BAIL_OUT ("flux_set_reactor failed"); if (flux_attr_set_cacheonly (h, "rank", "0") < 0) diff --git a/src/common/libflux/test/conf.c b/src/common/libflux/test/conf.c index 27a57da93641..e62aaf4704d5 100644 --- a/src/common/libflux/test/conf.c +++ b/src/common/libflux/test/conf.c @@ -25,7 +25,6 @@ #include "src/common/libflux/conf_private.h" #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" #include "ccan/str/str.h" const char *t1 = \ @@ -351,8 +350,8 @@ void test_in_handle (void) /* create test handle */ - if (!(h = loopback_create (0))) - BAIL_OUT ("loopback_create failed"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("failed to create loop handle"); /* create test config */ diff --git a/src/common/libflux/test/disconnect.c b/src/common/libflux/test/disconnect.c index c98183c7e919..bef8e403cde6 100644 --- a/src/common/libflux/test/disconnect.c +++ b/src/common/libflux/test/disconnect.c @@ -16,7 +16,6 @@ #include #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" flux_msg_t *create_request (int sender, uint32_t rolemask, @@ -142,8 +141,8 @@ void check_cancel (void) int count; uint32_t matchtag; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback handle"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("failed to create loop handle"); /* populate list of requests with unique senders */ diff --git a/src/common/libflux/test/dispatch.c b/src/common/libflux/test/dispatch.c index 1ce08ecd8926..73fd2084487a 100644 --- a/src/common/libflux/test/dispatch.c +++ b/src/common/libflux/test/dispatch.c @@ -16,7 +16,6 @@ #include "src/common/libutil/xzmalloc.h" #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" int cb2_called; void cb2 (flux_t *h, flux_msg_handler_t *mh, const flux_msg_t *msg, void *arg) @@ -524,8 +523,8 @@ int main (int argc, char *argv[]) plan (NO_PLAN); - if (!(h = loopback_create (0))) - BAIL_OUT ("can't continue without loopback handle"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("can't continue without loop handle"); ok ((r = flux_get_reactor (h)) != NULL, "handle created reactor on demand"); diff --git a/src/common/libflux/test/event.c b/src/common/libflux/test/event.c index 67e4adca87b8..767a3f2b8f06 100644 --- a/src/common/libflux/test/event.c +++ b/src/common/libflux/test/event.c @@ -102,8 +102,8 @@ void test_subscribe_badparams (void) { flux_t *h; - if (!(h = loopback_create (0))) - BAIL_OUT ("loopback_create failed"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop handle"); errno = 0; ok (flux_event_subscribe_ex (NULL, "foo", 0) == NULL && errno == EINVAL, @@ -288,8 +288,8 @@ void test_subscribe_nosub (void) { flux_t *h; - if (!(h = loopback_create (FLUX_O_TEST_NOSUB))) - BAIL_OUT ("loopback_create failed"); + if (!(h = flux_open ("loop://", FLUX_O_TEST_NOSUB))) + BAIL_OUT ("could not create loop handle"); ok (flux_event_subscribe (h, "foo") == 0, "flux_event_subscribe succeeds in loopback with TEST_NOSUB flag"); diff --git a/src/common/libflux/test/future.c b/src/common/libflux/test/future.c index 1e2343b2c6d6..7baf156c6f66 100644 --- a/src/common/libflux/test/future.c +++ b/src/common/libflux/test/future.c @@ -18,7 +18,6 @@ #include "src/common/libczmqcontainers/czmq_containers.h" #include "src/common/libutil/xzmalloc.h" -#include "src/common/libtestutil/util.h" #include "src/common/libtap/tap.h" #include "ccan/str/str.h" @@ -1366,8 +1365,8 @@ void test_rpc_like_thing_async (bool reverse_destroy_order) struct thing *t; flux_reactor_t *r; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback handle"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop handle"); if (!(r = flux_get_reactor (h))) BAIL_OUT ("flux_get_reactor failed"); @@ -1412,8 +1411,8 @@ void test_rpc_like_thing (bool reverse_destroy_order) flux_msg_t *msg; struct thing *t; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback handle"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop handle"); t = thing_create (h); @@ -1445,7 +1444,7 @@ void test_rpc_like_thing_unfulfilled (bool reverse_destroy_order) flux_t *h; struct thing *t; - if (!(h = loopback_create (0))) + if (!(h = flux_open ("loop://", 0))) BAIL_OUT ("could not create loopback handle"); t = thing_create (h); diff --git a/src/common/libflux/test/handle.c b/src/common/libflux/test/handle.c index da9551967a5b..ce6af09066e9 100644 --- a/src/common/libflux/test/handle.c +++ b/src/common/libflux/test/handle.c @@ -16,7 +16,6 @@ #include "src/common/libutil/xzmalloc.h" #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" #include "ccan/str/str.h" /* Destructor for malloc'ed string. @@ -98,8 +97,8 @@ int main (int argc, char *argv[]) plan (NO_PLAN); - if (!(h = loopback_create (0))) - BAIL_OUT ("can't continue without loopback handle"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("can't continue without loop handle"); test_handle_invalid_args (h); diff --git a/src/common/libflux/test/module.c b/src/common/libflux/test/module.c index c2e7d9d4d373..a7bdad6969f7 100644 --- a/src/common/libflux/test/module.c +++ b/src/common/libflux/test/module.c @@ -53,8 +53,8 @@ void test_set_running (void) { flux_t *h; - if (!(h = loopback_create (0))) - BAIL_OUT ("loopback_create failed"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop handle"); ok (flux_module_set_running (h) == 0, "flux_module_set_running returns success"); diff --git a/src/common/libflux/test/reactor_loop.c b/src/common/libflux/test/reactor_loop.c index 77b9ec593b94..d4859f339a4e 100644 --- a/src/common/libflux/test/reactor_loop.c +++ b/src/common/libflux/test/reactor_loop.c @@ -127,7 +127,7 @@ static void leak_msg_handler (void) flux_t *h; flux_msg_handler_t *mh; - if (!(h = loopback_create (0))) + if (!(h = flux_open ("loop://", 0))) exit (1); if (!(mh = flux_msg_handler_create (h, FLUX_MATCH_ANY, dummy, NULL))) exit (1); @@ -148,7 +148,7 @@ int main (int argc, char *argv[]) plan (NO_PLAN); - if (!(h = loopback_create (0))) + if (!(h = flux_open ("loop://", 0))) BAIL_OUT ("can't continue without loop handle"); flux_comms_error_set (h, comms_err, NULL); ok ((reactor = flux_get_reactor (h)) != NULL, diff --git a/src/common/libflux/test/response.c b/src/common/libflux/test/response.c index 6741e1934e36..2aaf5e436ff8 100644 --- a/src/common/libflux/test/response.c +++ b/src/common/libflux/test/response.c @@ -16,7 +16,6 @@ #include #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" #include "ccan/str/str.h" int main (int argc, char *argv[]) @@ -157,9 +156,9 @@ int main (int argc, char *argv[]) flux_msg_destroy (msg); /* respond with request=NULL */ - h = loopback_create (0); + h = flux_open ("loop://", 0); if (!h) - BAIL_OUT ("loopback_create"); + BAIL_OUT ("could not create loop handle"); errno = 0; ok (flux_respond (h, NULL, NULL) < 0 && errno == EINVAL, "flux_respond msg=NULL fails with EINVAL"); @@ -175,9 +174,9 @@ int main (int argc, char *argv[]) flux_close (h); /* errnum=0 */ - h = loopback_create (0); + h = flux_open ("loop://", 0); if (!h) - BAIL_OUT ("loopback_create"); + BAIL_OUT ("could not create loop handle"); msg = flux_request_encode ("foo", NULL); if (!msg) BAIL_OUT ("flux_request_encode failed"); diff --git a/src/common/libflux/test/rpc_security.c b/src/common/libflux/test/rpc_security.c index 2733381cfac7..0b58c1fe7b8e 100644 --- a/src/common/libflux/test/rpc_security.c +++ b/src/common/libflux/test/rpc_security.c @@ -17,7 +17,6 @@ #include "src/common/libutil/xzmalloc.h" #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" static int cred_get (flux_t *h, struct flux_msg_cred *cr) { @@ -328,8 +327,8 @@ int main (int argc, char *argv[]) plan (NO_PLAN); - if (!(h = loopback_create (0))) - BAIL_OUT ("cannot continue without loopback handle"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("cannot continue without loop handle"); flux_comms_error_set (h, comms_err, NULL); check_rpc_oneway (h); diff --git a/src/common/libflux/test/sync.c b/src/common/libflux/test/sync.c index 62a0f7077da5..dd2f3c141f04 100644 --- a/src/common/libflux/test/sync.c +++ b/src/common/libflux/test/sync.c @@ -16,7 +16,6 @@ #include #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" void send_fake_heartbeat (flux_t *h, int seq) { @@ -42,8 +41,8 @@ void test_non_reactive_loop (void) int rc; int i; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback handle"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop handle"); f = flux_sync_create (h, 0.); ok (f != NULL, @@ -105,7 +104,7 @@ void continuation (flux_future_t *f, void *arg) void test_sync_reactive (double heartrate, double min, double max) { - flux_t *h = loopback_create (0); + flux_t *h = flux_open ("loop://", 0); struct heartbeat_ctx ctx = { .h = h, .seq = 0 }; flux_reactor_t *r; flux_watcher_t *timer; @@ -113,7 +112,7 @@ void test_sync_reactive (double heartrate, double min, double max) int count; if (!h) - BAIL_OUT ("could not create loopback handle"); + BAIL_OUT ("could not create loop handle"); if (!(r = flux_get_reactor (h))) BAIL_OUT ("flux_get_reactor failed on loopback handle"); diff --git a/src/common/libsdexec/test/channel.c b/src/common/libsdexec/test/channel.c index 11f11982a1bd..024a5b84eec1 100644 --- a/src/common/libsdexec/test/channel.c +++ b/src/common/libsdexec/test/channel.c @@ -18,7 +18,6 @@ #include "ccan/array_size/array_size.h" #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" #include "src/common/libioencode/ioencode.h" #include "channel.h" @@ -58,8 +57,8 @@ void test_input (void) json_t *io; json_t *io_eof; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback flux_t handle for testing"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop flux_t handle for testing"); if (flux_attr_set_cacheonly (h, "rank", "0") < 0) BAIL_OUT ("could not set rank for testing"); ch = sdexec_channel_create_input (h, "in"); @@ -148,8 +147,8 @@ void test_output (void) struct channel *ch; int fd; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback flux_t handle for testing"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop flux_t handle for testing"); if (flux_attr_set_cacheonly (h, "rank", "0") < 0) BAIL_OUT ("could not set rank for testing"); ch = sdexec_channel_create_output (h, "out", output_cb, error_cb, NULL); @@ -200,8 +199,8 @@ void test_inval (void) flux_t *h; json_t *io; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback flux_t handle for testing"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop flux_t handle for testing"); if (!(io = ioencode ("foo", "0", NULL, 0, true))) BAIL_OUT ("could not create json io object"); diff --git a/src/common/libsdexec/test/list.c b/src/common/libsdexec/test/list.c index bc4db7214c03..3653a8e39657 100644 --- a/src/common/libsdexec/test/list.c +++ b/src/common/libsdexec/test/list.c @@ -17,7 +17,6 @@ #include #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" #include "list.h" void test_inval (void) @@ -26,8 +25,8 @@ void test_inval (void) struct unit_info info; flux_future_t *f; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback flux_t handle for testing"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop flux_t handle for testing"); if (!(f = flux_future_create (NULL, 0))) BAIL_OUT ("could not create future for testing"); diff --git a/src/common/libsdexec/test/property.c b/src/common/libsdexec/test/property.c index 4fae581eeb73..e928ccbc199d 100644 --- a/src/common/libsdexec/test/property.c +++ b/src/common/libsdexec/test/property.c @@ -17,7 +17,6 @@ #include #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" #include "property.h" void test_dict (void) @@ -45,8 +44,8 @@ void test_inval (void) flux_future_t *f; json_t *dict; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback flux_t handle for testing"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop flux_t handle for testing"); if (!(f = flux_future_create (NULL, 0))) BAIL_OUT ("could not create future for testing"); if (!(dict = json_pack ("{s:[si]}", "foo", "i", 42))) diff --git a/src/common/libsdexec/test/start.c b/src/common/libsdexec/test/start.c index 5488a4da2512..fc0586d12922 100644 --- a/src/common/libsdexec/test/start.c +++ b/src/common/libsdexec/test/start.c @@ -18,7 +18,6 @@ #include "src/common/libsubprocess/command.h" #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" #include "src/common/libutil/jpath.h" #include "start.h" @@ -35,8 +34,8 @@ void test_inval (void) json_t *o; flux_error_t error; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback flux_t handle for testing"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop flux_t handle for testing"); if (!(f = flux_future_create (NULL, 0))) BAIL_OUT ("could not create future for testing"); if (!(cmd = flux_cmd_create (ac, av, environ)) diff --git a/src/common/libsdexec/test/stop.c b/src/common/libsdexec/test/stop.c index 19ae8dfff96f..25c8188e35a9 100644 --- a/src/common/libsdexec/test/stop.c +++ b/src/common/libsdexec/test/stop.c @@ -17,15 +17,14 @@ #include #include "src/common/libtap/tap.h" -#include "src/common/libtestutil/util.h" #include "stop.h" void test_inval (void) { flux_t *h; - if (!(h = loopback_create (0))) - BAIL_OUT ("could not create loopback flux_t handle for testing"); + if (!(h = flux_open ("loop://", 0))) + BAIL_OUT ("could not create loop flux_t handle for testing"); errno = 0; ok (sdexec_stop_unit (NULL, 0, "foo", "bar") == NULL && errno == EINVAL, diff --git a/src/common/libterminus/test/pty.c b/src/common/libterminus/test/pty.c index 12fa686672e8..a4b82c585f46 100644 --- a/src/common/libterminus/test/pty.c +++ b/src/common/libterminus/test/pty.c @@ -455,7 +455,7 @@ static void monitor_cb (struct flux_pty *pty, void *data, int len) void test_monitor () { int total = 0; - flux_t *h = loopback_create (0); + flux_t *h = flux_open ("loop://", 0); struct flux_pty *pty = flux_pty_open (); if (!h || !pty) diff --git a/src/common/libterminus/test/terminus.c b/src/common/libterminus/test/terminus.c index 9bcd2051b527..58407f0e31a3 100644 --- a/src/common/libterminus/test/terminus.c +++ b/src/common/libterminus/test/terminus.c @@ -401,7 +401,7 @@ void test_open_close_session (void) struct flux_pty *pty1 = NULL; struct flux_terminus_server *t = NULL; struct flux_terminus_server *t2 = NULL; - flux_t *h = loopback_create (0); + flux_t *h = flux_open ("loop://", 0); flux_reactor_t *r = flux_reactor_create (FLUX_REACTOR_SIGCHLD); if (!h || !r) diff --git a/src/common/libtestutil/util.c b/src/common/libtestutil/util.c index c809cb386730..2fbdf8ae4961 100644 --- a/src/common/libtestutil/util.c +++ b/src/common/libtestutil/util.c @@ -329,165 +329,6 @@ static flux_t *test_connector_create (void *zctx, return tcon->h; } -/* Loopback connector implementation - */ - -struct loopback_connector { - struct flux_msglist *queue; - flux_t *h; - int pollfd; - int pollevents; - struct flux_msg_cred cred; -}; - -static int loopback_connector_pollevents (void *impl) -{ - struct loopback_connector *lcon = impl; - int e; - int revents = 0; - - if ((e = flux_msglist_pollevents (lcon->queue)) < 0) - return -1; - if (e & POLLIN) - revents |= FLUX_POLLIN; - if (e & POLLOUT) - revents |= FLUX_POLLOUT; - if (e & POLLERR) - revents |= FLUX_POLLERR; - - return revents; -} - -static int loopback_connector_pollfd (void *impl) -{ - struct loopback_connector *lcon = impl; - - return flux_msglist_pollfd (lcon->queue); -} - -static int loopback_connector_send (void *impl, const flux_msg_t *msg, - int flags) -{ - struct loopback_connector *lcon = impl; - struct flux_msg_cred cred; - flux_msg_t *cpy; - - if (flux_msg_get_cred (msg, &cred) < 0) - return -1; - if (!(cpy = flux_msg_copy (msg, true))) - return -1; - if (cred.userid == FLUX_USERID_UNKNOWN) { - if (flux_msg_set_userid (cpy, lcon->cred.userid) < 0) - goto error; - } - if (cred.rolemask == FLUX_ROLE_NONE) { - if (flux_msg_set_rolemask (cpy, lcon->cred.rolemask) < 0) - goto error; - } - if (flux_msglist_append (lcon->queue, cpy) < 0) - goto error; - flux_msg_destroy (cpy); - return 0; -error: - flux_msg_destroy (cpy); - return -1; -} - -static flux_msg_t *loopback_connector_recv (void *impl, int flags) -{ - struct loopback_connector *lcon = impl; - flux_msg_t *msg; - - if (!(msg = (flux_msg_t *)flux_msglist_pop (lcon->queue))) { - errno = EWOULDBLOCK; - return NULL; - } - return msg; -} - -static int loopback_connector_getopt (void *impl, const char *option, - void *val, size_t size) -{ - struct loopback_connector *lcon = impl; - - if (option && streq (option, FLUX_OPT_TESTING_USERID)) { - if (size != sizeof (lcon->cred.userid)) - goto error; - memcpy (val, &lcon->cred.userid, size); - } - else if (option && streq (option, FLUX_OPT_TESTING_ROLEMASK)) { - if (size != sizeof (lcon->cred.rolemask)) - goto error; - memcpy (val, &lcon->cred.rolemask, size); - } - else - goto error; - return 0; -error: - errno = EINVAL; - return -1; -} - -static int loopback_connector_setopt (void *impl, const char *option, - const void *val, size_t size) -{ - struct loopback_connector *lcon = impl; - size_t val_size; - - if (option && streq (option, FLUX_OPT_TESTING_USERID)) { - val_size = sizeof (lcon->cred.userid); - if (size != val_size) - goto error; - memcpy (&lcon->cred.userid, val, val_size); - } - else if (option && streq (option, FLUX_OPT_TESTING_ROLEMASK)) { - val_size = sizeof (lcon->cred.rolemask); - if (size != val_size) - goto error; - memcpy (&lcon->cred.rolemask, val, val_size); - } - else - goto error; - return 0; -error: - errno = EINVAL; - return -1; -} - -static void loopback_connector_fini (void *impl) -{ - struct loopback_connector *lcon = impl; - - flux_msglist_destroy (lcon->queue); - free (lcon); -} - -static const struct flux_handle_ops loopback_ops = { - .pollfd = loopback_connector_pollfd, - .pollevents = loopback_connector_pollevents, - .send = loopback_connector_send, - .recv = loopback_connector_recv, - .getopt = loopback_connector_getopt, - .setopt = loopback_connector_setopt, - .impl_destroy = loopback_connector_fini, -}; - -flux_t *loopback_create (int flags) -{ - struct loopback_connector *lcon; - - if (!(lcon = calloc (1, sizeof (*lcon)))) - BAIL_OUT ("calloc"); - lcon->cred.userid = getuid (); - lcon->cred.rolemask = FLUX_ROLE_OWNER; - if (!(lcon->queue = flux_msglist_create ())) - BAIL_OUT ("flux_msglist_create"); - - if (!(lcon->h = flux_handle_create (lcon, &loopback_ops, flags))) - BAIL_OUT ("flux_handle_create"); - return lcon->h; -} - /* * vi:tabstop=4 shiftwidth=4 expandtab */ diff --git a/src/common/libtestutil/util.h b/src/common/libtestutil/util.h index 9d260c1a9a61..77ac6e4cf1fe 100644 --- a/src/common/libtestutil/util.h +++ b/src/common/libtestutil/util.h @@ -32,13 +32,3 @@ flux_t *test_server_create (void *zctx, void *arg); int test_server_stop (flux_t *c); - -/* Create a loopback connector for testing. - * The net effect is much the same as flux_open("loop://") except - * the implementation is self contained here. Close with flux_close(). - * - * Like loop://, this support test manipulation of credentials: - * flux_opt_set (h, FLUX_OPT_TESTING_USERID, &userid, sizeof (userid); - * flux_opt_set (h, FLUX_OPT_TESTING_ROLEMASK, &rolemask, sizeof (rolemask)) - */ -flux_t *loopback_create (int flags);