tests: Fix detection of expected error

This commit is contained in:
Jiri Denemark 2010-12-06 12:58:56 +01:00
parent 49c612b39e
commit c1c1ff7e47

View File

@ -102,17 +102,15 @@ cleanup:
static int test0(const void *unused ATTRIBUTE_UNUSED)
{
virCommandPtr cmd;
char *log;
int ret = -1;
free(virtTestLogContentAndReset());
cmd = virCommandNew(abs_builddir "/commandhelper-doesnotexist");
if (virCommandRun(cmd, NULL) == 0)
goto cleanup;
if ((log = virtTestLogContentAndReset()) == NULL)
goto cleanup;
if (strstr(log, ": error :") == NULL)
if (virGetLastError() == NULL)
goto cleanup;
virResetLastError();
ret = 0;