From da059f510dbadf7378c7aa8cfede3423f1ab2d04 Mon Sep 17 00:00:00 2001 From: Albert Chu Date: Wed, 7 Feb 2018 17:25:37 -0800 Subject: [PATCH] t/kvs: Update fence_namespace_remove test Update test so that fence_namespace_remove binary takes a namespace as a parameter. --- t/kvs/fence_namespace_remove.c | 13 ++++++++++--- t/t1004-kvs-namespace.t | 6 ++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/t/kvs/fence_namespace_remove.c b/t/kvs/fence_namespace_remove.c index d77bdc3ce762..699d51600dc2 100644 --- a/t/kvs/fence_namespace_remove.c +++ b/t/kvs/fence_namespace_remove.c @@ -47,7 +47,7 @@ static char *prefix = NULL; static void usage (void) { - fprintf (stderr, "Usage: fence_namespace_remove prefix\n"); + fprintf (stderr, "Usage: fence_namespace_remove namespace prefix\n"); exit (1); } @@ -56,22 +56,29 @@ int main (int argc, char *argv[]) flux_t *h = NULL; uint32_t rank; char *key = NULL; + char *namespace = NULL; char *fence_name = NULL; flux_future_t *f = NULL; flux_kvs_txn_t *txn = NULL; log_init (basename (argv[0])); - if (argc != 2) + if (argc != 3) usage (); - prefix = argv[1]; + namespace = argv[1]; + prefix = argv[2]; if (!(h = flux_open (NULL, 0))) { log_err_exit ("flux_open"); goto done; } + if (flux_kvs_set_namespace (h, namespace) < 0) { + log_err_exit ("flux_kvs_set_namespace"); + goto done; + } + if (flux_get_rank (h, &rank) < 0) { log_err ("flux_get_rank"); goto done; diff --git a/t/t1004-kvs-namespace.t b/t/t1004-kvs-namespace.t index 389ef2b056e2..bfba48028147 100755 --- a/t/t1004-kvs-namespace.t +++ b/t/t1004-kvs-namespace.t @@ -409,14 +409,12 @@ test_expect_success NO_CHAIN_LINT 'kvs: watch on rank 1 gets ENOTSUP when namesp # non-zero to know it's ready for this test. test_expect_success NO_CHAIN_LINT 'kvs: incomplete fence gets ENOTSUP when namespace is removed' ' flux kvs namespace-create $NAMESPACETMP-REMOVE-FENCE0 && - export FLUX_KVS_NAMESPACE=$NAMESPACETMP-REMOVE-FENCE0 && rm -f fence_out - stdbuf -oL ${FLUX_BUILD_DIR}/t/kvs/fence_namespace_remove fence0 > fence_out & + stdbuf -oL ${FLUX_BUILD_DIR}/t/kvs/fence_namespace_remove $NAMESPACETMP-REMOVE-FENCE0 fence0 > fence_out & watchpid=$! && wait_fencecount_nonzero 0 $NAMESPACETMP-REMOVE-FENCE0 && flux kvs namespace-remove $NAMESPACETMP-REMOVE-FENCE0 && wait $watchpid && - unset FLUX_KVS_NAMESPACE && grep "flux_future_get: Operation not supported" fence_out ' @@ -428,7 +426,7 @@ test_expect_success NO_CHAIN_LINT 'kvs: incomplete fence gets ENOTSUP when names test_expect_success NO_CHAIN_LINT 'kvs: incomplete fence on rank 1 gets ENOTSUP when namespace is removed' ' flux kvs namespace-create $NAMESPACETMP-REMOVE-FENCE1 && rm -f fence_out - stdbuf -oL flux exec -r 1 sh -c "export FLUX_KVS_NAMESPACE=$NAMESPACETMP-REMOVE-FENCE1 ; ${FLUX_BUILD_DIR}/t/kvs/fence_namespace_remove fence1" > fence_out & + stdbuf -oL flux exec -r 1 sh -c "${FLUX_BUILD_DIR}/t/kvs/fence_namespace_remove $NAMESPACETMP-REMOVE-FENCE1 fence1" > fence_out & watchpid=$! && wait_fencecount_nonzero 1 $NAMESPACETMP-REMOVE-FENCE1 && flux kvs namespace-remove $NAMESPACETMP-REMOVE-FENCE1 &&