8 static int test(
const char *path,
bool alloc_name,
bool alloc_ext,
9 bool kmod,
bool comp,
const char *
name,
const char *ext)
13 memset(&m, 0x0,
sizeof(m));
18 pr_debug(
"%s - alloc name %d, alloc ext %d, kmod %d, comp %d, name '%s', ext '%s'\n",
43 pr_debug(
"%s (cpumode: %d) - is_kernel_module: %s\n",
44 path, cpumode, expect ?
"true" :
"false");
48 #define T(path, an, ae, k, c, n, e) \ 49 TEST_ASSERT_VAL("failed", !test(path, an, ae, k, c, n, e)) 51 #define M(path, c, e) \ 52 TEST_ASSERT_VAL("failed", !test_is_kernel_module(path, c, e)) 57 T(
"/xxxx/xxxx/x-x.ko",
true ,
true ,
true,
false,
"[x_x]", NULL);
58 T(
"/xxxx/xxxx/x-x.ko",
false ,
true ,
true,
false, NULL , NULL);
59 T(
"/xxxx/xxxx/x-x.ko",
true ,
false ,
true,
false,
"[x_x]", NULL);
60 T(
"/xxxx/xxxx/x-x.ko",
false ,
false ,
true,
false, NULL , NULL);
61 M(
"/xxxx/xxxx/x-x.ko", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
true);
62 M(
"/xxxx/xxxx/x-x.ko", PERF_RECORD_MISC_KERNEL,
true);
63 M(
"/xxxx/xxxx/x-x.ko", PERF_RECORD_MISC_USER,
false);
65 #ifdef HAVE_ZLIB_SUPPORT 67 T(
"/xxxx/xxxx/x.ko.gz",
true ,
true ,
true,
true,
"[x]",
"gz");
68 T(
"/xxxx/xxxx/x.ko.gz",
false ,
true ,
true,
true, NULL ,
"gz");
69 T(
"/xxxx/xxxx/x.ko.gz",
true ,
false ,
true,
true,
"[x]", NULL);
70 T(
"/xxxx/xxxx/x.ko.gz",
false ,
false ,
true,
true, NULL , NULL);
71 M(
"/xxxx/xxxx/x.ko.gz", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
true);
72 M(
"/xxxx/xxxx/x.ko.gz", PERF_RECORD_MISC_KERNEL,
true);
73 M(
"/xxxx/xxxx/x.ko.gz", PERF_RECORD_MISC_USER,
false);
76 T(
"/xxxx/xxxx/x.gz",
true ,
true ,
false,
true,
"x.gz" ,
"gz");
77 T(
"/xxxx/xxxx/x.gz",
false ,
true ,
false,
true, NULL ,
"gz");
78 T(
"/xxxx/xxxx/x.gz",
true ,
false ,
false,
true,
"x.gz" , NULL);
79 T(
"/xxxx/xxxx/x.gz",
false ,
false ,
false,
true, NULL , NULL);
80 M(
"/xxxx/xxxx/x.gz", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
false);
81 M(
"/xxxx/xxxx/x.gz", PERF_RECORD_MISC_KERNEL,
false);
82 M(
"/xxxx/xxxx/x.gz", PERF_RECORD_MISC_USER,
false);
85 T(
"x.gz",
true ,
true ,
false,
true,
"x.gz",
"gz");
86 T(
"x.gz",
false ,
true ,
false,
true, NULL ,
"gz");
87 T(
"x.gz",
true ,
false ,
false,
true,
"x.gz", NULL);
88 T(
"x.gz",
false ,
false ,
false,
true, NULL , NULL);
89 M(
"x.gz", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
false);
90 M(
"x.gz", PERF_RECORD_MISC_KERNEL,
false);
91 M(
"x.gz", PERF_RECORD_MISC_USER,
false);
94 T(
"x.ko.gz",
true ,
true ,
true,
true,
"[x]",
"gz");
95 T(
"x.ko.gz",
false ,
true ,
true,
true, NULL ,
"gz");
96 T(
"x.ko.gz",
true ,
false ,
true,
true,
"[x]", NULL);
97 T(
"x.ko.gz",
false ,
false ,
true,
true, NULL , NULL);
98 M(
"x.ko.gz", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
true);
99 M(
"x.ko.gz", PERF_RECORD_MISC_KERNEL,
true);
100 M(
"x.ko.gz", PERF_RECORD_MISC_USER,
false);
104 T(
"[test_module]",
true ,
true ,
true,
false,
"[test_module]", NULL);
105 T(
"[test_module]",
false ,
true ,
true,
false, NULL , NULL);
106 T(
"[test_module]",
true ,
false ,
true,
false,
"[test_module]", NULL);
107 T(
"[test_module]",
false ,
false ,
true,
false, NULL , NULL);
108 M(
"[test_module]", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
true);
109 M(
"[test_module]", PERF_RECORD_MISC_KERNEL,
true);
110 M(
"[test_module]", PERF_RECORD_MISC_USER,
false);
113 T(
"[test.module]",
true ,
true ,
true,
false,
"[test.module]", NULL);
114 T(
"[test.module]",
false ,
true ,
true,
false, NULL , NULL);
115 T(
"[test.module]",
true ,
false ,
true,
false,
"[test.module]", NULL);
116 T(
"[test.module]",
false ,
false ,
true,
false, NULL , NULL);
117 M(
"[test.module]", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
true);
118 M(
"[test.module]", PERF_RECORD_MISC_KERNEL,
true);
119 M(
"[test.module]", PERF_RECORD_MISC_USER,
false);
122 T(
"[vdso]",
true ,
true ,
false,
false,
"[vdso]", NULL);
123 T(
"[vdso]",
false ,
true ,
false,
false, NULL , NULL);
124 T(
"[vdso]",
true ,
false ,
false,
false,
"[vdso]", NULL);
125 T(
"[vdso]",
false ,
false ,
false,
false, NULL , NULL);
126 M(
"[vdso]", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
false);
127 M(
"[vdso]", PERF_RECORD_MISC_KERNEL,
false);
128 M(
"[vdso]", PERF_RECORD_MISC_USER,
false);
130 T(
"[vdso32]",
true ,
true ,
false,
false,
"[vdso32]", NULL);
131 T(
"[vdso32]",
false ,
true ,
false,
false, NULL , NULL);
132 T(
"[vdso32]",
true ,
false ,
false,
false,
"[vdso32]", NULL);
133 T(
"[vdso32]",
false ,
false ,
false,
false, NULL , NULL);
134 M(
"[vdso32]", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
false);
135 M(
"[vdso32]", PERF_RECORD_MISC_KERNEL,
false);
136 M(
"[vdso32]", PERF_RECORD_MISC_USER,
false);
138 T(
"[vdsox32]",
true ,
true ,
false,
false,
"[vdsox32]", NULL);
139 T(
"[vdsox32]",
false ,
true ,
false,
false, NULL , NULL);
140 T(
"[vdsox32]",
true ,
false ,
false,
false,
"[vdsox32]", NULL);
141 T(
"[vdsox32]",
false ,
false ,
false,
false, NULL , NULL);
142 M(
"[vdsox32]", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
false);
143 M(
"[vdsox32]", PERF_RECORD_MISC_KERNEL,
false);
144 M(
"[vdsox32]", PERF_RECORD_MISC_USER,
false);
147 T(
"[vsyscall]",
true ,
true ,
false,
false,
"[vsyscall]", NULL);
148 T(
"[vsyscall]",
false ,
true ,
false,
false, NULL , NULL);
149 T(
"[vsyscall]",
true ,
false ,
false,
false,
"[vsyscall]", NULL);
150 T(
"[vsyscall]",
false ,
false ,
false,
false, NULL , NULL);
151 M(
"[vsyscall]", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
false);
152 M(
"[vsyscall]", PERF_RECORD_MISC_KERNEL,
false);
153 M(
"[vsyscall]", PERF_RECORD_MISC_USER,
false);
156 T(
"[kernel.kallsyms]",
true ,
true ,
false,
false,
"[kernel.kallsyms]", NULL);
157 T(
"[kernel.kallsyms]",
false ,
true ,
false,
false, NULL , NULL);
158 T(
"[kernel.kallsyms]",
true ,
false ,
false,
false,
"[kernel.kallsyms]", NULL);
159 T(
"[kernel.kallsyms]",
false ,
false ,
false,
false, NULL , NULL);
160 M(
"[kernel.kallsyms]", PERF_RECORD_MISC_CPUMODE_UNKNOWN,
false);
161 M(
"[kernel.kallsyms]", PERF_RECORD_MISC_KERNEL,
false);
162 M(
"[kernel.kallsyms]", PERF_RECORD_MISC_USER,
false);
#define TEST_ASSERT_VAL(text, cond)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
int __kmod_path__parse(struct kmod_path *m, const char *path, bool alloc_name, bool alloc_ext)
bool is_kernel_module(const char *pathname, int cpumode)
#define pr_debug(fmt,...)
static int test_is_kernel_module(const char *path, int cpumode, bool expect)
static int test(const char *path, bool alloc_name, bool alloc_ext, bool kmod, bool comp, const char *name, const char *ext)
#define T(path, an, ae, k, c, n, e)
int test__kmod_path__parse(struct test *t __maybe_unused, int subtest __maybe_unused)
static int comp(const void *a, const void *b)