From nobody Mon May 6 20:50:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554680684046559.9831776947632; Sun, 7 Apr 2019 16:44:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C4D5EC0587F5; Sun, 7 Apr 2019 23:44:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B41B61001DF5; Sun, 7 Apr 2019 23:44:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 438B3181AC44; Sun, 7 Apr 2019 23:44:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x37NiWqC030655 for ; Sun, 7 Apr 2019 19:44:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E1125DA35; Sun, 7 Apr 2019 23:44:32 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68D8E5DA24 for ; Sun, 7 Apr 2019 23:44:30 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C696F74A6 for ; Sun, 7 Apr 2019 23:44:29 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id t17so14122797wrw.13 for ; Sun, 07 Apr 2019 16:44:29 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id v1sm40083189wrd.47.2019.04.07.16.44.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 07 Apr 2019 16:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=a1/c6asANYX6gN2nQKG/VKOcNQEHpamsRDL4NuQ5JFo=; b=vb1QCyekmxh+Yel9YfmPMl2FCcGQdxx5z6EIduWDoSuGvfqYie/Vq7iNlaE0hsCp/n i+eaYR8DFw8WS67w0p3DZjNED9VToViJLnCxaN0QWei0077pEn6jkFZWUw7miVUrn3/2 5d/vgtR0VskJKAwJnwvRZodjyTQufnrVG8IJ4TMk0nDsnwzJ18t6deOBTby9n5uRDN5I E7sBxkVuccPCxBhPTXwKtPi7+bqsCu/UzPQkdxFln1+vg1wQjJGeAZX1XD5B7FQNQxuu wIrWYuMISRVD8i7J5l6nPJ89itNqSYeOkqZSbPoUNAkNIielIqxeChEp+rfXLr2btCcA 9wlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=a1/c6asANYX6gN2nQKG/VKOcNQEHpamsRDL4NuQ5JFo=; b=OmzUGUp8+IT9iKOsGg59krOA7F5STL8wfuO9lfRySt2o/hCPUPu5zQQyvaoiL6Cqw8 deBVvsSN7wdYTnc2wDu12JsnUXfpyn455p80Le2gQz1qJAhpK7IftgaI5k49YABTXfnk oGVnz2Fe3C70xzZwfI+Lmw5/D7XVq1EWHRyBXA1TzJ80MvQb+TbgCdbhrsz2aw/TytaB rt0BNKiSfGudgMW1LbeqypDOYrZqw5C6wDrjoW8roldgk8dh5dErfqC9fqXHCD8zQJtY JiytLD1++CU4SmNVV5Wg0PtwE+m/QnzZVPuv0ZlxOvE/zNQLQ/bD3/rcpir4UFxVjz4o Z3XQ== X-Gm-Message-State: APjAAAU7FnLOnswX+Qsm8cI/sMkSDuYW6OLmhaxk2ImSJ+JMe6mldvph nnYe6jIKl2nsAzwdvAC07Z0JgksyLqgT2w== X-Google-Smtp-Source: APXvYqx0YzzGKzhU9zaG/ZVb7woQkPPjXJQBqwlSM5xsJ5VVMQUb2euq9RpgLySDCQ+MGIP42sSDdg== X-Received: by 2002:adf:fc47:: with SMTP id e7mr10973839wrs.100.1554680667803; Sun, 07 Apr 2019 16:44:27 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Mon, 8 Apr 2019 01:43:17 +0200 Message-Id: <20190407234317.28458-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 07 Apr 2019 23:44:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Sun, 07 Apr 2019 23:44:29 +0000 (UTC) for IP:'209.85.221.66' DOMAIN:'mail-wr1-f66.google.com' HELO:'mail-wr1-f66.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.111 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_PASS) 209.85.221.66 mail-wr1-f66.google.com 209.85.221.66 mail-wr1-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Ilias Stamatis Subject: [libvirt] [PATCH] test_driver: provide virDomainGetTime implementation X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sun, 07 Apr 2019 23:44:42 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Implement testDomainGetTime by returning the current time. Signed-off-by: Ilias Stamatis --- I initially implemented this using clock_gettime, but Pavel suggested that this might not be a good idea since it isn't a cross-platform function. So I used virTimeMillisNow instead and set the nanoseconds part to 0 which can be ok for the test driver. src/test/test_driver.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index d5eecf4b7f..b6f12e784f 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -64,6 +64,7 @@ #include "virinterfaceobj.h" #include "virhostcpu.h" #include "virdomainsnapshotobjlist.h" +#include "virtime.h" #define VIR_FROM_THIS VIR_FROM_TEST @@ -1943,6 +1944,23 @@ testDomainGetState(virDomainPtr domain, return 0; } +static int +testDomainGetTime(virDomainPtr dom ATTRIBUTE_UNUSED, + long long *seconds, + unsigned int *nseconds, + unsigned int flags ATTRIBUTE_UNUSED) +{ + unsigned long long now; + + if (virTimeMillisNow(&now) < 0) + return -1; + + *seconds =3D now / 1000; + *nseconds =3D 0; + + return 0; +} + #define TEST_SAVE_MAGIC "TestGuestMagic" static int @@ -6786,6 +6804,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainSetMemory =3D testDomainSetMemory, /* 0.1.4 */ .domainGetInfo =3D testDomainGetInfo, /* 0.1.1 */ .domainGetState =3D testDomainGetState, /* 0.9.2 */ + .domainGetTime =3D testDomainGetTime, /* 5.3.0 */ .domainSave =3D testDomainSave, /* 0.3.2 */ .domainSaveFlags =3D testDomainSaveFlags, /* 0.9.4 */ .domainRestore =3D testDomainRestore, /* 0.3.2 */ -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list