From nobody Wed Nov 27 12:39:13 2024 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 935E220A5CD for ; Fri, 11 Oct 2024 07:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631863; cv=none; b=QmZKhYkreWsayg8j/3Lzo6zuMKfeeU7M2WB7/oKUk7DxjsL/6wp3455oYog66xr791s8Ey6ViGJ0Hl48ZEoqSZsdgoBdfeoAeYFMiLbVN9lkiBAF41e6qEhZV//HrPv8UMFgaHm2k0otvjrp5WGfV45ifyirBrgL+WWykREX0P8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728631863; c=relaxed/simple; bh=MLKVj5mIGtKe2lmA8uZuUkbaKPXRlkwhLj+qZGlP1IQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=IdghIAnUe+zZTE8VuOLqHY9V5aEjVTAplAVmu4TTkOdJwBwMFLRkFrODnQLCzRFDizNQzc4/KAFb7Qlay4wdQu2ak/MQMzdyVSJxE0MBBCc4QMNLkp82NLNsNAqp5v7YBb+Ji6UQRhK2r+ynvVFP3G4gC03Ow8H/MmM3URvSMk4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--davidgow.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hhO2J50V; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--davidgow.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hhO2J50V" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e28ef71f0d8so2730515276.0 for ; Fri, 11 Oct 2024 00:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728631860; x=1729236660; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=p2/wWiYYGPs+6qkE7fTq8up8gyUggtyfyady5a+MRp8=; b=hhO2J50VTlW8leXquLYKk+Xj4RfCyEwrnRMQyLSPCKVdDee6QcUxKhkixjjmb9nYJU xH8f3ihX/pBKsgp7cEGfA3LnltViHaMzwSTweJPi54oB6c1ygwPPEOi969euL2v0KfhV H8eq/6LShz9cCJn+CGROsEyBKqW5eYpB0iYObcpd2DNTXPsMkNhKXUWjdcb5Q9pso+83 p4YO34XVgLzI4FIA/dO8air7r7yqXObI8f2EHpZCjtUoyquJy02htW1bMYFAvN6t22w1 LCizaKtYgWQOgN5pmEmA32IGmykRqx22pyM0Kvml4Q8R0VA64INU1cCcpTgGTZ6ohLJJ UdGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728631860; x=1729236660; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=p2/wWiYYGPs+6qkE7fTq8up8gyUggtyfyady5a+MRp8=; b=BE9OEgIGJ2Zc+m3z6virtOMqJYahsVWaD8jSu9H+rH7E9P2ivBLnfrWk/v7V9uj0vG AzhpNHWTcgADiPwMLPFGwmBR10JrQQ9DLWvj+Ix4Ca0kHu+GWKK82gJFnsUWCWjndm3r x24o0F5MJdO4k25CfZPyv6VFGE3ytcIE9xmCGnmabnZBzduYCCIJ2b9KzGlPMpRt7ypk uTUA7V4xt/fJ0S16YFDIksGe1I9YEs+IiYyh0lviUbNqTEkwCwPMD8OjgmkJ1GBqeAe4 +9w1D+i/6as3AKcWqWO8AQbnWwBK1kgvfzFUgyk04xWeQWEh4wumpHpl2pOYt3ErhFll oJ1A== X-Forwarded-Encrypted: i=1; AJvYcCUcjyfiRUhZ1BfMNKjJ/i/ExLTJfbk5gcnDX/DCx8KbNI/swWz0A156/9FSqIMv6mDgQAP+1+JtAZKsoKA=@vger.kernel.org X-Gm-Message-State: AOJu0YzVKdQnMeQpdwmm6Zj+0CQ0JB2F3bU95w8zeAQYHAjwC0pQxxwc WQvK2BGVU4UPIrffn3VdpGj5UfLVuGBrNDt6ujAKdYSRKpzSvbbgPiLShDGWk+JTGeYrCaO6gSp nbAGTXwYgNA== X-Google-Smtp-Source: AGHT+IGg8zwYdpqTc4hwks/F2yxEDRYUPiypRoSyjyZWBgBdCoyywn0K+Zem/S5QXprlyw+K62or1As/8fQ1Rg== X-Received: from slicestar.c.googlers.com ([fda3:e722:ac3:cc00:b1:7045:ac11:6237]) (user=davidgow job=sendgmr) by 2002:a25:d084:0:b0:e25:cea9:b0e with SMTP id 3f1490d57ef6-e2919fe8406mr1099276.9.1728631860588; Fri, 11 Oct 2024 00:31:00 -0700 (PDT) Date: Fri, 11 Oct 2024 15:25:05 +0800 In-Reply-To: <20241011072509.3068328-2-davidgow@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241011072509.3068328-2-davidgow@google.com> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <20241011072509.3068328-3-davidgow@google.com> Subject: [PATCH 1/6] lib: math: Move kunit tests into tests/ subdir From: David Gow To: Andrew Morton , Shuah Khan , Brendan Higgins , Rae Moar , Kees Cook Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Stephen Rothwell , Luis Felipe Hernandez , quic_jjohnson@quicinc.com, macro@orcam.me.uk, tpiepho@gmail.com, ricardo@marliere.net, linux-kernel-mentees@lists.linuxfoundation.org, Nicolas Pitre , David Gow Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Luis Felipe Hernandez This patch is a follow-up task from a discussion stemming from point 3 in a recent patch introducing the int_pow kunit test [1] and documentation regarding kunit test style and nomenclature [2]. Colocate all kunit test suites in lib/math/tests/ and follow recommended naming convention for files _kunit.c and kconfig entries CONFIG__KUNIT_TEST. Link: https://lore.kernel.org/all/CABVgOS=3D-vh5TqHFCq_jo=3Dffq8v_nGgr6JsPn= OZag3e6+19ysxQ@mail.gmail.com/ [1] Link: https://docs.kernel.org/dev-tools/kunit/style.html [2] Signed-off-by: Luis Felipe Hernandez Acked-by: Nicolas Pitre [Rebased on top of mm-nonmm-unstable.] Signed-off-by: David Gow --- arch/m68k/configs/amiga_defconfig | 2 +- arch/m68k/configs/apollo_defconfig | 2 +- arch/m68k/configs/atari_defconfig | 2 +- arch/m68k/configs/bvme6000_defconfig | 2 +- arch/m68k/configs/hp300_defconfig | 2 +- arch/m68k/configs/mac_defconfig | 2 +- arch/m68k/configs/multi_defconfig | 2 +- arch/m68k/configs/mvme147_defconfig | 2 +- arch/m68k/configs/mvme16x_defconfig | 2 +- arch/m68k/configs/q40_defconfig | 2 +- arch/m68k/configs/sun3_defconfig | 2 +- arch/m68k/configs/sun3x_defconfig | 2 +- arch/powerpc/configs/ppc64_defconfig | 2 +- lib/Kconfig.debug | 6 +++--- lib/math/Makefile | 5 +---- lib/math/tests/Makefile | 5 ++++- lib/math/{test_div64.c =3D> tests/div64_kunit.c} | 0 .../mul_u64_u64_div_u64_kunit.c} | 2 +- lib/math/{rational-test.c =3D> tests/rational_kunit.c} | 0 19 files changed, 22 insertions(+), 22 deletions(-) rename lib/math/{test_div64.c =3D> tests/div64_kunit.c} (100%) rename lib/math/{test_mul_u64_u64_div_u64.c =3D> tests/mul_u64_u64_div_u64= _kunit.c} (98%) rename lib/math/{rational-test.c =3D> tests/rational_kunit.c} (100%) diff --git a/arch/m68k/configs/amiga_defconfig b/arch/m68k/configs/amiga_de= fconfig index d01dc47d52ea..7ba9311c084c 100644 --- a/arch/m68k/configs/amiga_defconfig +++ b/arch/m68k/configs/amiga_defconfig @@ -619,7 +619,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/apollo_defconfig b/arch/m68k/configs/apollo_= defconfig index 46808e581d7b..273fe4032b85 100644 --- a/arch/m68k/configs/apollo_defconfig +++ b/arch/m68k/configs/apollo_defconfig @@ -576,7 +576,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/atari_defconfig b/arch/m68k/configs/atari_de= fconfig index 4469a7839c9d..9976cda99fc1 100644 --- a/arch/m68k/configs/atari_defconfig +++ b/arch/m68k/configs/atari_defconfig @@ -596,7 +596,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/bvme6000_defconfig b/arch/m68k/configs/bvme6= 000_defconfig index c0719322c028..f59082c8fe06 100644 --- a/arch/m68k/configs/bvme6000_defconfig +++ b/arch/m68k/configs/bvme6000_defconfig @@ -568,7 +568,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/hp300_defconfig b/arch/m68k/configs/hp300_de= fconfig index 8d429e63f8f2..6db3556da9ac 100644 --- a/arch/m68k/configs/hp300_defconfig +++ b/arch/m68k/configs/hp300_defconfig @@ -578,7 +578,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/mac_defconfig b/arch/m68k/configs/mac_defcon= fig index bafd33da27c1..25c06b5c83ee 100644 --- a/arch/m68k/configs/mac_defconfig +++ b/arch/m68k/configs/mac_defconfig @@ -595,7 +595,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/multi_defconfig b/arch/m68k/configs/multi_de= fconfig index 6f5ca3f85ea1..35e57e0ee139 100644 --- a/arch/m68k/configs/multi_defconfig +++ b/arch/m68k/configs/multi_defconfig @@ -681,7 +681,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/mvme147_defconfig b/arch/m68k/configs/mvme14= 7_defconfig index d16b328c7136..d253b686119a 100644 --- a/arch/m68k/configs/mvme147_defconfig +++ b/arch/m68k/configs/mvme147_defconfig @@ -567,7 +567,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/mvme16x_defconfig b/arch/m68k/configs/mvme16= x_defconfig index 80f6c15a5ed5..62bc6ad63783 100644 --- a/arch/m68k/configs/mvme16x_defconfig +++ b/arch/m68k/configs/mvme16x_defconfig @@ -568,7 +568,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/q40_defconfig b/arch/m68k/configs/q40_defcon= fig index 0e81589f0ee2..caba39c61bac 100644 --- a/arch/m68k/configs/q40_defconfig +++ b/arch/m68k/configs/q40_defconfig @@ -585,7 +585,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/sun3_defconfig b/arch/m68k/configs/sun3_defc= onfig index 8cd785290339..a348f645ed55 100644 --- a/arch/m68k/configs/sun3_defconfig +++ b/arch/m68k/configs/sun3_defconfig @@ -565,7 +565,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/m68k/configs/sun3x_defconfig b/arch/m68k/configs/sun3x_de= fconfig index 78035369f60f..f8b3cfc3275b 100644 --- a/arch/m68k/configs/sun3x_defconfig +++ b/arch/m68k/configs/sun3x_defconfig @@ -566,7 +566,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_TEST_DHRY=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_REED_SOLOMON_TEST=3Dm CONFIG_ATOMIC64_SELFTEST=3Dm CONFIG_ASYNC_RAID6_TEST=3Dm diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/pp= c64_defconfig index a5e3e7f97f4d..f1f21765c0c1 100644 --- a/arch/powerpc/configs/ppc64_defconfig +++ b/arch/powerpc/configs/ppc64_defconfig @@ -435,7 +435,7 @@ CONFIG_KUNIT=3Dm CONFIG_KUNIT_ALL_TESTS=3Dm CONFIG_LKDTM=3Dm CONFIG_TEST_MIN_HEAP=3Dm -CONFIG_TEST_DIV64=3Dm +CONFIG_DIV64_KUNIT_TEST=3Dm CONFIG_BACKTRACE_SELF_TEST=3Dm CONFIG_TEST_REF_TRACKER=3Dm CONFIG_RBTREE_TEST=3Dm diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 856bc9f9c069..3ed6cf950f04 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2296,7 +2296,7 @@ config TEST_SORT =20 If unsure, say N. =20 -config TEST_DIV64 +config DIV64_KUNIT_TEST tristate "64bit/32bit division and modulo test" depends on DEBUG_KERNEL || m help @@ -2306,7 +2306,7 @@ config TEST_DIV64 =20 If unsure, say N. =20 -config TEST_MULDIV64 +config MULDIV64_KUNIT_TEST tristate "mul_u64_u64_div_u64() test" depends on DEBUG_KERNEL || m help @@ -2993,7 +2993,7 @@ config TEST_OBJPOOL =20 If unsure, say N. =20 -config INT_POW_TEST +config INT_POW_KUNIT_TEST tristate "Integer exponentiation (int_pow) test" if !KUNIT_ALL_TESTS depends on KUNIT default KUNIT_ALL_TESTS diff --git a/lib/math/Makefile b/lib/math/Makefile index 3ef11305f8d2..1c489501ff57 100644 --- a/lib/math/Makefile +++ b/lib/math/Makefile @@ -5,7 +5,4 @@ obj-$(CONFIG_CORDIC) +=3D cordic.o obj-$(CONFIG_PRIME_NUMBERS) +=3D prime_numbers.o obj-$(CONFIG_RATIONAL) +=3D rational.o =20 -obj-$(CONFIG_INT_POW_TEST) +=3D tests/int_pow_kunit.o -obj-$(CONFIG_TEST_DIV64) +=3D test_div64.o -obj-$(CONFIG_TEST_MULDIV64) +=3D test_mul_u64_u64_div_u64.o -obj-$(CONFIG_RATIONAL_KUNIT_TEST) +=3D rational-test.o +obj-y +=3D tests/ diff --git a/lib/math/tests/Makefile b/lib/math/tests/Makefile index 6a169123320a..f9a0a0e6b73a 100644 --- a/lib/math/tests/Makefile +++ b/lib/math/tests/Makefile @@ -1,3 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only =20 -obj-$(CONFIG_INT_POW_TEST) +=3D int_pow_kunit.o +obj-$(CONFIG_DIV64_KUNIT_TEST) +=3D div64_kunit.o +obj-$(CONFIG_INT_POW_KUNIT_TEST) +=3D int_pow_kunit.o +obj-$(CONFIG_MULDIV64_KUNIT_TEST) +=3D mul_u64_u64_div_u64_kunit.o +obj-$(CONFIG_RATIONAL_KUNIT_TEST) +=3D rational_kunit.o diff --git a/lib/math/test_div64.c b/lib/math/tests/div64_kunit.c similarity index 100% rename from lib/math/test_div64.c rename to lib/math/tests/div64_kunit.c diff --git a/lib/math/test_mul_u64_u64_div_u64.c b/lib/math/tests/mul_u64_u= 64_div_u64_kunit.c similarity index 98% rename from lib/math/test_mul_u64_u64_div_u64.c rename to lib/math/tests/mul_u64_u64_div_u64_kunit.c index 58d058de4e73..f61f571a0a2e 100644 --- a/lib/math/test_mul_u64_u64_div_u64.c +++ b/lib/math/tests/mul_u64_u64_div_u64_kunit.c @@ -49,7 +49,7 @@ static test_params test_values[] =3D { * * #!/bin/sh * sed -ne 's/^{ \+\(.*\), \+\(.*\), \+\(.*\), \+\(.*\) },$/\1 \2 \3 \4/p'= \ - * lib/math/test_mul_u64_u64_div_u64.c | + * lib/math/tests/mul_u64_u64_div_u64_kunit.c | * while read a b c r; do * expected=3D$( printf "obase=3D16; ibase=3D16; %X * %X / %X\n" $a $b $= c | bc ) * given=3D$( printf "%X\n" $r ) diff --git a/lib/math/rational-test.c b/lib/math/tests/rational_kunit.c similarity index 100% rename from lib/math/rational-test.c rename to lib/math/tests/rational_kunit.c --=20 2.47.0.rc1.288.g06298d1525-goog