mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-08 16:54:49 +00:00
qemumonitortestutils: Introduce qemuMonitorTestSkipDeprecatedValidation
Upcoming patches will add validation which rejects objects with the 'deprecated' feature in the QMP schema. To support tests which deal with legacy properties in case when a command or argument is marked as deprecated or removed by qemu qemuMonitorTestSkipDeprecatedValidation will allow configuring the tests to ignore such errors. In case of commands/features which are not yet replaced, the 'allowRemoved' bool should not be set to provide a hard notification once qemu drops the command. Note that at this point 'allowRemoved' only includes whole commands, but not specific properties. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7014d2ef14
commit
1ef3d0fc97
@ -59,6 +59,9 @@ struct _qemuMonitorTest {
|
|||||||
|
|
||||||
bool allowUnusedCommands;
|
bool allowUnusedCommands;
|
||||||
|
|
||||||
|
bool skipValidationDeprecated;
|
||||||
|
bool skipValidationRemoved;
|
||||||
|
|
||||||
char *incoming;
|
char *incoming;
|
||||||
size_t incomingLength;
|
size_t incomingLength;
|
||||||
size_t incomingCapacity;
|
size_t incomingCapacity;
|
||||||
@ -1298,6 +1301,31 @@ qemuMonitorTestAllowUnusedCommands(qemuMonitorTestPtr test)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* qemuMonitorTestSkipDeprecatedValidation:
|
||||||
|
* @test: test monitor object
|
||||||
|
* @allowRemoved: don't produce errors if command was removed from QMP schema
|
||||||
|
*
|
||||||
|
* By default if the QMP schema is provided all test items/commands are
|
||||||
|
* validated against the schema. This function allows to override the validation
|
||||||
|
* and additionally if @allowRemoved is true and if such a command is no longer
|
||||||
|
* present in the QMP, only a warning is printed.
|
||||||
|
*
|
||||||
|
* '@allowRemoved' must be used only if a suitable replacement is already in
|
||||||
|
* use and the code tests legacy interactions.
|
||||||
|
*
|
||||||
|
* Note that currently '@allowRemoved' influences only removed commands. If an
|
||||||
|
* argument is removed it will still fail validation.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
qemuMonitorTestSkipDeprecatedValidation(qemuMonitorTestPtr test,
|
||||||
|
bool allowRemoved)
|
||||||
|
{
|
||||||
|
test->skipValidationDeprecated = true;
|
||||||
|
test->skipValidationRemoved = allowRemoved;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
qemuMonitorTestFullAddItem(qemuMonitorTestPtr test,
|
qemuMonitorTestFullAddItem(qemuMonitorTestPtr test,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
|
@ -51,6 +51,8 @@ void *qemuMonitorTestItemGetPrivateData(qemuMonitorTestItemPtr item);
|
|||||||
int qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr test, const char *errmsg, ...);
|
int qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr test, const char *errmsg, ...);
|
||||||
|
|
||||||
void qemuMonitorTestAllowUnusedCommands(qemuMonitorTestPtr test);
|
void qemuMonitorTestAllowUnusedCommands(qemuMonitorTestPtr test);
|
||||||
|
void qemuMonitorTestSkipDeprecatedValidation(qemuMonitorTestPtr test,
|
||||||
|
bool allowRemoved);
|
||||||
|
|
||||||
int qemuMonitorTestAddItem(qemuMonitorTestPtr test,
|
int qemuMonitorTestAddItem(qemuMonitorTestPtr test,
|
||||||
const char *command_name,
|
const char *command_name,
|
||||||
|
Loading…
Reference in New Issue
Block a user