From patchwork Fri Oct 21 22:18:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 13015518 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D00EC433FE for ; Fri, 21 Oct 2022 22:18:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229966AbiJUWSj (ORCPT ); Fri, 21 Oct 2022 18:18:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiJUWS2 (ORCPT ); Fri, 21 Oct 2022 18:18:28 -0400 Received: from mail-il1-x12b.google.com (mail-il1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF0BB2AB11A for ; Fri, 21 Oct 2022 15:18:26 -0700 (PDT) Received: by mail-il1-x12b.google.com with SMTP id q11so2368200ilj.10 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=Ld/XZrCQ6RRueSWKdKjgAbCrLTqhJC6Nkj4H5PuvZgTj1pUiXqmcfC6x3YCGWzSzSv seaLtj9Q78cW48x4CFW6zYbKfRUS8bSSB6PGF5IZDQpc4y1DGp6PXVUuIgBIDlW8JH9p gfFyXGSmAy2+vydb4pq7jPIP8VSBnxaAPXNw+LR9R7SzLozk+Q34wMsvHrsl3NyWbvt0 TrDx5GyLyJNjwoDGFoEkiJrn1RX9QoQmkdpNP5jQD0Tr3EYUxY+gb20VVqPbsllMhnAu bvbS5gXIbwu5XZkbaN+KH9CQ2OxxlPATs90v1ZIRUuxXm4MdqIAArKhzb9OW7mD9WkVL iqpg== X-Gm-Message-State: ACrzQf0YpPSMtZSqvBcpf1WoO3FXxU/ZtLTY+dwfyHENvjiDcfAWTh1O ddlDzZ7uYVxAwPJYA0PQh5CKmQ== X-Google-Smtp-Source: AMsMyM6lM/rYjfxg+jLPtpZy6aJxXUzDKCO0FalDgdayZH+Xuieo7F5XlhyjFLFaCIc2/6eX9SdmgQ== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@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);