From nobody Tue Feb 10 03:45:09 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 9AC50158DC4 for ; Fri, 10 Jan 2025 20:05:36 +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=1736539539; cv=none; b=LdfJJMtC/HOMwGtODKCGIIFNouMQ60jCXiccTMRkLnM5T7MHH4aSKiOc+kzYzN0ldut9NSymwvJ+i3yjXjtUIvc7GcO9SsQYZuusexDAShV+oCPL/eqHesWwaCcKU3TlRV5qxtXIX+xsg/NzPCZSZ14HEzWW3VDB+kXE2tja/PQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736539539; c=relaxed/simple; bh=Bkf1kQ5N13iXuGGknQQh06++n04kjlps5mSLYTQleoM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kEbadlpGev3/MepxZx63QHj0c7q+jsGy4R/EY8MI/NGQx8dleyIVGbZYPzcAUj/bHVfmD6STZnHsrBqcg6bLS/8Zm+C18wBx3mV7XDD5yhsGjWfFYrPX1xInX9bySavlLNAwCFfRx3rVfKQDRl9IMckfaqgdntwxuoyHZIwY2V0= 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=QKbiOqIw; 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="QKbiOqIw" 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=j8PCbgWbhVazCv/Tivq4sfQeyqPfFSWqIk1/pr7ejjA=; b=QKbiOqIwUhEEUH2Lh9K0MlNXz8 eWNAlZcoJO5+8ejycgPU5GjQCHH1IgSyjV+9NW8NOA/ZqsIk28J8qWrkhDxUwqkC1DeurI1yWgRbC Y+FBjWiRc5ZWrooeHeg2QgGfeia3CuFLmQC7dxsIJuKcvIkj6hb9W3M+pysjen1YyeC/YTHvn04n9 VSgAJT0p2kxYW3p+t8WP3/CvmLKh9MwEtQNw4nw7IcPbf4YG9fl9uWPAUFSC98f6Y9jX5UlczysFe dPFM+WlwqkIOyRfIp8JLxn8cSiKGMTSrRx6Es2lIfrAygnN3AICNae+TORYrghCM7voIg9yuhhCiN H80/OGtw==; Received: from [177.139.21.57] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1tWLFw-00E827-Re; Fri, 10 Jan 2025 21:05:21 +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 2/4] selftests/futex: Add ASSERT_ macros Date: Fri, 10 Jan 2025 17:05:06 -0300 Message-ID: <20250110200508.353290-3-andrealmeid@igalia.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250110200508.353290-1-andrealmeid@igalia.com> References: <20250110200508.353290-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.47.1