tests: Add virtTestCompareToFile

Replaces a common pattern used in many test files
This commit is contained in:
Cole Robinson
2015-04-23 11:14:26 -04:00
parent bdbe26b504
commit ca32929908
32 changed files with 78 additions and 324 deletions

View File

@@ -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: