mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: Add virtTestCompareToFile
Replaces a common pattern used in many test files
This commit is contained in:
@@ -48,7 +48,6 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
const char *cmdline)
|
||||
{
|
||||
char *expectargv = NULL;
|
||||
int len;
|
||||
char *actualargv = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
virNetworkDefPtr def = NULL;
|
||||
@@ -69,15 +68,9 @@ static int testCompareXMLToArgvFiles(const char *xml,
|
||||
virtTestClearCommandPath(actualargv);
|
||||
virCommandSetDryRun(NULL, NULL, NULL);
|
||||
|
||||
len = virtTestLoadFile(cmdline, &expectargv);
|
||||
if (len < 0)
|
||||
if (virtTestCompareToFile(actualargv, cmdline) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (STRNEQ(expectargv, actualargv)) {
|
||||
virtTestDifference(stderr, expectargv, actualargv);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
|
||||
Reference in New Issue
Block a user