From nobody Tue Feb 10 03:40:23 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1587472176; cv=none; d=zohomail.com; s=zohoarc; b=f5AfnSN/OVKHhpaYgMNTaoljhmOiRL4JKDaPeHE0zfBoQ3kJKzslhZiEOuROrQS6a9p8dpqAVcr2Ugh5EriYT6GGbv/nbfu+Ur225SnHIW+uyFgoOtaW6ggxGEf+x5vvIw8YqkBXDOH9xOCq6pzuA8s3Q0ftZkfFAUjvl5dCOtc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587472176; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6G+yfsnGl0+FoI1DVe5nG84rFUeB4gMvQlTXCcmvbGo=; b=YhfE/ez5Bo/3srZKOzZC7uDHvAiTUhFeiU8R0tkaj3Dvz197E9+dAWj97Uyd4ssuxugFIM3uX/QsrW2Avtqq8+j4NqVFmpyU2ht/Kg+nnSL3C7t9HwupxEW7ccF7ykVtYRC29oMk3b8wog+wUjzupEqBS4RNi35t/w13ZoOOnHY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1587472176102835.9140975143671; Tue, 21 Apr 2020 05:29:36 -0700 (PDT) Received: from localhost ([::1]:57112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQs1t-0008SV-Po for importer@patchew.org; Tue, 21 Apr 2020 08:29:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59406) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jQrpr-0005qW-VU for qemu-devel@nongnu.org; Tue, 21 Apr 2020 08:17:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jQrpr-00071Y-B1 for qemu-devel@nongnu.org; Tue, 21 Apr 2020 08:17:07 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:46460) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jQrpp-0006xF-LR; Tue, 21 Apr 2020 08:17:06 -0400 Received: by mail-wr1-x444.google.com with SMTP id f13so16187768wrm.13; Tue, 21 Apr 2020 05:17:03 -0700 (PDT) Received: from x1w.redhat.com (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id z76sm3761140wmc.9.2020.04.21.05.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Apr 2020 05:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6G+yfsnGl0+FoI1DVe5nG84rFUeB4gMvQlTXCcmvbGo=; b=P28zWxOhgj/kk2eFtgcOogIrmHhqvdVkBUxEqOBLZDSXbJR4aDlGb6OJRXrE+ucTJh /mRlRhNA6dRmFOJMVJfv5MFOCzuDlgPN3+gR2Ou1oquTSOnc3Rrd8oL87UrZnZmeTbJm JPqyRT7CxAnKjbn0EVfscA2FmaiFc4LEtUt93YLVIk4+XJfZTa2p+wUFebt7BtuLi1NN rZ8GSu823RJfkTcNOF4vbJkDeN2wx0uqeCi5rGee15YV2zBbGnXIIOUF7JEdE6IhzVVg ZoSBdKfiwpRkGXnWXC31/fvc0FCVJ3ETFghWKoHX+UrENu+gEQlM08Ei1Vt3V3PNnZfp U3Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=6G+yfsnGl0+FoI1DVe5nG84rFUeB4gMvQlTXCcmvbGo=; b=J+R47HTsYSC8ZgG6p/N4miLx59onvvZ8xOupaQSaH8cGlA03arjOB9GRn7ga0igM48 FZMbfBcljbeAHuOmtcjMsT9dSZ8pnmfxi6nU1wpDfI//tQXYd16KRYHSKXXhjgpxLFc1 OCTnJ8W2Uc3bcyfeOjX3S7SlUMlf4sxwNouZtQDobetFCvAEZ1lGrczRgc2DT5lCYeIG cH2wooYlHjvOPJg3GEHVnVS1bP8WUYARbE+YU2SrEB2ZJJB6fTKEvRNmVijMoWsA9dcg 2J/HkyXJssiVwDGqUoRm3KMoLTBY4oqJQBnBRmcCi7lWGp1TR/7PFZSgUaw+hxsR0D7W SKeg== X-Gm-Message-State: AGi0PuZ9CcROhWC+2lAnPa7vZjOqVw9BQ16rhB412Y9gypTZcfbx4DPT 7n1NxOp9YVv4s67cIMnumL6ZUudY1eY= X-Google-Smtp-Source: APiQypLT0kV7SUOMIsBIsPVtCVbLNbao9Mr8xhh/jELgIudFntr1gJk2fR+ozPEYlGZHrd/C8V+QMg== X-Received: by 2002:a5d:65cb:: with SMTP id e11mr23542319wrw.402.1587471421434; Tue, 21 Apr 2020 05:17:01 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 17/17] tests/qtest/tmp105-test: Trivial test for TempSensorClass Date: Tue, 21 Apr 2020 14:16:26 +0200 Message-Id: <20200421121626.23791-18-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200421121626.23791-1-f4bug@amsat.org> References: <20200421121626.23791-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::444 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , qemu-block@nongnu.org, qemu-trivial@nongnu.org, Michael Tokarev , Markus Armbruster , Andrew Baumann , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-arm@nongnu.org, Paolo Bonzini , Jean-Christophe Dubois , John Snow , "Dr. David Alan Gilbert" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The qmp_tmp105_set_temperature() call will trigger TempSensorClass::set_temperature(), then hmp_info_temperature() triggers TempSensorClass::get_temperature(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- tests/qtest/tmp105-test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/qtest/tmp105-test.c b/tests/qtest/tmp105-test.c index f930a96b83..db7e505cbe 100644 --- a/tests/qtest/tmp105-test.c +++ b/tests/qtest/tmp105-test.c @@ -41,11 +41,26 @@ static void qmp_tmp105_set_temperature(const char *id, = int value) qobject_unref(response); } =20 +static char *hmp_info_temperature(const char *id) +{ + QDict *response; + char *output; + + response =3D qmp("{'execute': 'human-monitor-command'," + " 'arguments': {'command-line': 'info temp'}}"); + g_assert(qdict_haskey(response, "return")); + output =3D g_strdup(qdict_get_try_str(response, "return")); + qobject_unref(response); + + return output; +} + #define TMP105_PRECISION (1000/16) static void send_and_receive(void *obj, void *data, QGuestAllocator *alloc) { uint16_t value; QI2CDevice *i2cdev =3D (QI2CDevice *)obj; + g_autofree char *s =3D NULL; =20 value =3D qmp_tmp105_get_temperature(TMP105_TEST_ID); g_assert_cmpuint(value, =3D=3D, 0); @@ -56,6 +71,9 @@ static void send_and_receive(void *obj, void *data, QGues= tAllocator *alloc) qmp_tmp105_set_temperature(TMP105_TEST_ID, 20000); value =3D qmp_tmp105_get_temperature(TMP105_TEST_ID); g_assert_cmpuint(value, =3D=3D, 20000); + /* Test TempSensorClass via 'info temp' */ + s =3D hmp_info_temperature(TMP105_TEST_ID); + g_assert(strstr(s, "tmp105-0 20.00")); =20 value =3D i2c_get16(i2cdev, TMP105_REG_TEMPERATURE); g_assert_cmphex(value, =3D=3D, 0x1400); --=20 2.21.1