Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5782227pxu; Thu, 22 Oct 2020 10:53:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywcZru7XOYfMEQjzxHVLiwcnVyHesUaTW31uvXrQCFA8zXhnQCsPTt2R4q4NCMpQmJApvv X-Received: by 2002:a17:906:c095:: with SMTP id f21mr3631661ejz.108.1603389196809; Thu, 22 Oct 2020 10:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603389196; cv=none; d=google.com; s=arc-20160816; b=SUzJ4afSgIxt7SOpLWsFpgVNnX5vU24dHIgxF6xqgeoZ01njVTYE4hN5vtPXlW90AD oObK5nYA+tlZqMvs1aJcYGHVlMvaTQOPhebteuI8zb1eGPh/1Ri1GH08JlIccWgIg8fx wdHBHtvCejiQVzhrBGyAjHvAbEdZAn4sk3dlUJbALdJ9Vc7u/gh/NGG4yoQ6gJ85M6dl 1ywC3ZEOp+XAqBs2OPfjleVzo9Yi/eh0S7+JFMIsCq9t7nh4dZ0FKQ8wejGqs5w1Ubsa ZbUPbLjEpzDKe9KKbvs0Zr9pAirJHW2KcBcG5edHXmMrShlW3mujExWabcIvbsvQNBhZ ZsfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=hX7ZMa2GCNykJTTAO4Gm3iP8AjtT2CDog+aNOzuMU6g=; b=BKS3l0ba8JHRDqL92vsyQ5MRF1u0+5o0YyHZOmLce+qUUwY+IgV3rcl07AbiAWJfyC dSyqrqSUd92yNwjOoJahAP4tK6JRE6v0QkUWezDLBMCoCiysLyPDbw6hOdbgj8f5+bWr tXhB1PzZCrllW8WQWL9RlOW6TrWtg+Ue8LaGy/t07xg4s3464DKWWIqTFQzN92WtUI1y ovVHI2Y5HO3HCf7USnet57Ye9Kp0vvj0z3RzZ09Gf0vhPTITALk0sBud1F7gIlF5LFD+ DaXgKG4oS8oW9D5ZTP9jOjLY8c6PaHSFAHOcn2zNvfLOd0GMTk5L3vgQVZHk4qJy1ise tUHg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r14si1346509eji.218.2020.10.22.10.52.54; Thu, 22 Oct 2020 10:53:16 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2508034AbgJVPFy (ORCPT + 99 others); Thu, 22 Oct 2020 11:05:54 -0400 Received: from mga18.intel.com ([134.134.136.126]:16215 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2507864AbgJVPFy (ORCPT ); Thu, 22 Oct 2020 11:05:54 -0400 IronPort-SDR: jGLKn9jVCYCzuc714i2A5p3okMZKclyjAdgRsw1Efo0gcl5SI2WE1Y5cIiK6IsA74vIYg3Fdhj EQzxFQYt5Upw== X-IronPort-AV: E=McAfee;i="6000,8403,9781"; a="155326398" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="155326398" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 08:05:47 -0700 IronPort-SDR: DnmKSl2doFkSe4e5/aQAyrAEi/WAuS5/1ZSXNRx0fGbgtOg5YM2+9nD5dFXl0cs9pP3wWNgJBB D0w/4/ruMU8w== X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="524308747" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 08:05:45 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1kVcAy-00DMeS-90; Thu, 22 Oct 2020 18:06:48 +0300 Date: Thu, 22 Oct 2020 18:06:48 +0300 From: Andy Shevchenko To: Daniel Latypov Cc: David Gow , Brendan Higgins , Linux Kernel Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , Shuah Khan Subject: Re: [PATCH] lib: add basic KUnit test for lib/math Message-ID: <20201022150648.GH4077@smile.fi.intel.com> References: <20201019224556.3536790-1-dlatypov@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 21, 2020 at 10:47:50AM -0700, Daniel Latypov wrote: > On Tue, Oct 20, 2020 at 8:40 PM David Gow wrote: > > On Tue, Oct 20, 2020 at 6:46 AM Daniel Latypov wrote: > > > > > > Add basic test coverage for files that don't require any config options: > > > * gcd.c > > > * lcm.c > > > * int_sqrt.c > > > * reciprocal_div.c > > > (Ignored int_pow.c since it's a simple textbook algorithm.) > > > > > I don't see a particular reason why int_pow.c being a simple algorithm > > means it shouldn't be tested. I'm not saying it has to be tested by > > this particular change -- and I doubt the test would be > > earth-shatteringly interesting -- but there's no real reason against > > testing it. > > Agreed on principle, but int_pow() feels like a special case. > I've written it the exact same way (modulo variable names+types) > several times in personal projects. > Even the spacing matched exactly in a few of those... But if you would like to *teach* somebody by this exemplary piece of code, you better do it close to ideal. > > > These tests aren't particularly interesting, but > > > * they're chosen as easy to understand examples of how to write tests > > > * provides a place to add tests for any new files in this dir > > > * written so adding new test cases to cover edge cases should be easy > > > > I think these tests can stand on their own merits, rather than just as > > examples (though I do think they do make good additional examples for > > how to test these sorts of functions). > > So, I'd treat this as an actual test of the maths functions (and > > you've got what seems to me a decent set of test cases for that, > > though there are a couple of comments below) first, and any use it > > gains as an example is sort-of secondary to that (anything that makes > > it a better example is likely to make it a better test anyway). > > > > In any case, modulo the comments below, this seems good to me. > > Ack. > I'll wait on Andy's input before deciding whether or not to push out a > v2 with the changes. You need to put detailed comments in the code to have it as real example how to create the KUnit test. But hey, it will mean that documentation sucks. So, please update documentation to cover issues that you found and which motivated you to create these test cases. Summarize this, please create usable documentation first. -- With Best Regards, Andy Shevchenko