* + test_hashc-split-test_hash_init.patch added to -mm tree
@ 2021-12-08 23:26 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2021-12-08 23:26 UTC (permalink / raw)
To: augusto.duraes33, brendanhiggins, davidgow, dlatypov,
ferreiraenzoa, geert, isabbasso, lkp, mchehab, mm-commits,
rodrigosiqueiramelo, skhan
The patch titled
Subject: test_hash.c: split test_hash_init
has been added to the -mm tree. Its filename is
test_hashc-split-test_hash_init.patch
This patch should soon appear at
https://ozlabs.org/~akpm/mmots/broken-out/test_hashc-split-test_hash_init.patch
and later at
https://ozlabs.org/~akpm/mmotm/broken-out/test_hashc-split-test_hash_init.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Isabella Basso <isabbasso@riseup.net>
Subject: test_hash.c: split test_hash_init
Split up test_hash_init so that it calls each test more explicitly insofar
it is possible without rewriting the entire file. This aims at improving
readability.
Split tests performed on string_or as they don't interfere with those
performed in hash_or. Also separate pr_info calls about skipped tests as
they're not part of the tests themselves, but only warn about (un)defined
arch-specific hash functions.
Link: https://lkml.kernel.org/r/20211208183711.390454-4-isabbasso@riseup.net
Reviewed-by: David Gow <davidgow@google.com>
Tested-by: David Gow <davidgow@google.com>
Signed-off-by: Isabella Basso <isabbasso@riseup.net>
Cc: Augusto Durães Camargo <augusto.duraes33@gmail.com>
Cc: Brendan Higgins <brendanhiggins@google.com>
Cc: Daniel Latypov <dlatypov@google.com>
Cc: Enzo Ferreira <ferreiraenzoa@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: kernel test robot <lkp@intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
lib/test_hash.c | 66 +++++++++++++++++++++++++++++++++++++---------
1 file changed, 54 insertions(+), 12 deletions(-)
--- a/lib/test_hash.c~test_hashc-split-test_hash_init
+++ a/lib/test_hash.c
@@ -158,11 +158,39 @@ test_int_hash(unsigned long long h64, u3
#define SIZE 256 /* Run time is cubic in SIZE */
-static int __init
-test_hash_init(void)
+static int __init test_string_or(void)
{
char buf[SIZE+1];
- u32 string_or = 0, hash_or[2][33] = { { 0, } };
+ u32 string_or = 0;
+ int i, j;
+
+ fill_buf(buf, SIZE, 1);
+
+ /* Test every possible non-empty substring in the buffer. */
+ for (j = SIZE; j > 0; --j) {
+ buf[j] = '\0';
+
+ for (i = 0; i <= j; i++) {
+ u32 h0 = full_name_hash(buf+i, buf+i, j-i);
+
+ string_or |= h0;
+ } /* i */
+ } /* j */
+
+ /* The OR of all the hash values should cover all the bits */
+ if (~string_or) {
+ pr_err("OR of all string hash results = %#x != %#x",
+ string_or, -1u);
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int __init test_hash_or(void)
+{
+ char buf[SIZE+1];
+ u32 hash_or[2][33] = { { 0, } };
unsigned tests = 0;
unsigned long long h64 = 0;
int i, j;
@@ -192,7 +220,6 @@ test_hash_init(void)
return -EINVAL;
}
- string_or |= h0;
h64 = h64 << 32 | h0; /* For use with hash_64 */
if (!test_int_hash(h64, hash_or))
return -EINVAL;
@@ -200,12 +227,6 @@ test_hash_init(void)
} /* i */
} /* j */
- /* The OR of all the hash values should cover all the bits */
- if (~string_or) {
- pr_err("OR of all string hash results = %#x != %#x",
- string_or, -1u);
- return -EINVAL;
- }
if (~hash_or[0][0]) {
pr_err("OR of all __hash_32 results = %#x != %#x",
hash_or[0][0], -1u);
@@ -237,6 +258,13 @@ test_hash_init(void)
}
}
+ pr_notice("%u tests passed.", tests);
+
+ return 0;
+}
+
+static void __init notice_skipped_tests(void)
+{
/* Issue notices about skipped tests. */
#ifdef HAVE_ARCH__HASH_32
#if HAVE_ARCH__HASH_32 != 1
@@ -252,10 +280,24 @@ test_hash_init(void)
#else
pr_info("hash_64() has no arch implementation to test.");
#endif
+}
- pr_notice("%u tests passed.", tests);
+static int __init
+test_hash_init(void)
+{
+ int ret;
- return 0;
+ ret = test_string_or();
+ if (ret < 0)
+ return ret;
+
+ ret = test_hash_or();
+ if (ret < 0)
+ return ret;
+
+ notice_skipped_tests();
+
+ return ret;
}
static void __exit test_hash_exit(void)
_
Patches currently in -mm which might be from isabbasso@riseup.net are
hashh-remove-unused-define-directive.patch
test_hashc-split-test_int_hash-into-arch-specific-functions.patch
test_hashc-split-test_hash_init.patch
lib-kconfigdebug-properly-split-hash-test-kernel-entries.patch
test_hashc-refactor-into-kunit.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-08 23:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-08 23:26 + test_hashc-split-test_hash_init.patch added to -mm tree akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).