Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3408546pxx; Mon, 2 Nov 2020 08:08:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJylRR52wMDMGi5vywbJi0EYvlRvgcAkhDktRli4b9NwBjGLNhSaF/2KHMynAK0tirzpunSy X-Received: by 2002:a17:907:72cd:: with SMTP id du13mr15115048ejc.398.1604333291723; Mon, 02 Nov 2020 08:08:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604333291; cv=none; d=google.com; s=arc-20160816; b=fPf1MMydcJmtfLbpClWr5cDDDDBbT+aZ0YCVrKuUx+tcT5C9AeSbguLU/Hv+yiUsmc dbzFh6C4krSdKQKjueeZiFZqdnFNWaXG7UZ5u8mkMhL1PAlWcAh3hztUAwNNVzauueRw Razisomdyv4A1OTzSrrFu8C8/daRCTGu+ITABeXj9z8HpOhtYyCargxilxnUwWG/CP7L EZNkpj8zJlJVinLe0DrunbhTpjOM6YSibrjfYxvb9LIbyL5G0NraRUBIbgziz9BqUFEY rZP5kNCBL6AkvQ5isTRW9f+ZiU1TeypDYIj/1LDhhlNZbB7weR3kr5NF44EfwR2qlYXZ p/gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:mime-version :dkim-signature; bh=9U519WWw6TDZQ33OGLBJjsTVpJX0KjTb47DTCYLn51c=; b=SV8X5OC7HNMTJD4t5GN4SzeCfKhMS8b3wFSnkXe/ZAaCHNLZyUKFVar68pITgm4nD3 mag2cPLpv0LQGLnXOLOqTAfNWLUd1QJ+/KnD6OCkWHS712VCUdV5FAvhzWmbUAMb1LcD 8l3uMJuxM8K2n/ppSroUXcc1Ph1dL9K91dlfivXureLq9gmcEh4nLvuff29cDeBYajim YjpANuwnmbWm9i5JUwTNEaPmeNUPoVtQwLh37HEVzZkgPj42CJnmAPpF/XUDqpHxC836 HQOpspgL+Cl9pTXf0TdBH2AU42ejuZ+5tvESlnNk4K3u0umUvAu/iVDsSKR79oHTancT fXZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XBV11D3h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jr1si11604548ejb.164.2020.11.02.08.07.48; Mon, 02 Nov 2020 08:08:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=XBV11D3h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726459AbgKBQFg (ORCPT + 99 others); Mon, 2 Nov 2020 11:05:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbgKBQFb (ORCPT ); Mon, 2 Nov 2020 11:05:31 -0500 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15503C061A49 for ; Mon, 2 Nov 2020 08:05:31 -0800 (PST) Received: by mail-lf1-x12b.google.com with SMTP id h6so18115146lfj.3 for ; Mon, 02 Nov 2020 08:05:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=9U519WWw6TDZQ33OGLBJjsTVpJX0KjTb47DTCYLn51c=; b=XBV11D3hMt0/lfz9orFTgOOHlkoSQTctDbSg30moLGCdPgHOGNBT6FfCLaCAVj4WGa GhjwiMUe5h5n0Vn+tEGbS1TbCOIYAom6xf5QDMiiPS7g5zXqzBnsmmJ3l2IN489ApUv5 k7cWGSbweRACd/yeHVpAPke8JH1ybfrvlMjFy6VaYUdHVc4lnjLUev7mJ01y71mXtQpQ 2t670Gw5HTK1J4kDdJrS4wSKcDirN+bzET+JNUBw3+eHGYYQjwP4InUCC7MtoJtv9lQf FaBPFNc81s1hN8+Gb4+UHQxwj80ShQtGaNH70Wf/eus0CYugdc6oCSVQZ6R2quU62Ds9 8REg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=9U519WWw6TDZQ33OGLBJjsTVpJX0KjTb47DTCYLn51c=; b=cu8kKk5CGg1qHNPqTiaQOKyTuk5DL1QfhXIxmE1/01/7Gqk/xC1lQdxIdLMGiJv8aV UMWIQt5MTWQaXxqJZxQ9kkAlhvjDkjSsZV5Y+skTj2Q4BrXduPwwg54A6NIs8Lb5pdq0 SiF8SXnFzjXqzWCAsRvKdW0ULUApuSOSSYJaqk1UKBPy5I4GzV54zLf9AO0R6TLzTdZl Q/bFJszpqE29Zih5L9dn32yhmvKdAY1GwpXn5osu4uifi0Wu1BZLfKCz+F5159jC0IwN tMIBUF8R+FT53bnHPhnAf969pxb1hnxGPAcwFc4a5reOCXQZ4HKA9bJlhTfCLNucx2Wy yBpg== X-Gm-Message-State: AOAM532hxHtgIuadpgJKOexuDhTL7PwY+oBjE3+hVMhDCNKuS9yPbn6x DLp1yh623eIfh3TGDeqY+YPqUaoKy/a4f7GaOMOgGA== X-Received: by 2002:a19:4f0c:: with SMTP id d12mr2342827lfb.576.1604333129223; Mon, 02 Nov 2020 08:05:29 -0800 (PST) MIME-Version: 1.0 From: Jann Horn Date: Mon, 2 Nov 2020 17:05:02 +0100 Message-ID: Subject: ASSERT_GE definition is backwards To: Shuah Khan , Shuah Khan , "open list:KERNEL SELFTEST FRAMEWORK" Cc: Kees Cook , kernel list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ASSERT_GE() is defined as: /** * ASSERT_GE(expected, seen) * * @expected: expected value * @seen: measured value * * ASSERT_GE(expected, measured): expected >= measured */ #define ASSERT_GE(expected, seen) \ __EXPECT(expected, #expected, seen, #seen, >=, 1) but that means that logically, if you want to write "assert that the measured PID X is >= the expected value 0", you actually have to use ASSERT_LE(0, X). That's really awkward. Normally you'd be talking about how the seen value compares to the expected one, not the other way around. At the moment I see tests that are instead written like ASSERT_GE(X, 0), but then that means that the expected and seen values are the wrong way around. It might be good if someone could refactor the definitions of ASSERT_GE and such to swap around which number is the expected and which is the seen one.