From 37cca33403714737ed5e7324cbfe149d30d98677 Mon Sep 17 00:00:00 2001 From: Ilias Stamatis Date: Thu, 20 Jun 2019 13:41:01 +0200 Subject: [PATCH] test_driver: check that the domain is running in testDomainGetTime Signed-off-by: Ilias Stamatis Signed-off-by: Michal Privoznik --- src/test/test_driver.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2a0ffbc6c5..b5a026aeb5 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1984,17 +1984,32 @@ testDomainGetState(virDomainPtr domain, } static int -testDomainGetTime(virDomainPtr dom ATTRIBUTE_UNUSED, +testDomainGetTime(virDomainPtr dom, long long *seconds, unsigned int *nseconds, unsigned int flags) { + virDomainObjPtr vm = NULL; + int ret = -1; + virCheckFlags(0, -1); + if (!(vm = testDomObjFromDomain(dom))) + return -1; + + if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("domain is not running")); + goto cleanup; + } + *seconds = 627319920; *nseconds = 0; - return 0; + ret = 0; + cleanup: + virDomainObjEndAPI(&vm); + return ret; } #define TEST_SAVE_MAGIC "TestGuestMagic" -- GitLab