From nobody Fri Mar 29 12:14:54 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 ARC-Seal: i=1; a=rsa-sha256; t=1559393235; cv=none; d=zoho.com; s=zohoarc; b=Lp2aVwSnXRYLNmpA4IktkcR+mOSugdbO5Z3L+5On1wPHee8eQA+O50NcROg5/V/NXWBAV5o3zEgkuUk6oI7xPn7niBiqVXf7KaTX2h1RkxAQAYd6tjXwvpobQawUPJjO1ETAKIRL+rMlN2NVB5TG4jhJjsxEIrd7FexGdFrMOiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559393235; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=vnqqYSFsU2WHUzyfkfXyrgVlBslLjm5jDK0r5eui7TY=; b=Sa7ocTzps3xDayJU9BfXUw3DInAd4isnEaEV302AGNZDGzbqPDP48dGBGeDc/65DF1LhuCeaL3pOFRjHcV/4b9gNchFJvFj/SIPNXj9BByg4F2sgHCFDsGNvpr9iclqrABn2DinMakyeA+tkr1yxowRDwiwfFqkrJZlr43CPt9g= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559393235834988.4955321617225; Sat, 1 Jun 2019 05:47:15 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82A1530862BE; Sat, 1 Jun 2019 12:47:13 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BF94600D1; Sat, 1 Jun 2019 12:47:13 +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 074E054D3D; Sat, 1 Jun 2019 12:47:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x51ClAsx000637 for ; Sat, 1 Jun 2019 08:47:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 27F6D1001E97; Sat, 1 Jun 2019 12:47:10 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22CE510002B9 for ; Sat, 1 Jun 2019 12:47:08 +0000 (UTC) Received: from mail-ed1-f65.google.com (mail-ed1-f65.google.com [209.85.208.65]) (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 4751C3082E64 for ; Sat, 1 Jun 2019 12:47:07 +0000 (UTC) Received: by mail-ed1-f65.google.com with SMTP id g13so19170089edu.5 for ; Sat, 01 Jun 2019 05:47:07 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id d22sm1445848ejm.83.2019.06.01.05.47.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Jun 2019 05:47:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3u2kN/gGYvucPihUSdke/whk+f22KbLodyEsy9q72H8=; b=hCzfxFcHtQQfOLv7EORaFwYzdia1YB/x9st4mPSVgt4+ntZFsve8BbsMc4xvpGZaUq rqBrHxkAO9RoznLNr+Sk9iZFaoA/Y/UMqbrrUTegfcJbOhOqPpJXEiYXPC4rGM+n12Dj pSVZzzoJFI/SPoMKa3MmtGVhbLo4zhSvbSIInGFOBx/640JB1rBfJZRNMAT/nCHOSIco UPWAaf/eYYnUcCOYXHS86ByK2Brfce59+mm/RyhhEcKCVnnxNY44l3IhTSY9TRHWcU6L QTHdrEsNb6CWrqxnH8uxN9BO2n0CTNx3R8g8as6EirftSrhSnL70jzy6dQY4ki07ZJyg YSEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3u2kN/gGYvucPihUSdke/whk+f22KbLodyEsy9q72H8=; b=iALXUrqyvbJkj5OtKG2IFWzcfxxvMBwMS/nDBfJrBSPrKPitYTy+SE4ahj2g/+V325 v8xcg9+qhzr2vmrX7NXavs2MVC5VuXLO8TqBhCaHGqK7SnITfKlk40kSmq+kqi44EnoY 5fl0voPXLDNLEUJD5HyrT3L1mleBiXfNp/dsU+X1cgzY25vdfUvnEDvdvQtUT0UkuyKr m6oZ0cUn+kKd4mJxCleJFwnohcKK6VNIL+6aF5LT+7CmJB27rKa+eVcX/hDgUHQtqRdW HnccX7Op6QcztwZLglj68AuXYa9H/deH/RoQU5mNj7zOEzIxuSjEiS6uIjZnMCIf/G5n L5yA== X-Gm-Message-State: APjAAAUnVIpm7hZVR3c8z/+kd3iAz66zGY58QT+0dOspkGAgQrvuUbka xN47Fg7wfs91TPRmtxA1Ik8PCK6/Qbk= X-Google-Smtp-Source: APXvYqyeXkDte5ljJZ4Cg0U4w6+BVvCBZz+tBLK6z20UKX2lO7E+QLjkh6M/ey3aKGrjjhx+C0X5DA== X-Received: by 2002:a50:9177:: with SMTP id f52mr17414452eda.18.1559393225586; Sat, 01 Jun 2019 05:47:05 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Sat, 1 Jun 2019 14:46:56 +0200 Message-Id: <20190601124656.10099-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.46]); Sat, 01 Jun 2019 12:47:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Sat, 01 Jun 2019 12:47:07 +0000 (UTC) for IP:'209.85.208.65' DOMAIN:'mail-ed1-f65.google.com' HELO:'mail-ed1-f65.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.466 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.208.65 mail-ed1-f65.google.com 209.85.208.65 mail-ed1-f65.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] test_driver: implement virDomainSendKey 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.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Sat, 01 Jun 2019 12:47:14 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Validate @keycodes and sleep for @holdtime before successfully returning. Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2f58a1da95..51ded256be 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 "virkeycode.h" #define VIR_FROM_THIS VIR_FROM_TEST @@ -5980,6 +5981,44 @@ testDomainScreenshot(virDomainPtr dom ATTRIBUTE_UNUS= ED, return ret; } +static int +testDomainSendKey(virDomainPtr domain, + unsigned int codeset, + unsigned int holdtime, + unsigned int *keycodes, + int nkeycodes, + unsigned int flags) +{ + int ret =3D -1; + size_t i; + virDomainObjPtr vm =3D NULL; + + virCheckFlags(0, -1); + + if (!(vm =3D testDomObjFromDomain(domain))) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + for (i =3D 0; i < nkeycodes; i++) { + if (virKeycodeValueTranslate(codeset, codeset, keycodes[i]) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid keycode %u of %s codeset"), + keycodes[i], + virKeycodeSetTypeToString(codeset)); + goto cleanup; + } + } + + usleep(holdtime * 1000); + ret =3D 0; + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + static int testConnectGetCPUModelNames(virConnectPtr conn ATTRIBUTE_UNUSED, const char *archName, @@ -7000,6 +7039,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .nodeGetCPUMap =3D testNodeGetCPUMap, /* 1.0.0 */ .domainRename =3D testDomainRename, /* 4.1.0 */ .domainScreenshot =3D testDomainScreenshot, /* 1.0.5 */ + .domainSendKey =3D testDomainSendKey, /* 5.5.0 */ .domainGetMetadata =3D testDomainGetMetadata, /* 1.1.3 */ .domainSetMetadata =3D testDomainSetMetadata, /* 1.1.3 */ .connectGetCPUModelNames =3D testConnectGetCPUModelNames, /* 1.1.3 */ -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list