Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4363618imm; Mon, 18 Jun 2018 13:41:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLmyF55YpfQvaGIivVDCSRF+kqhQ9rM/XZyFzeobYQaogmKiRiZZiodbP2TJ2YHgTmVRd4/ X-Received: by 2002:a62:fcb:: with SMTP id 72-v6mr15003369pfp.231.1529354498323; Mon, 18 Jun 2018 13:41:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529354498; cv=none; d=google.com; s=arc-20160816; b=MqB66ZOjP0O5ZVrX8nd68vHW2A6TQV9/UMSuW9um5FO2djS2cG9Q8iNFJgnToYbGiM 2fwJkqcZjCPbvy0HZ9vdBO8PQ0IEd20bytNgsT/V4GqjIOqUbFm1WYNQ9eRufW3jmvjt WVu2+9WodVitLYHIyqTIP17VOXBpQy+3/g9qWAT6Li6FlvTBpPcMl1+HO/1mi+19zr+a dpnjUhvolw1myFYsFW51QIAaCu6LvrtC90q6DSsN0NWrtu4a4wcN90OD9eDwZ0lS9ru5 KaYr4HZ+VTe21xwvKmNwBUkTVhFncLDS1Qp8y0yXnJqWFOpvJnyjV/e5zOHmhxb5RMHc ZgqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=tV8R5CBaIiddkC7i7Hw540epTksskscHIOu7TsPisew=; b=ADzrP1DRurYveJzEbr8kFcPEF8tW8IVNX7mw9Du6pnen4kELt4ByDxb5K1j9HYoD1I uNBZUblF3OPAPbs5DVlJxFE2IpFb/TyXp8etehsz4CTB8wAwOp5a/Logy16Yl0XRoiED BdSU+ZsFjyYeKSIxkKg2zMbO+1cnY8UmmgnKtxXgkPomI2m7q4jrnq8QRl3BYudw0fhd 1vQ5QDdchZP7lrPRqcRrblS0E9l4oIRMGRvi8LLmKmsuRmaMfMLOxAcWt423T5wHN6p3 TKDA3c9hnRLnJEgoTxm+vmbFM4RV4uIiL+fSl/OX2gNv2IaYUyWxj5qnbAubRo/q6XNv GyoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cw13f4h8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f59-v6si15775739plf.500.2018.06.18.13.41.24; Mon, 18 Jun 2018 13:41:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Cw13f4h8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936893AbeFRUkc (ORCPT + 99 others); Mon, 18 Jun 2018 16:40:32 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:40765 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755326AbeFRUk3 (ORCPT ); Mon, 18 Jun 2018 16:40:29 -0400 Received: by mail-vk0-f65.google.com with SMTP id o71-v6so10381013vke.7; Mon, 18 Jun 2018 13:40:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tV8R5CBaIiddkC7i7Hw540epTksskscHIOu7TsPisew=; b=Cw13f4h89z4WWNai/Kb+7quZoyTvcCU0MfZ0ahUuf0opfgDpcsZrf8Jv9kRm8s3gYs QqDvZp3ynqvzWRfBtrAm4B8QJ3aH+csGNyONX1iKF05lqROfkyXjzuB89+Jgi1602HFw wpYLwuK5UELZ7KeHQFaspwO6xRGHK3iflDTlV/JY1t2uh6Ye6eXsHqYiaUhudHuNvh0S IU/biYU3U5pmlSH4B8ulaK2TIfGh/+wkD6O+3S9AGZNvOmiBlMyIYuPtl4EG1SRgzPro jq2zh73+zoN/Oo8yQnFWkbrBPaCb3DLSFlEOhx3+vCqZ/yLH5lWrfY6vXEC/vvj0cTl/ 15lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tV8R5CBaIiddkC7i7Hw540epTksskscHIOu7TsPisew=; b=TMBEupEQNfbWFXHk0gcxidGNBpveQ8/UzE/6Yq5AN4i7TxTam3Y3A6at1r9qSIo72b M0VtdIJ4VP0Ve+VRgttQ8dxFzLg0D5+7Imk3z8yn80ryjonGKUcs1H05Bry4xBK9vHHt 1FrT07hzgGLe1gv7JJZoWtYUXDBowSOmZdHMH+KLX+3HbudgX5O689hZjHxdPN3gRruA 9y4zIxJ/fIN4QaN2OM88MKt18AtffYUdc6fRu+E51FnoCft/WVNZu64duiT2SFYdPg+a 0fNl+lKaz55zhkN/U2eMG/Ow8YGGsGU9lbpReOaG7nr6Q+tCF//1FkFraXc9Dj72R+a8 06qg== X-Gm-Message-State: APt69E0rBrvTsJNaxxiKQcPsAU9JNLxZ3vJ/a93VdjnQvqv4DrWROnIo Z7pEKp5VtLqnieSD7EnQpb+RAZm0bGRXEgRtWaI= X-Received: by 2002:a1f:d1c5:: with SMTP id i188-v6mr8167800vkg.131.1529354428052; Mon, 18 Jun 2018 13:40:28 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:8b02:0:0:0:0:0 with HTTP; Mon, 18 Jun 2018 13:40:27 -0700 (PDT) In-Reply-To: <1529353683.3092.32.camel@sipsolutions.net> References: <20180618195618.17536-1-johannes@sipsolutions.net> <1529353683.3092.32.camel@sipsolutions.net> From: Andy Shevchenko Date: Mon, 18 Jun 2018 23:40:27 +0300 Message-ID: Subject: Re: [PATCH v3] bitfield: fix *_encode_bits() To: Johannes Berg Cc: Linux Kernel Mailing List , netdev , Al Viro Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 18, 2018 at 11:28 PM, Johannes Berg wrote: > >> I think would be better to add test cases first, followed by fix. (1 >> patch -> 2 patches) >> In this case Fixes tag would be only for the fix part and backporting >> (if needed) will be much easier. > > Can't, unless I introduce a compilation issue in the tests first? That > seems weird. But I guess I can do it the other way around. Works for me. > >> > @@ -143,6 +143,7 @@ static __always_inline base type##_get_bits(__##type v, base field) \ >> > ____MAKE_OP(le##size,u##size,cpu_to_le##size,le##size##_to_cpu) \ >> > ____MAKE_OP(be##size,u##size,cpu_to_be##size,be##size##_to_cpu) \ >> > ____MAKE_OP(u##size,u##size,,) >> > +____MAKE_OP(u8,u8,,) >> >> Is this one you need, or it's just for sake of tests? > > All three ;-) > > We'll probably need it eventually (we do have bytes to take bits out > of), for consistency I think we want it, and I wanted to add it to the > tests too. Okay, but I still think it makes sense to have this oneliner as a separate patch. > I disagree with this. I don't see why we should have le8_encode_bits() > and be8_encode_bits() and friends, that makes no sense. OK, it was just a proposal. >> I guess you rather continue and print a statistics X passed out of Y. >> Check how it's done, for example, in other test_* modules. >> (test_printf.c comes first to my mind). > > I see it's done that way elsewhere, but I don't really see the point. It > makes the test code more complex, and if you fail here you'd better fix > it, and if you need a few iterations for that it's not really a problem? The idea is to print what was the input, expected output and actual result. Then you would see what exactly is broken. I dunno how much we may take away from this certain test case, though it would be better for my opinion. -- With Best Regards, Andy Shevchenko