From nobody Mon Feb 9 19:25:46 2026 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B2BB193402 for ; Mon, 27 Jan 2025 20:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.60.130.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738009602; cv=none; b=Wqs/cNvaYi/uI9OyyQ8sYjZ068c/PSY4QqTUoaWO+HlY8AXZynxCwWKiJq8ZQsfwgYqjmipqGfmKqTZFQyK7baWGtupYdkiTx6pOCyqGSUcR3tsEQxxW6KjOSmVKCfPZJCbPbIaqYNPwnSFDLnViFevuP1fc1iDqnfBZO4IJkbQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738009602; c=relaxed/simple; bh=b4aRtsMeARET+9dbZDrbUKyh8QtJauMmFBJIGVFP6PE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rSvQpAyizMKxbax/4VnFNRKMkyze1APCj5GfmFyZZi29dOXlwAXLJ1ecNxgmz3ZfGHSls4e8dX+0hGpAfHDtMBRXeMUhwwe82QssyDnjW+g8K3tIuUD9HelhJzxu+HeCbJG6/PcWrxdSWM4kt0SFioj7JSG+Ewh1FgE50Cj88UQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=bYM2UcNs; arc=none smtp.client-ip=178.60.130.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="bYM2UcNs" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=grxcZzrNOlhLTVYhNmLPhD+q/Nxo1f30Anof0Ffi3cQ=; b=bYM2UcNsXY8LuPn23Z4YcxxQjv inO4GEa1tnpf02WAojSM15N6mApZD2ZqYyVK9BtxFMiL/m88GN5GUzistq59KKtuey17EYs9qvsyW P2E03KJgNt7ORg37mYTyBL3e4zcAoImtMeiVHyvUdrgFwOboUs6/yZmk0KvZQLTPwvRA1OtDIu+Fm qayBQ124/ND8celWvhbclYYvWspisiw1w0jo2KqGheHulLLDdpEd5W8AnFKbxZxLacZq6TDjOa2/l vGPv8IXDlxjYdsifXVxK/xHyEKoVEyvFZfGDR8Al2uJ8CzrFZR4eK8kz25uuDv74pOjQ2kjHN5cVB nxOK8Gmg==; Received: from 189-68-33-219.dsl.telesp.net.br ([189.68.33.219] helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1tcVge-003OPi-AM; Mon, 27 Jan 2025 21:26:24 +0100 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: Thomas Gleixner , Ingo Molnar , Peter Zijlstra , Darren Hart , Davidlohr Bueso , Arnd Bergmann , Florian Weimer Cc: linux-kernel@vger.kernel.org, kernel-dev@igalia.com, Vinicius Peixoto , =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH v2 2/4] selftests/futex: Add ASSERT_ macros Date: Mon, 27 Jan 2025 17:26:06 -0300 Message-ID: <20250127202608.223864-3-andrealmeid@igalia.com> X-Mailer: git-send-email 2.48.0 In-Reply-To: <20250127202608.223864-1-andrealmeid@igalia.com> References: <20250127202608.223864-1-andrealmeid@igalia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Create ASSERT_{EQ, NE, TRUE, FALSE} macros to make test creation easier. Signed-off-by: Andr=C3=A9 Almeida --- .../testing/selftests/futex/include/logging.h | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tools/testing/selftests/futex/include/logging.h b/tools/testin= g/selftests/futex/include/logging.h index 874c69ce5cce..a19755622a87 100644 --- a/tools/testing/selftests/futex/include/logging.h +++ b/tools/testing/selftests/futex/include/logging.h @@ -23,6 +23,44 @@ #include #include "kselftest.h" =20 +#define ASSERT_EQ(var, value) \ +do { \ + if (var !=3D value) { \ + ksft_test_result_fail("%s: expected %ld, but %s has %ld\n", \ + __func__, (long) value, #var, \ + (long) var); \ + return; \ + } \ +} while (0) + +#define ASSERT_NE(var, value) \ +do { \ + if (var =3D=3D value) { \ + ksft_test_result_fail("%s: expected not %ld, but %s has %ld\n", \ + __func__, (long) value, #var, \ + (long) var); \ + return; \ + } \ +} while (0) + +#define ASSERT_TRUE(var) \ +do { \ + if ((var) =3D=3D 0) { \ + ksft_test_result_fail("%s: expected %s to be true\n", \ + __func__, #var); \ + return; \ + } \ +} while (0) + +#define ASSERT_FALSE(var) \ +do { \ + if (var) { \ + ksft_test_result_fail("%s: expected %s to be false\n", \ + __func__, #var); \ + return; \ + } \ +} while (0) + /* * Define PASS, ERROR, and FAIL strings with and without color escape * sequences, default to no color. --=20 2.48.0