Add the prof_sys_thread_name feature in the prof_recent unit test.
This tests the combination of the prof_recent and thread_name features. Verified that it catches the issue being fixed in this PR. Also explicitly set thread name in test/unit/prof_recent. This fixes the name testing when no default thread name is set (e.g. FreeBSD).
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
/* As specified in the shell script */
|
||||
#define OPT_ALLOC_MAX 3
|
||||
|
||||
const char *test_thread_name = "test_thread";
|
||||
|
||||
/* Invariant before and after every test (when config_prof is on) */
|
||||
static void
|
||||
confirm_prof_setup() {
|
||||
@@ -439,16 +441,11 @@ confirm_record(const char *template, const confirm_record_t *records,
|
||||
}
|
||||
ASSERT_CHAR(',');
|
||||
|
||||
if (opt_prof_sys_thread_name) {
|
||||
if (thd_has_setname() && opt_prof_sys_thread_name) {
|
||||
ASSERT_FORMATTED_STR("\"%s_thread_name\"",
|
||||
*type);
|
||||
ASSERT_CHAR(':');
|
||||
ASSERT_CHAR('"');
|
||||
while (*start != '"') {
|
||||
++start;
|
||||
}
|
||||
ASSERT_CHAR('"');
|
||||
ASSERT_CHAR(',');
|
||||
ASSERT_FORMATTED_STR(":\"%s\",",
|
||||
test_thread_name);
|
||||
}
|
||||
|
||||
ASSERT_FORMATTED_STR("\"%s_time\"", *type);
|
||||
@@ -495,6 +492,7 @@ confirm_record(const char *template, const confirm_record_t *records,
|
||||
TEST_BEGIN(test_prof_recent_alloc_dump) {
|
||||
test_skip_if(!config_prof);
|
||||
|
||||
thd_setname(test_thread_name);
|
||||
confirm_prof_setup();
|
||||
|
||||
ssize_t future;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "x${enable_prof}" = "x1" ] ; then
|
||||
export MALLOC_CONF="prof:true,prof_active:true,lg_prof_sample:0,prof_recent_alloc_max:3"
|
||||
export MALLOC_CONF="prof:true,prof_active:true,lg_prof_sample:0,prof_recent_alloc_max:3,prof_sys_thread_name:true"
|
||||
fi
|
||||
|
Reference in New Issue
Block a user