Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3353592rwi; Fri, 21 Oct 2022 15:21:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6iYqb2yDRlQfrNnTkJ0OZZrx5JpNrvmFMD0RmnKrM9PqaaUEIbXNAFs3mrfuMhJ0yP4Z15 X-Received: by 2002:a50:fd1a:0:b0:461:737b:4049 with SMTP id i26-20020a50fd1a000000b00461737b4049mr565609eds.407.1666390893467; Fri, 21 Oct 2022 15:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666390893; cv=none; d=google.com; s=arc-20160816; b=zPPN6cn9H5E9EsKH4hihWRWe4C0Fv2JgY9uWXRRkGXun1a2PaY0OFI5ehQqyVBJ3Ct tFV1xNWGiaUG1SExBo5ZjThNFZqLvncQuFOK5u7VNIXYZKiiaMead21b7pF1OytV6mCC ZbgWl0zw+XAghbVEzbO+GlLzkU5wgPLwx0jhSQPZ7iex7jPD0HZ6s0I1mojXkDH/DL8L FknalVS0lLt3IHHj2/RTl7Jtv5s2G9B/Zg4PyjfvPXXQ8E6iQkfR0yoDXgbJpvIZa61i sKyqxvp8wmBCC1uh/1IV9nVuzCAqOstKEVk/K0Jd01S4PHYcR+ACCYu1GwkMq74six4j zeMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xEShaJ32qONw6Ik3PO9e5EbC1hloeWQUD82bcXUGSI8=; b=a5T3Nhe7HQOSvtBcxhMvVWX3KnFPG4SipKESa+i3GlIMTf4sT1SOBEQ7dZYzHFG036 QBTw+f4rUSAMvQkaWNtJr245oTi+HvMZJH40REmxWZZ9r6kSLQAF+DnXgSYufX6Uwq1A CDXjbDeNTdlY/ssY+1R0pDkQVlmmDTWGzo7d+yiziEZOgKMQhoSpdvUTOWjosqgO4qzD UA6nOSDCNp+NxERjkU56SHb8Pn7UmTEZ+3wnr1UJiKGdsYcS4fVBXQNm0rG0rcRHp4AU 77zZRyfhbRHfpKMU9q0kdcfB81D1BXcztMQQQBhD/H0BFP21RtmjoMu9soqo0/aLfaVZ S5CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=fEx4OTp+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020a056402061200b0045cc02ce2aasi18474138edv.319.2022.10.21.15.21.07; Fri, 21 Oct 2022 15:21:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=fEx4OTp+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229921AbiJUWSo (ORCPT + 99 others); Fri, 21 Oct 2022 18:18:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229919AbiJUWS2 (ORCPT ); Fri, 21 Oct 2022 18:18:28 -0400 Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F1382AB112 for ; Fri, 21 Oct 2022 15:18:26 -0700 (PDT) Received: by mail-il1-x12f.google.com with SMTP id o13so2384248ilc.7 for ; Fri, 21 Oct 2022 15:18:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xEShaJ32qONw6Ik3PO9e5EbC1hloeWQUD82bcXUGSI8=; b=fEx4OTp+x4ZE3H0fyqrFYVgdQxHMwlNZn9v+cFhrbYHz7TvbhSRwcHFDCONm6rROR8 KZGHntnFCQuRr909vmwZQjb1lJgqJpCwL/jigAYpuLI7eCLxKzlne6Wm2rIiNKrhBxYi CLeJjlNpmomCTYwKuAhN9vxHI8n2g7ByAVVV8= 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:message-id:reply-to; bh=xEShaJ32qONw6Ik3PO9e5EbC1hloeWQUD82bcXUGSI8=; b=3kZo+x17xYaxYYp+dZaAVXGsPwtb+havORoudACenE9412VR55D+3BHSjZpoHc9A41 lDN1UO436+MLFsqs75HamI/oDOCQw2zIQueq8fOhkw/A16sbCRbxDT0L+jO5we07bCEa ixSYgMwLXdIPg1si9QpwTGO5eIh1PSnNmcBWuqWVv3U0g1Uq/gm6oN+BMAQ0FZRinzUv buj0+8uXp9c6ZirpehjqPUyTBsnt9/PPyyseUXRfUo2hO5AKXNygQmerLde5+Z3dTfSH NXhUIICeKhWq4W1klU+PxH+PpvwB2YqwImJvfKPkiXcbsmcHv/5+FTxXfR5wUVnnRjym w1KQ== X-Gm-Message-State: ACrzQf1e9eDPaguysox/0pRAswtw+gZGh1UTur5t64ZKFFUSpUXDi5/t 2POoUXWFvNNyfNptWmDqgPe0XQrI/OoBEA== X-Received: by 2002:a05:6e02:184d:b0:2fc:2d17:4fbf with SMTP id b13-20020a056e02184d00b002fc2d174fbfmr14693702ilv.150.1666390705483; Fri, 21 Oct 2022 15:18:25 -0700 (PDT) Received: from shuah-tx13.internal ([38.15.45.1]) by smtp.gmail.com with ESMTPSA id cp6-20020a056638480600b0036cc14af7adsm430740jab.149.2022.10.21.15.18.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 15:18:24 -0700 (PDT) From: Shuah Khan To: skhan@linuxfoundation.org, shuah@kernel.org Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] selftests/watchdog: add test for WDIOC_GETTEMP Date: Fri, 21 Oct 2022 16:18:19 -0600 Message-Id: <2b559a7d0d2be46729f3a03dc639dd4a69e465bb.1666390362.git.skhan@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add test for WDIOC_GETTEMP and this ioctl might not be supported by some devices and if it is this test will print the following message: Inappropriate ioctl for device Signed-off-by: Shuah Khan --- tools/testing/selftests/watchdog/watchdog-test.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c index 03103eaa946c..5ec0384b7f02 100644 --- a/tools/testing/selftests/watchdog/watchdog-test.c +++ b/tools/testing/selftests/watchdog/watchdog-test.c @@ -1,12 +1,10 @@ // SPDX-License-Identifier: GPL-2.0 /* * Watchdog Driver Test Program -* - Tests all ioctls except WDIOC_GETTEMP +* - Tests all ioctls * - Tests Magic Close - CONFIG_WATCHDOG_NOWAYOUT * - Could be tested against softdog driver on systems that * don't have watchdog hadrware. -* - TODO: -* - Enhance test to add coverage for WDIOC_GETTEMP. * * Reference: Documentation/watchdog/watchdog-api.rst */ @@ -177,6 +175,7 @@ int main(int argc, char *argv[]) int oneshot = 0; char *file = "/dev/watchdog"; struct watchdog_info info; + int temperature; setbuf(stdout, NULL); @@ -255,6 +254,12 @@ int main(int argc, char *argv[]) print_status(flags); else printf("WDIOC_GETSTATUS error '%s'\n", strerror(errno)); + ret = ioctl(fd, WDIOC_GETTEMP, &temperature); + if (ret) + printf("WDIOC_GETTEMP: '%s'\n", strerror(errno)); + else + printf("Temeprature: %d\n", temperature); + break; case 't': flags = strtoul(optarg, NULL, 0); -- 2.34.1