Introduce virCommandArgListAccess which returns 'args' and 'nargs'
Upcoming patches will add code which censores/stabilizes FD numbers in
test outputs. This will be done by rewriting the argument of the command
before comparing it with test output. Add a test-only function to
directly access 'args' and 'nargs' of a virCommand to do this
modification.
This accessor will also be used instead of 'virCommandGetArgList' in
'testCompareXMLToArgvValidateSchema' to avoid needles copy of all
arguments.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
virCommandAddEnvString;
virCommandAddEnvXDG;
virCommandAllowCap;
+virCommandArgListAccess;
virCommandClearCaps;
virCommandDaemonize;
virCommandDoAsyncIO;
}
+/**
+ * virCommandArgListAccess:
+ * @cmd: command struct
+ * @args: filled with pointer to list of args of @cmd
+ * @nargs: filled with number of arguments
+ *
+ * For use only in tests.
+ *
+ * Allows access to the arguments, including modification.
+ */
+void
+virCommandArgListAccess(virCommand *cmd,
+ char ***args,
+ size_t *nargs)
+{
+ *args = cmd->args;
+ *nargs = cmd->nargs;
+}
+
+
/*
* virCommandGetBinaryPath:
* @cmd: virCommand* containing all information about the program
void virCommandPeekSendBuffers(virCommand *cmd,
virCommandSendBuffer **buffers,
int *nbuffers);
+
+void virCommandArgListAccess(virCommand *cmd,
+ char ***args,
+ size_t *nargs);