tree:
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git
kunit-fixes
head: c1610aae495bae98319445d322a875556bbe3cba
commit: c9d80ffc5a0a30955de0b8c5c46a05906d417800 [21/24] kunit: add unit test for
filtering suites by names
config: openrisc-randconfig-r011-20210622 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O
~/bin/make.cross
chmod +x ~/bin/make.cross
#
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git...
git remote add kselftest
https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git
git fetch --no-tags kselftest kunit-fixes
git checkout c9d80ffc5a0a30955de0b8c5c46a05906d417800
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
lib/kunit/executor.c:26:1: error: expected identifier or '(' before '+'
token
26 | +kunit_filter_subsuite(struct kunit_suite * const * const subsuite,
| ^
lib/kunit/executor.c: In function 'kunit_filter_suites':
lib/kunit/executor.c:77:23: error: implicit declaration of function
'kunit_filter_subsuite'; did you mean 'kunit_filter_suites'?
[-Werror=implicit-function-declaration]
77 | filtered_subsuite = kunit_filter_subsuite(suite_set->start[i],
filter_glob);
| ^~~~~~~~~~~~~~~~~~~~~
| kunit_filter_suites
> lib/kunit/executor.c:77:21: warning: assignment to 'struct
kunit_suite * const*' from 'int' makes pointer from integer without a cast
[-Wint-conversion]
77 | filtered_subsuite =
kunit_filter_subsuite(suite_set->start[i], filter_glob);
| ^
cc1: some warnings being treated as errors
vim +77 lib/kunit/executor.c
24
25 static struct kunit_suite * const *
26 +kunit_filter_subsuite(struct kunit_suite * const * const
subsuite,
27 const char *filter_glob)
28 {
29 int i, n = 0;
30 struct kunit_suite **filtered;
31
32 n = 0;
33 for (i = 0; subsuite[i] != NULL; ++i) {
34 if (glob_match(filter_glob, subsuite[i]->name))
35 ++n;
36 }
37
38 if (n == 0)
39 return NULL;
40
41 filtered = kmalloc_array(n + 1, sizeof(*filtered), GFP_KERNEL);
42 if (!filtered)
43 return NULL;
44
45 n = 0;
46 for (i = 0; subsuite[i] != NULL; ++i) {
47 if (glob_match(filter_glob, subsuite[i]->name))
48 filtered[n++] = subsuite[i];
49 }
50 filtered[n] = NULL;
51
52 return filtered;
53 }
54
55 struct suite_set {
56 struct kunit_suite * const * const *start;
57 struct kunit_suite * const * const *end;
58 };
59
60 static struct suite_set kunit_filter_suites(const struct suite_set *suite_set,
61 const char *filter_glob)
62 {
63 int i;
64 struct kunit_suite * const **copy, * const *filtered_subsuite;
65 struct suite_set filtered;
66
67 const size_t max = suite_set->end - suite_set->start;
68
69 copy = kmalloc_array(max, sizeof(*filtered.start), GFP_KERNEL);
70 filtered.start = copy;
71 if (!copy) { /* won't be able to run anything, return an empty set */
72 filtered.end = copy;
73 return filtered;
74 }
75
76 for (i = 0; i < max; ++i) {
77 filtered_subsuite =
kunit_filter_subsuite(suite_set->start[i], filter_glob);
78 if
(filtered_subsuite)
79 *copy++ = filtered_subsuite;
80 }
81 filtered.end = copy;
82 return filtered;
83 }
84
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org