mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Tamir Duberstein <tamird@gmail.com>
Cc: David Gow <davidgow@google.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	Luis Felipe Hernandez <luis.hernandez093@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Yu-Chun Lin <eleanor15x@gmail.com>
Subject: Re: [PATCH v3 0/2] lib/prime_numbers: convert self-test to KUnit
Date: Sat, 8 Feb 2025 16:25:42 -0800	[thread overview]
Message-ID: <20250208162542.fba2bdb0051eeab5344d3f82@linux-foundation.org> (raw)
In-Reply-To: <20250208-prime_numbers-kunit-convert-v3-0-8ffd5816d8dc@gmail.com>

On Sat, 08 Feb 2025 17:52:28 -0500 Tamir Duberstein <tamird@gmail.com> wrote:

> This is a clear example of a unit test.
> 
> I tested this using:
> 
> $ tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 math-prime_numbers
> 
> On success:
> ; [08:51:41] ============== math-prime_numbers (1 subtest) ==============
> ; [08:51:41] [PASSED] prime_numbers_test
> ; [08:51:41] =============== [PASSED] math-prime_numbers ================
> ; [08:51:41] ============================================================
> ; [08:51:41] Testing complete. Ran 1 tests: passed: 1
> 
> On failure:
> ; [08:50:19] ============== math-prime_numbers (1 subtest) ==============
> ; [08:50:19]     # prime_numbers_test: ASSERTION FAILED at lib/math/tests/prime_numbers_kunit.c:28
> ; [08:50:19]     Expected slow == fast, but
> ; [08:50:19]         slow == 0 (0x0)
> ; [08:50:19]         fast == 1 (0x1)
> ; [08:50:19] is-prime(2)
> ; [08:50:19] [FAILED] prime_numbers_test
> ; [08:50:19] # module: prime_numbers_kunit
> ; [08:50:19] # math-prime_numbers: primes.{last=61, .sz=64, .primes[]=...x28208a20a08a28ac} = 2-3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61
> ; [08:50:19] =============== [FAILED] math-prime_numbers ================
> ; [08:50:19] ============================================================
> ; [08:50:19] Testing complete. Ran 1 tests: failed: 1
> 

I resolved this against "lib/math: add Kunit test suite for gcd()"
(https://lkml.kernel.org/r/20250203075400.3431330-1-eleanor15x@gmail.com)
in the obvious fashion then added this fixup:

From: Andrew Morton <akpm@linux-foundation.org>
Subject: lib-math-hook-up-tests-makefile-fix
Date: Sat Feb  8 03:33:59 PM PST 2025

don't link gcd_kunit.o twice

Cc: David Gow <davidgow@google.com>
Cc: Tamir Duberstein <tamird@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 lib/math/Makefile |    1 -
 1 file changed, 1 deletion(-)

--- a/lib/math/Makefile~lib-math-hook-up-tests-makefile-fix
+++ a/lib/math/Makefile
@@ -8,5 +8,4 @@ obj-$(CONFIG_RATIONAL)		+= rational.o
 obj-$(CONFIG_TEST_DIV64)	+= test_div64.o
 obj-$(CONFIG_TEST_MULDIV64)	+= test_mul_u64_u64_div_u64.o
 obj-$(CONFIG_RATIONAL_KUNIT_TEST) += rational-test.o
-obj-$(CONFIG_GCD_KUNIT_TEST) += tests/gcd_kunit.o
 obj-y += tests/
_

and the x86_64 allmodconfig build failed thusly:

lib/math/tests/prime_numbers_kunit.c: In function 'prime_numbers_test':
lib/math/tests/prime_numbers_kunit.c:25:35: error: implicit declaration of function 'slow_is_prime_number'; did you mean 'is_prime_number'? [-Werror=implicit-function-declaration]
   25 |                 const bool slow = slow_is_prime_number(x);
      |                                   ^~~~~~~~~~~~~~~~~~~~
      |                                   is_prime_number


So, please redo against mm.git's mm-everything branch or its
mm-nonmm-unstable branch and retest carefully.


  parent reply	other threads:[~2025-02-09  0:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-08 22:52 Tamir Duberstein
2025-02-08 22:52 ` [PATCH v3 1/2] lib/math: Hook up tests/Makefile Tamir Duberstein
2025-02-08 22:52 ` [PATCH v3 2/2] lib/prime_numbers: convert self-test to KUnit Tamir Duberstein
2025-02-09  0:25 ` Andrew Morton [this message]
2025-02-09  0:40   ` [PATCH v3 0/2] " Tamir Duberstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250208162542.fba2bdb0051eeab5344d3f82@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davidgow@google.com \
    --cc=eleanor15x@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=luis.hernandez093@gmail.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tamird@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®