-
Notifications
You must be signed in to change notification settings - Fork 37
Duplicate parameterized test name error #15
Description
Hi,
I'm having some issues executing a simple test with ktf.
I'm cross-compiling ktf for arm64 architecture.
I'm using the latests revisions of KTF and googletest on a 4.14.115 Linux kernel.
After inserting KTF and my test module (insmod ktf.ko; insmod test.ko), i'm trying to list the registered test using the command ktfrun --gtest_list_tests.
ktfrun creates a coredump and gives me the following error:
[ FATAL ] /usr/include/gtest/internal/gtest-param-util.h:562:: Condition test_param_names.count(param_name) == 0 failed. Duplicate parameterized test name 't1', in Aborted (core dumped)
I wasn't able to understand what is going on.
My test source code is the default one created using the ktfnew script.
Activating the debug messages gives me the following messages:
- KTF userland
root@tap-00010E5F:~# ktfrun --gtest_list_tests
Thu Jul 11 13:17:10 2019 [281473665986688] parse_query: Kernel offers 1 test sets:
Thu Jul 11 13:17:10 2019 [281473665986688] find_add_set: find_add_set(simple)
Thu Jul 11 13:17:10 2019 [281473665986688] find_add_set: find_add_set(simple)
Thu Jul 11 13:17:10 2019 [281473665986688] find_add_set: find_add_set(simple)
Thu Jul 11 13:17:10 2019 [281473665986688] parse_query: Kernel offers 1 test sets:
Thu Jul 11 13:17:10 2019 [281473665986688] find_add_set: find_add_set(simple)
Thu Jul 11 13:17:10 2019 [281473665986688] find_add_set: find_add_set(simple)
Thu Jul 11 13:17:10 2019 [281473665986688] find_add_set: find_add_set(simple)
[ FATAL ] /usr/include/gtest/internal/gtest-param-util.h:562:: Condition test_param_names.count(param_name) == 0 failed. Duplicate parameterized test name 't1', in Aborted (core dumped)
- KTF kernel space
[26543.319181] ktf pid [1012] ktf_map_elem_get: Increasing refcount for simple to 3
[26543.319195] ktf pid [1012] ktf_map_elem_get: Increasing refcount for t1 to 3
[26543.319202] ktf pid [1012] ktf_map_elem_put: Decreasing refcount for t1 to 2
[26543.319222] ktf pid [1012] ktf_map_elem_put: Decreasing refcount for simple to 2
[26543.321428] ktf pid [1012] ktf_map_elem_get: Increasing refcount for simple to 3
[26543.321442] ktf pid [1012] ktf_map_elem_get: Increasing refcount for t1 to 3
[26543.321450] ktf pid [1012] ktf_map_elem_put: Decreasing refcount for t1 to 2
[26543.321455] ktf pid [1012] ktf_map_elem_put: Decreasing refcount for simple to 2
It seems that it acts like the same test was registered twice. But there is only one test in test source code. Here is the test source code as a reminder:
#include <linux/module.h>
#include "ktf.h"
MODULE_LICENSE("GPL");
KTF_INIT();
TEST(simple, t1)
{
EXPECT_TRUE(true);
}
static void add_tests(void)
{
ADD_TEST(t1);
}
static int __init tests_init(void)
{
add_tests();
return 0;
}
static void __exit tests_exit(void)
{
KTF_CLEANUP();
}
module_init(tests_init);
module_exit(tests_exit);
Have you already encountered this type of error ?
Thanks in advance for your help.
Pascal