Runs selected functions from the dynamic library.
- elf64 linux
- elf32 linux
C type linkage:
int funcName()
C++ linkage:
int funcName()
int funcName(char** msg, int* msgLen)
0 --- success
other --- failure
Function with signature int funcName(char * * msg, int * msgLen) can reply with a message using msg parameter, msgLen holds current size of the msg buffer.
test_runner list [pattern1] [pattern2] ... path to library
tool opens the library and shows functions that
* name of a functions (including namespace names) matches to optional patterns
* function signature is supported
* if no pattern set then signature is checked
output will be like
Found functions:
1 symbolName <- C type linkage
2 symbolName(char** , int* ) <- C++ linkage, depends on compiler
demangledName
pattern - perl style regexp expression (https://www.pcre.org/original/doc/html/pcrepattern.html)
test_runner run [patterns] path to the library
selects fucntions according the same criteria as list command and runs each functions
output
test_runner run 'regexp_filter' ./test/libtest_runner_test.so | jq .
{
"test": "_ZN32dynamic_library_test_runner_test13regexp_filter13testMatchDataEPPcPi",
"symbol": "dynamic_library_test_runner_test::regexp_filter::testMatchData(char**, int*)",
"pass": true,
"message": ""
}
{
"test": "_ZN32dynamic_library_test_runner_test13regexp_filter21testInitCorrectFilterEPPcPi",
"symbol": "dynamic_library_test_runner_test::regexp_filter::testInitCorrectFilter(char**, int*)",
"pass": true,
"message": ""
}
{
"test": "_ZN32dynamic_library_test_runner_test13regexp_filter19testInitEmptyFilterEPPcPi",
"symbol": "dynamic_library_test_runner_test::regexp_filter::testInitEmptyFilter(char**, int*)",
"pass": false,
"message": ""
}
- test -- test function name
- symbol -- demangled symbol name (for C type linkage symbol value is the same as test value)
- pass -- functions returns 0
- message -- message return by the fucntion
test_runner create_run_list [patterns] path_to_run_list path_to_library
works as list command but writes list of functions to the json file supplied by the path_to_run_list parameter
run_list format
{
"test_lib": "libtest_runner_test.so",
"test_list": [
{
"test": "_ZN32dynamic_library_test_runner_test13regexp_filter13testMatchDataEPPcPi",
"demangled_name": "dynamic_library_test_runner_test::regexp_filter::testMatchData(char**, int*)",
"skip": false
},
{
"test": "_ZN32dynamic_library_test_runner_test13regexp_filter21testInitCorrectFilterEPPcPi",
"demangled_name": "dynamic_library_test_runner_test::regexp_filter::testInitCorrectFilter(char**, int*)",
"skip": false
},
{
"test": "_ZN32dynamic_library_test_runner_test13regexp_filter19testInitEmptyFilterEPPcPi",
"demangled_name": "dynamic_library_test_runner_test::regexp_filter::testInitEmptyFilter(char**, int*)",
"skip": false
}
]
}
- test_lib -- library name
- test_list -- array of tests
- test -- function name stored in the library
- demangled_name -- human readable name
- skip -- test will be skipped
test_runner run_list path_to_run_list path_to_library
runs functions defined in run list, output same as for run command
Ubuntu
apt-get install libcjson-dev libpcre2-dev libiberty-dev