forked from luck/tmp_suning_uos_patched
test_bitmap: remove user bitmap tests
We can't run the tests for userspace bitmap parsing if set_fs() doesn't exist, and it is about to go away for x86, powerpc with other major architectures to follow. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
5e6e9852d6
commit
81b1e242b8
|
@ -354,50 +354,37 @@ static const struct test_bitmap_parselist parselist_tests[] __initconst = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init __test_bitmap_parselist(int is_user)
|
static void __init test_bitmap_parselist(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int err;
|
int err;
|
||||||
ktime_t time;
|
ktime_t time;
|
||||||
DECLARE_BITMAP(bmap, 2048);
|
DECLARE_BITMAP(bmap, 2048);
|
||||||
char *mode = is_user ? "_user" : "";
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(parselist_tests); i++) {
|
for (i = 0; i < ARRAY_SIZE(parselist_tests); i++) {
|
||||||
#define ptest parselist_tests[i]
|
#define ptest parselist_tests[i]
|
||||||
|
|
||||||
if (is_user) {
|
time = ktime_get();
|
||||||
mm_segment_t orig_fs = get_fs();
|
err = bitmap_parselist(ptest.in, bmap, ptest.nbits);
|
||||||
size_t len = strlen(ptest.in);
|
time = ktime_get() - time;
|
||||||
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
time = ktime_get();
|
|
||||||
err = bitmap_parselist_user((__force const char __user *)ptest.in, len,
|
|
||||||
bmap, ptest.nbits);
|
|
||||||
time = ktime_get() - time;
|
|
||||||
set_fs(orig_fs);
|
|
||||||
} else {
|
|
||||||
time = ktime_get();
|
|
||||||
err = bitmap_parselist(ptest.in, bmap, ptest.nbits);
|
|
||||||
time = ktime_get() - time;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err != ptest.errno) {
|
if (err != ptest.errno) {
|
||||||
pr_err("parselist%s: %d: input is %s, errno is %d, expected %d\n",
|
pr_err("parselist: %d: input is %s, errno is %d, expected %d\n",
|
||||||
mode, i, ptest.in, err, ptest.errno);
|
i, ptest.in, err, ptest.errno);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err && ptest.expected
|
if (!err && ptest.expected
|
||||||
&& !__bitmap_equal(bmap, ptest.expected, ptest.nbits)) {
|
&& !__bitmap_equal(bmap, ptest.expected, ptest.nbits)) {
|
||||||
pr_err("parselist%s: %d: input is %s, result is 0x%lx, expected 0x%lx\n",
|
pr_err("parselist: %d: input is %s, result is 0x%lx, expected 0x%lx\n",
|
||||||
mode, i, ptest.in, bmap[0],
|
i, ptest.in, bmap[0],
|
||||||
*ptest.expected);
|
*ptest.expected);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ptest.flags & PARSE_TIME)
|
if (ptest.flags & PARSE_TIME)
|
||||||
pr_err("parselist%s: %d: input is '%s' OK, Time: %llu\n",
|
pr_err("parselist: %d: input is '%s' OK, Time: %llu\n",
|
||||||
mode, i, ptest.in, time);
|
i, ptest.in, time);
|
||||||
|
|
||||||
#undef ptest
|
#undef ptest
|
||||||
}
|
}
|
||||||
|
@ -443,75 +430,41 @@ static const struct test_bitmap_parselist parse_tests[] __initconst = {
|
||||||
#undef step
|
#undef step
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init __test_bitmap_parse(int is_user)
|
static void __init test_bitmap_parse(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int err;
|
int err;
|
||||||
ktime_t time;
|
ktime_t time;
|
||||||
DECLARE_BITMAP(bmap, 2048);
|
DECLARE_BITMAP(bmap, 2048);
|
||||||
char *mode = is_user ? "_user" : "";
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(parse_tests); i++) {
|
for (i = 0; i < ARRAY_SIZE(parse_tests); i++) {
|
||||||
struct test_bitmap_parselist test = parse_tests[i];
|
struct test_bitmap_parselist test = parse_tests[i];
|
||||||
|
size_t len = test.flags & NO_LEN ? UINT_MAX : strlen(test.in);
|
||||||
|
|
||||||
if (is_user) {
|
time = ktime_get();
|
||||||
size_t len = strlen(test.in);
|
err = bitmap_parse(test.in, len, bmap, test.nbits);
|
||||||
mm_segment_t orig_fs = get_fs();
|
time = ktime_get() - time;
|
||||||
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
time = ktime_get();
|
|
||||||
err = bitmap_parse_user((__force const char __user *)test.in, len,
|
|
||||||
bmap, test.nbits);
|
|
||||||
time = ktime_get() - time;
|
|
||||||
set_fs(orig_fs);
|
|
||||||
} else {
|
|
||||||
size_t len = test.flags & NO_LEN ?
|
|
||||||
UINT_MAX : strlen(test.in);
|
|
||||||
time = ktime_get();
|
|
||||||
err = bitmap_parse(test.in, len, bmap, test.nbits);
|
|
||||||
time = ktime_get() - time;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (err != test.errno) {
|
if (err != test.errno) {
|
||||||
pr_err("parse%s: %d: input is %s, errno is %d, expected %d\n",
|
pr_err("parse: %d: input is %s, errno is %d, expected %d\n",
|
||||||
mode, i, test.in, err, test.errno);
|
i, test.in, err, test.errno);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!err && test.expected
|
if (!err && test.expected
|
||||||
&& !__bitmap_equal(bmap, test.expected, test.nbits)) {
|
&& !__bitmap_equal(bmap, test.expected, test.nbits)) {
|
||||||
pr_err("parse%s: %d: input is %s, result is 0x%lx, expected 0x%lx\n",
|
pr_err("parse: %d: input is %s, result is 0x%lx, expected 0x%lx\n",
|
||||||
mode, i, test.in, bmap[0],
|
i, test.in, bmap[0],
|
||||||
*test.expected);
|
*test.expected);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test.flags & PARSE_TIME)
|
if (test.flags & PARSE_TIME)
|
||||||
pr_err("parse%s: %d: input is '%s' OK, Time: %llu\n",
|
pr_err("parse: %d: input is '%s' OK, Time: %llu\n",
|
||||||
mode, i, test.in, time);
|
i, test.in, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __init test_bitmap_parselist(void)
|
|
||||||
{
|
|
||||||
__test_bitmap_parselist(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __init test_bitmap_parselist_user(void)
|
|
||||||
{
|
|
||||||
__test_bitmap_parselist(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __init test_bitmap_parse(void)
|
|
||||||
{
|
|
||||||
__test_bitmap_parse(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __init test_bitmap_parse_user(void)
|
|
||||||
{
|
|
||||||
__test_bitmap_parse(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define EXP1_IN_BITS (sizeof(exp1) * 8)
|
#define EXP1_IN_BITS (sizeof(exp1) * 8)
|
||||||
|
|
||||||
static void __init test_bitmap_arr32(void)
|
static void __init test_bitmap_arr32(void)
|
||||||
|
@ -675,9 +628,7 @@ static void __init selftest(void)
|
||||||
test_replace();
|
test_replace();
|
||||||
test_bitmap_arr32();
|
test_bitmap_arr32();
|
||||||
test_bitmap_parse();
|
test_bitmap_parse();
|
||||||
test_bitmap_parse_user();
|
|
||||||
test_bitmap_parselist();
|
test_bitmap_parselist();
|
||||||
test_bitmap_parselist_user();
|
|
||||||
test_mem_optimisations();
|
test_mem_optimisations();
|
||||||
test_for_each_set_clump8();
|
test_for_each_set_clump8();
|
||||||
test_bitmap_cut();
|
test_bitmap_cut();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user