From patchwork Tue Sep 6 11:30:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Marko X-Patchwork-Id: 1674761 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=FRDSrLV6; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MMPPg4JWRz1yh5 for ; Tue, 6 Sep 2022 22:11:35 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C497D84A56; Tue, 6 Sep 2022 14:10:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FRDSrLV6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4B800849AA; Tue, 6 Sep 2022 13:30:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E92148499C for ; Tue, 6 Sep 2022 13:30:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=robimarko@gmail.com Received: by mail-ej1-x629.google.com with SMTP id fy31so22481311ejc.6 for ; Tue, 06 Sep 2022 04:30:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=B3Z1UmgAOVrj9dbkFL1usgjv6yZ4ZNUgXjxVbeNtVUU=; b=FRDSrLV6ItlzpWlPEeYWig9ShaWa0/bmm4v7wNd7B9ljzyvU/VsN1R2gFIpfWYj53S v6LMmCAmhODTmeDsRVUB+506Qz74ypuRCueMyBa73ZXYEn96C/8B6gz/HaYtLvFia8YU sSzbSPXFwb7Z6XR4suvU7WXrzXuM3GqTcHbx70pn6h+J5d0aHsaag5aykf1caz1kXXsR DTM999XZqPKDig1rVWO859GwqWbmJpCb2lcVKa77LagrW8jq17K8A17lOv2axbbKQYnB 9ieEH43NirJRENiH+6v4DiMSoXMtwDqjdkTIpP8fF6A1JSTbRyauV358/Q+HxGeht+1m qICQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=B3Z1UmgAOVrj9dbkFL1usgjv6yZ4ZNUgXjxVbeNtVUU=; b=QmQOEsKiEB7IEbRrcDX/YVLMbchEPLBcn5XzmmSB3leA4RXzd1qbr1r36qe8tsGFGu XLYrMV2l50x/iYxNdE/D3071Bu1IDqj04MQriHFLXfi5MCmmU62G2Ea2EFHStpTRtjQS 6x9LlsT3SuG5W2Yj4lcYOyZV/g9Bv6pb6Az7qzMclLRNV6F2uIfm4tOWJEBVOUQFwxGP ld8EfYy40gO0RJ+Oc/+nR2M8ECWflKfmTtMyyGmiU3JwCQ+Shor+N+cgTWM9H1qQDxGZ gVVXJo3g6ef37jsn/mNoBf88VRyC/Y6kDYp1WgqaWPaIx5uGFblg8Ea4+34Hel71eSsK d2qw== X-Gm-Message-State: ACgBeo0nquCqYwv44oG4uEexRJCKJI82pQFCl17GRH4xj/oKVYRAyvTW QFkc+Ukiv89WD344uV5/ydY= X-Google-Smtp-Source: AA6agR5OKzYkW755IOdQR+aWglFXaDxEbSyrE/ao/5LRe3ainwWD5OMJGvewEivT7wJ4u2X7xy40pQ== X-Received: by 2002:a17:907:20d1:b0:731:5169:106b with SMTP id qq17-20020a17090720d100b007315169106bmr40358640ejb.667.1662463842312; Tue, 06 Sep 2022 04:30:42 -0700 (PDT) Received: from fedora.. (dh207-96-48.xnet.hr. [88.207.96.48]) by smtp.googlemail.com with ESMTPSA id x68-20020a50baca000000b0044bfdbd8a33sm8310867ede.88.2022.09.06.04.30.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 04:30:41 -0700 (PDT) From: Robert Marko X-Google-Original-From: Robert Marko To: sjg@chromium.org, pali@kernel.org, u-boot@lists.denx.de, trini@konsulko.com Cc: luka.perkov@sartura.hr, Robert Marko Subject: [PATCH v3 4/4] test: cmd: add test for temperature command Date: Tue, 6 Sep 2022 13:30:36 +0200 Message-Id: <20220906113036.1768055-4-robert.marko@sartura.hr> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220906113036.1768055-1-robert.marko@sartura.hr> References: <20220906113036.1768055-1-robert.marko@sartura.hr> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 06 Sep 2022 14:10:39 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Add simple test for the temperature command. Signed-off-by: Robert Marko Reviewed-by: Simon Glass --- test/cmd/Makefile | 1 + test/cmd/temperature.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 test/cmd/temperature.c diff --git a/test/cmd/Makefile b/test/cmd/Makefile index c331757425..f9493357a5 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o obj-$(CONFIG_CMD_PINMUX) += pinmux.o obj-$(CONFIG_CMD_PWM) += pwm.o obj-$(CONFIG_CMD_SETEXPR) += setexpr.o +obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o diff --git a/test/cmd/temperature.c b/test/cmd/temperature.c new file mode 100644 index 0000000000..2a1ea0611d --- /dev/null +++ b/test/cmd/temperature.c @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Executes tests for temperature command + * + * Copyright (C) 2022 Sartura Ltd. + */ + +#include +#include +#include +#include +#include +#include + +static int dm_test_cmd_temperature(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_get_device(UCLASS_THERMAL, 0, &dev)); + ut_assertnonnull(dev); + + ut_assertok(console_record_reset_enable()); + + /* Test that "temperature list" shows the sandbox device */ + ut_assertok(run_command("temperature list", 0)); + ut_assert_nextline("| Device | Driver | Parent"); + ut_assert_nextline("| thermal | thermal-sandbox | root_driver"); + ut_assert_console_end(); + + /* Test that "temperature get thermal" returns expected value */ + console_record_reset(); + ut_assertok(run_command("temperature get thermal", 0)); + ut_assert_nextline("thermal: 100 C"); + ut_assert_console_end(); + + return 0; +} + +DM_TEST(dm_test_cmd_temperature, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC);