summaryrefslogtreecommitdiff
path: root/storage/perfschema
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@oracle.com>2010-03-04 18:10:27 -0700
committerMarc Alff <marc.alff@oracle.com>2010-03-04 18:10:27 -0700
commit18884b02c08be7cf45fda7a686943c5a85dedf6f (patch)
tree10d3b927cf12dac360bf1dd339e0d58fc77a79d0 /storage/perfschema
parent366a68bb460fea577719335efcfac8e14f13a077 (diff)
downloadmariadb-git-18884b02c08be7cf45fda7a686943c5a85dedf6f.tar.gz
Bug#51741 Unit test pfs-t failing in mysql-next-mr-bugfixing
The root cause of the failure is that when Bug#51447 performance schema evil twin files was fixed, instrumented file names got normalized. The pfs-t unit test depends on this file normalization, but it was not updated. This fix aligns pfs-t.cc lookup_file_by_name() with the logic in pfs_instr.cc find_or_create_file().
Diffstat (limited to 'storage/perfschema')
-rw-r--r--storage/perfschema/unittest/pfs-t.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc
index fcbaf4aeb8f..2b64aec3416 100644
--- a/storage/perfschema/unittest/pfs-t.cc
+++ b/storage/perfschema/unittest/pfs-t.cc
@@ -37,14 +37,25 @@ PFS_file* lookup_file_by_name(const char* name)
uint i;
PFS_file *pfs;
uint len= strlen(name);
+ size_t dirlen;
+ const char *filename;
+ uint filename_length;;
for (i= 0; i < file_max; i++)
{
pfs= & file_array[i];
if (pfs->m_lock.is_populated())
{
- if ((len == pfs->m_filename_length) &&
- (strncmp(name, pfs->m_filename, pfs->m_filename_length) == 0))
+ /*
+ When a file "foo" is instrumented, the name is normalized
+ to "/path/to/current/directory/foo", so we remove the
+ directory name here to find it back.
+ */
+ dirlen= dirname_length(pfs->m_filename);
+ filename= pfs->m_filename + dirlen;
+ filename_length= pfs->m_filename_length - dirlen;
+ if ((len == filename_length) &&
+ (strncmp(name, filename, filename_length) == 0))
return pfs;
}
}