@@ -51,6 +51,18 @@ static struct parameters {
const char *sector_size;
} param;
+void builtin_xaction_namespace_reset(void)
+{
+ /*
+ * Initialize parameter data for the unit test case where
+ * multiple calls to cmd_<action>_namespace() are made without
+ * an intervening exit().
+ */
+ verbose = false;
+ force = false;
+ memset(¶m, 0, sizeof(param));
+}
+
#define NSLABEL_NAME_LEN 64
struct parsed_parameters {
enum ndctl_pfn_loc loc;
@@ -12,6 +12,7 @@ int __ndctl_test_attempt(struct ndctl_test *test, unsigned int kver,
void __ndctl_test_skip(struct ndctl_test *test, const char *caller, int line);
#define ndctl_test_skip(t) __ndctl_test_skip(t, __func__, __LINE__)
struct ndctl_namespace *ndctl_get_test_dev(struct ndctl_ctx *ctx);
+void builtin_xaction_namespace_reset(void);
struct ndctl_ctx;
int test_parent_uuid(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx);
Before we add unit tests that call cmd_create_namespace() directly, we need to ensure that consecutive calls to cmd_create_namespace() behave the same as consecutive invocations of 'ndctl create-namespace'. I.e. re-initialize global parameter to zero. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- ndctl/builtin-xaction-namespace.c | 12 ++++++++++++ test.h | 1 + 2 files changed, 13 insertions(+)