From patchwork Thu Oct 5 21:48:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Beau Belgrave X-Patchwork-Id: 149038 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2016:b0:403:3b70:6f57 with SMTP id fe22csp584487vqb; Thu, 5 Oct 2023 14:49:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGaP5BqWR9uKbSJFZIGC4eFdzyByDMCyxvGl6M5yqleZA1nqt51ZUOO2FiB6vhMnhO6uN5I X-Received: by 2002:a05:6358:4327:b0:14f:6a41:5d14 with SMTP id r39-20020a056358432700b0014f6a415d14mr7206156rwc.27.1696542557731; Thu, 05 Oct 2023 14:49:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696542557; cv=none; d=google.com; s=arc-20160816; b=dDZbsXdmWY+aCoTUMS4Y/0jb/X7lWx6tuTepA8GVigrm+HV44MKs6X5Boui4fiAxV/ Jy5akkbcnBFtvivTrcpl5ptB1OX5o4R0ZPzhkOD5MQIAfNmVfxuVVOJ10Z2WiQ3qbhoU lMi4p7V1OZNXStRBBvM8UA7k6UqrlSqvOS7znFn7kXicV8BshiD0f6+Dmk7myGcFJY1Q WXVarAmJ9+0tzDxmO3u2d5WyLj4btRL5RgZEuTHaK47KQucBRRxFDy/uFgR3m4l2Tg1b 7RdY7q09o1FpTmad4vdXiSrrOkzwm+NCJXKqbu5JTyepM2+L3LZKIIrp0TG8XYKK9L2T cI0g== 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 :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=hCvPiWAcpzvP+j1vbN7VOgCxPaVjgvidOXmPmRowShE=; fh=z1RKKgNRi1DpNx8ytZBt4nhxDsUkDwTh/X9m+SXQg6s=; b=dYvAXBkhAfip+UrUXBDPP8tVIKfJUZxwptuVV+64zzRWzPpfVDcPrbjXR5qdGg0SBr s6KOWqXAP3bTK7mvvm+l5xwLIiqgHbWlKh3iSvJFJruC/GgD+/QfsogeuiOjNxCNQHke TNd8PT/JG+tGMQXJlQr0kTzt/Qz6pYKIuT5QkqVfUjK5lIldBo/go/i+95OTnDURrOvH vRblHFqCfFKGZQkh/CWBvytnNNjZT48Uba8xS2oUVzqUnm3Gd75T7eHYy8QS5rAjgl2A cJ+DNRzDVDaYmRC7Ep3SB0WoKCfktk6lzYGv7dix9NJVb5ozAQ4UAKtKQTpdupQnIYwg SaJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ezUYgIkA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id c16-20020a637250000000b00578a7f5a0afsi2283254pgn.357.2023.10.05.14.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 14:49:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=ezUYgIkA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8DB4885C6CEA; Thu, 5 Oct 2023 14:49:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231891AbjJEVtA (ORCPT + 18 others); Thu, 5 Oct 2023 17:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbjJEVs7 (ORCPT ); Thu, 5 Oct 2023 17:48:59 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 654B595; Thu, 5 Oct 2023 14:48:58 -0700 (PDT) Received: from localhost.localdomain (unknown [4.155.48.119]) by linux.microsoft.com (Postfix) with ESMTPSA id 9C89B20B74C0; Thu, 5 Oct 2023 14:48:57 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9C89B20B74C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1696542537; bh=hCvPiWAcpzvP+j1vbN7VOgCxPaVjgvidOXmPmRowShE=; h=From:To:Cc:Subject:Date:From; b=ezUYgIkAhj42oKg/+K2jRMjauUrc1TfLufs7ukxyy1QtLrScrmF+mFlajfjifLwAX ydETfhacyhIMwgrEVNJT+jVy/9ZHsWoTM8bKVzVZb2wsDGJTbYgOcdzAUAyGY0hgAD lSBrGEFsFUZPqV96OX34DEw/xh+D00YWd8oNMEpM= From: Beau Belgrave To: rostedt@goodmis.org, shuah@kernel.org, mhiramat@kernel.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [PATCH v2] selftests/user_events: Fix abi_test for BE archs Date: Thu, 5 Oct 2023 21:48:55 +0000 Message-Id: <20231005214855.17509-1-beaub@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-8.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 05 Oct 2023 14:49:15 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778953808826150757 X-GMAIL-MSGID: 1778953808826150757 The abi_test currently uses a long sized test value for enablement checks. On LE this works fine, however, on BE this results in inaccurate assert checks due to a bit being used and assuming it's value is the same on both LE and BE. Use int type for 32-bit values and long type for 64-bit values to ensure appropriate behavior on both LE and BE. Fixes: 60b1af8de8c1 ("tracing/user_events: Add ABI self-test") Signed-off-by: Beau Belgrave --- V2 Changes: Rebase to linux-kselftest/fixes. tools/testing/selftests/user_events/abi_test.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) base-commit: 6f874fa021dfc7bf37f4f37da3a5aaa41fe9c39c diff --git a/tools/testing/selftests/user_events/abi_test.c b/tools/testing/selftests/user_events/abi_test.c index 8202f1327c39..aa297d3ad95e 100644 --- a/tools/testing/selftests/user_events/abi_test.c +++ b/tools/testing/selftests/user_events/abi_test.c @@ -47,7 +47,7 @@ static int change_event(bool enable) return ret; } -static int reg_enable(long *enable, int size, int bit) +static int reg_enable(void *enable, int size, int bit) { struct user_reg reg = {0}; int fd = open(data_file, O_RDWR); @@ -69,7 +69,7 @@ static int reg_enable(long *enable, int size, int bit) return ret; } -static int reg_disable(long *enable, int bit) +static int reg_disable(void *enable, int bit) { struct user_unreg reg = {0}; int fd = open(data_file, O_RDWR); @@ -90,7 +90,8 @@ static int reg_disable(long *enable, int bit) } FIXTURE(user) { - long check; + int check; + long check_long; bool umount; }; @@ -99,6 +100,7 @@ FIXTURE_SETUP(user) { change_event(false); self->check = 0; + self->check_long = 0; } FIXTURE_TEARDOWN(user) { @@ -136,9 +138,9 @@ TEST_F(user, bit_sizes) { #if BITS_PER_LONG == 8 /* Allow 0-64 bits for 64-bit */ - ASSERT_EQ(0, reg_enable(&self->check, sizeof(long), 63)); - ASSERT_NE(0, reg_enable(&self->check, sizeof(long), 64)); - ASSERT_EQ(0, reg_disable(&self->check, 63)); + ASSERT_EQ(0, reg_enable(&self->check_long, sizeof(long), 63)); + ASSERT_NE(0, reg_enable(&self->check_long, sizeof(long), 64)); + ASSERT_EQ(0, reg_disable(&self->check_long, 63)); #endif /* Disallowed sizes (everything beside 4 and 8) */