return;
g_clear_pointer(&dummyFDContext->hints, g_hash_table_unref);
+ g_slist_free_full(g_steal_pointer(&dummyFDContext->errors), g_free);
g_clear_pointer(&dummyFDContext, g_free);
}
* in the returned context's 'hints' field, where keys are stringified
* FD numbers and the passed 'hint' strings are recorded as values.
*
+ * The 'errors' GSList is a list of error strings that can be added if the test
+ * case notices invalid operations with FDs.
+ *
* The context uses a global variable 'dummyFDContext' so that mocked functions
* which don't allow custom data can use this infrastructure.
*
}
+/**
+ * virTestDummyFDContextMarkError:
+ * @error: error message to record against the global 'dummyFDContext'
+ *
+ * Records @error in list of errors the global 'dummyFDContext' object
+ */
+void
+virTestDummyFDContextMarkError(char *error)
+{
+ if (!dummyFDContext) {
+ g_free(error);
+ return;
+ }
+
+ dummyFDContext->errors = g_slist_prepend(dummyFDContext->errors, error);
+}
+
+void virTestDummyFDContextMarkError(char *error);
+
+
/**
* virTestMakeDummyFD:
* @hint: name for the FD to record into @hints
struct _virTestDummyFDContext {
GHashTable *hints;
+ GSList *errors;
};
typedef struct _virTestDummyFDContext virTestDummyFDContext;
void virTestMakeDummyMarkDup(int newfd,
int oldfd);
+void virTestDummyFDContextMarkError(char *error);
+
int virTestMakeDummyFD(char *hint);
/* VIR_TEST_MAKE_DUMMY_FD_INSTALL_DUP_MOCK installs a mock for dup() that