summaryrefslogtreecommitdiff
path: root/storage/perfschema/unittest/pfs-t.cc
diff options
context:
space:
mode:
authorVicențiu Ciorbaru <vicentiu@mariadb.org>2017-05-16 14:07:50 +0300
committerVicențiu Ciorbaru <vicentiu@mariadb.org>2017-05-16 14:07:50 +0300
commitf1861297f0764196e07f7aff888026dbf00b3107 (patch)
treefacb9cb31613439efa00cdfc7d26c0a2b9ff565e /storage/perfschema/unittest/pfs-t.cc
parenta3cf69e2e5ba8e3954b24bf3f8bcf8705c102f64 (diff)
parent24ff1793114fa9f15d493c26d879000307e6f00d (diff)
downloadmariadb-git-f1861297f0764196e07f7aff888026dbf00b3107.tar.gz
Merge branch 'merge-perfschema-5.6' into 10.0
Diffstat (limited to 'storage/perfschema/unittest/pfs-t.cc')
-rw-r--r--storage/perfschema/unittest/pfs-t.cc46
1 files changed, 35 insertions, 11 deletions
diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc
index f76b1aa2e75..7883e8070fe 100644
--- a/storage/perfschema/unittest/pfs-t.cc
+++ b/storage/perfschema/unittest/pfs-t.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,6 +27,8 @@
#include "stub_print_error.h"
#include "stub_pfs_defaults.h"
+void unload_performance_schema();
+
/* test helpers, to simulate the setup */
void setup_thread(PSI_thread *t, bool enabled)
@@ -126,7 +128,7 @@ void test_bootstrap()
psi_2= boot->get_interface(PSI_VERSION_2);
ok(psi_2 == NULL, "version 2");
- shutdown_performance_schema();
+ unload_performance_schema();
}
/*
@@ -183,6 +185,28 @@ PSI * load_perfschema()
return (PSI*) psi;
}
+void unload_performance_schema()
+{
+ cleanup_table_share();
+ cleanup_instruments();
+ cleanup_sync_class();
+ cleanup_thread_class();
+ cleanup_table_share();
+ cleanup_file_class();
+ cleanup_stage_class();
+ cleanup_statement_class();
+ cleanup_socket_class();
+ cleanup_events_waits_history_long();
+ cleanup_events_stages_history_long();
+ cleanup_events_statements_history_long();
+ cleanup_table_share_hash();
+ cleanup_file_hash();
+ cleanup_digest();
+ PFS_atomic::cleanup();
+
+ shutdown_performance_schema();
+}
+
void test_bad_registration()
{
PSI *psi;
@@ -581,8 +605,7 @@ void test_bad_registration()
psi->register_socket("X", bad_socket_3, 1);
ok(dummy_socket_key == 2, "assigned key");
-
- shutdown_performance_schema();
+ unload_performance_schema();
}
void test_init_disabled()
@@ -1016,7 +1039,7 @@ void test_init_disabled()
socket_A1= psi->init_socket(99, NULL, NULL, 0);
ok(socket_A1 == NULL, "broken socket key not instrumented");
- shutdown_performance_schema();
+ unload_performance_schema();
}
void test_locker_disabled()
@@ -1322,8 +1345,9 @@ void test_locker_disabled()
ok(socket_A1 != NULL, "instrumented");
/* Socket thread owner has not been set */
socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
- ok(socket_locker == NULL, "no locker (no thread owner)");
-
+ ok(socket_locker != NULL, "locker (owner not used)");
+ psi->end_socket_wait(socket_locker, 10);
+
/* Pretend the running thread is not instrumented */
/* ---------------------------------------------- */
@@ -1351,7 +1375,7 @@ void test_locker_disabled()
socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
ok(socket_locker == NULL, "no locker");
- shutdown_performance_schema();
+ unload_performance_schema();
}
void test_file_instrumentation_leak()
@@ -1438,7 +1462,7 @@ void test_file_instrumentation_leak()
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE);
ok(file_locker == NULL, "no locker, no leak");
- shutdown_performance_schema();
+ unload_performance_schema();
}
void test_enabled()
@@ -1474,7 +1498,7 @@ void test_enabled()
{ & cond_key_B, "C-B", 0}
};
- shutdown_performance_schema();
+ unload_performance_schema();
#endif
}
@@ -1644,5 +1668,5 @@ int main(int argc, char **argv)
MY_INIT(argv[0]);
do_all_tests();
my_end(0);
- return exit_status();
+ return (exit_status());
}