Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2066848pxb; Thu, 28 Oct 2021 15:34:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyc53jhRLRRbw/zcvAHR1rRJ2gnD6ZOxWJjygXj8+NjrtF54zvPTVcTAIYevV4VQG/eDoAR X-Received: by 2002:a17:906:a986:: with SMTP id jr6mr8790194ejb.520.1635460469310; Thu, 28 Oct 2021 15:34:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635460469; cv=none; d=google.com; s=arc-20160816; b=sqczyuXCzA03YkSOKTLp7NBuTf4oMYBi6lb3xqrKNnYZyHLeL6OSgfIsJMI586fUPF mhPxRM9CNh3IujbzHVWIA97gksDm6+W3P82nDyoMcf/ANw26fcB+Fux94QpOmusRQNIN e1LWQia49+G3TdzEnGPbXSoAyT87pxdXBIyK7cYEL+y+FvFX8jIXstMMKMXO+q6tt+f6 CdgRMefjWqEwxZdSZ3Qh9puSyWUrJLtscRnvWRoCRQf6FJBhhRu3mEm0BrBHektFxXXC EHM876S1QQHAm99t0RrXlkV0WUh3SCgnnwrye//sG1o8G2J4QFbVZpu/JdcIb+yJN7QB 1jHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=mUn91EgGsLr2MuiOoklihGG2RS5maYKSX5KJ2F6srOw=; b=obYlaM8q+Tv02XlAit7Uo09Mp6JROpq0FwVBrGmHD+u91U2tAuxef0T6R+B5jUMqaT 9MUE2YR1w+/pSDVrEQGK0L91UhXOVLHSvKUqYyn9zEOC4qsAvLjQuLoyN60jW0o9GI92 oLriia8jXTA/PIbAhYJatnewwE7BhpO3HJrHqKVz+oKZcNXTUA9lga7X1CBuPq+GHedg 8MkGF8mYG2CPK1H5eFlEx87R/TWXwLw6PUgeVBqydv4j3fecbPllj6L723JsC0CrU6DW 4VICt4wlpgZ2tmrxCMUx6YJjV3tbONURR+GzdNsDZGJOo7tv0RnClf1XFWuu3zGmknZL R2Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@riseup.net header.s=squak header.b="JDtJK/6E"; 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=NONE sp=NONE dis=NONE) header.from=riseup.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x1si5553245ejw.232.2021.10.28.15.34.06; Thu, 28 Oct 2021 15:34:29 -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; dkim=pass header.i=@riseup.net header.s=squak header.b="JDtJK/6E"; 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=NONE sp=NONE dis=NONE) header.from=riseup.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231511AbhJ1Wem (ORCPT + 99 others); Thu, 28 Oct 2021 18:34:42 -0400 Received: from mx1.riseup.net ([198.252.153.129]:55048 "EHLO mx1.riseup.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231322AbhJ1Wec (ORCPT ); Thu, 28 Oct 2021 18:34:32 -0400 Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.riseup.net", Issuer "R3" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 4HgKrj1ZWYzDrCk; Thu, 28 Oct 2021 15:25:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1635459941; bh=OX8mv7lrHWqRsF4lPKOR3ZoVpI/a6ZJqTO+IckJeZIU=; h=From:To:Cc:Subject:Date:From; b=JDtJK/6ETT1QisNvsJAuAhSu/8Hcty/jEx/eX1A47PdxUfuZnK4MuCae6O+XIlqvZ reOEsQZuEyzJ5qpnePjWIzBfrDgsqPKaw2K5XoRRr03xC3UN/P2SfC3gLkjXTfbwyf G3u/f7eb5RW7QfOvAEy0WW7p9dBfHVDACBnOi0F8= X-Riseup-User-ID: 0547AF66CF2CAD13BBDD0B7881883D4BA43C2393E3AF23156733269F90C2FC29 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4HgKrd1W9lz5vvd; Thu, 28 Oct 2021 15:25:36 -0700 (PDT) From: Isabella Basso To: geert@linux-m68k.org Cc: ferreiraenzoa@gmail.com, augusto.duraes33@gmail.com, brendanhiggins@google.com, dlatypov@google.com, davidgow@google.com, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, ~lkcamp/patches@lists.sr.ht, rodrigosiqueiramelo@gmail.com, akpm@linux-foundation.org, skhan@linuxfoundation.org, Isabella Basso Subject: [PATCH v3 0/5] test_hash.c: refactor into KUnit Date: Thu, 28 Oct 2021 19:25:28 -0300 Message-Id: <20211028222533.432641-1-isabbasso@riseup.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We refactored the lib/test_hash.c file into KUnit as part of the student group LKCAMP [1] introductory hackathon for kernel development. This test was pointed to our group by Daniel Latypov [2], so its full conversion into a pure KUnit test was our goal in this patch series, but we ran into many problems relating to it not being split as unit tests, which complicated matters a bit, as the reasoning behind the original tests is quite cryptic for those unfamiliar with hash implementations. Some interesting developments we'd like to highlight are: - In patch 1/5 we noticed that there was an unused define directive that could be removed. - In patch 4/5 we noticed how stringhash and hash tests are all under the lib/test_hash.c file, which might cause some confusion, and we also broke those kernel config entries up. Overall KUnit developments have been made in the other patches in this series: In patches 2/5, 3/5 and 5/5 we refactored the lib/test_hash.c file so as to make it more compatible with the KUnit style, whilst preserving the original idea of the maintainer who designed it (i.e. George Spelvin), which might be undesirable for unit tests, but we assume it is enough for a first patch. This is our first patch series so we hope our contributions are interesting and also hope to get some useful criticism from the community. :) Changes since v2: - Added comments on struct elements. - Removed unecessary __init bits from KUnit test functions. - Change KUnit's "EXPECT_FALSE"s for "EXPECT_EQ"s. Changes since v1: - Fixed compilation on parisc and m68k. - Fixed whitespace mistakes. - Renamed a few functions. - Refactored globals into struct for test function params, thus removing a patch. - Reworded some commit messages. [1] - https://lkcamp.dev/ [2] - https://lore.kernel.org/linux-kselftest/CAGS_qxojszgM19u=3HLwFgKX5bm5KhywvsSunuBAt5RtR+GyxQ@mail.gmail.com/ Isabella Basso (5): hash.h: remove unused define directive test_hash.c: split test_int_hash into arch-specific functions test_hash.c: split test_hash_init lib/Kconfig.debug: properly split hash test kernel entries test_hash.c: refactor into kunit include/linux/hash.h | 5 +- lib/Kconfig.debug | 28 +++- lib/Makefile | 3 +- lib/test_hash.c | 259 +++++++++++++++++-------------------- tools/include/linux/hash.h | 5 +- 5 files changed, 147 insertions(+), 153 deletions(-) -- 2.33.1