MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pfs_instr_class-t.cc
1 /* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
2 
3  This program is free software; you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation; version 2 of the License.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  GNU General Public License for more details.
11 
12  You should have received a copy of the GNU General Public License
13  along with this program; if not, write to the Free Software Foundation,
14  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
15 
16 #include <my_global.h>
17 #include <my_pthread.h>
18 #include <string.h> // strncpy
19 #include <pfs_instr_class.h>
20 #include <pfs_instr.h>
21 #include <pfs_global.h>
22 #include <tap.h>
23 
24 #include "stub_server_misc.h"
25 
26 void test_no_registration()
27 {
28  int rc;
29  PFS_sync_key key;
30  PFS_thread_key thread_key;
31  PFS_file_key file_key;
32  PFS_socket_key socket_key;
33  PFS_mutex_class *mutex;
34  PFS_rwlock_class *rwlock;
35  PFS_cond_class *cond;
36  PFS_thread_class *thread;
38  PFS_socket_class *socket;
39  /* PFS_table_share *table; */
40 
41  rc= init_sync_class(0, 0, 0);
42  ok(rc == 0, "zero init (sync)");
43  rc= init_thread_class(0);
44  ok(rc == 0, "zero init (thread)");
45  rc= init_file_class(0);
46  ok(rc == 0, "zero init (file)");
47  rc= init_socket_class(0);
48  ok(rc == 0, "zero init (socket)");
49  rc= init_table_share(0);
50  ok(rc == 0, "zero init (table)");
51 
52  key= register_mutex_class("FOO", 3, 0);
53  ok(key == 0, "no mutex registered");
54  key= register_mutex_class("BAR", 3, 0);
55  ok(key == 0, "no mutex registered");
56  key= register_mutex_class("FOO", 3, 0);
57  ok(key == 0, "no mutex registered");
58 
59  key= register_rwlock_class("FOO", 3, 0);
60  ok(key == 0, "no rwlock registered");
61  key= register_rwlock_class("BAR", 3, 0);
62  ok(key == 0, "no rwlock registered");
63  key= register_rwlock_class("FOO", 3, 0);
64  ok(key == 0, "no rwlock registered");
65 
66  key= register_cond_class("FOO", 3, 0);
67  ok(key == 0, "no cond registered");
68  key= register_cond_class("BAR", 3, 0);
69  ok(key == 0, "no cond registered");
70  key= register_cond_class("FOO", 3, 0);
71  ok(key == 0, "no cond registered");
72 
73  thread_key= register_thread_class("FOO", 3, 0);
74  ok(thread_key == 0, "no thread registered");
75  thread_key= register_thread_class("BAR", 3, 0);
76  ok(thread_key == 0, "no thread registered");
77  thread_key= register_thread_class("FOO", 3, 0);
78  ok(thread_key == 0, "no thread registered");
79 
80  file_key= register_file_class("FOO", 3, 0);
81  ok(file_key == 0, "no file registered");
82  file_key= register_file_class("BAR", 3, 0);
83  ok(file_key == 0, "no file registered");
84  file_key= register_file_class("FOO", 3, 0);
85  ok(file_key == 0, "no file registered");
86 
87  socket_key= register_socket_class("FOO", 3, 0);
88  ok(socket_key == 0, "no socket registered");
89  socket_key= register_socket_class("BAR", 3, 0);
90  ok(socket_key == 0, "no socket registered");
91  socket_key= register_socket_class("FOO", 3, 0);
92  ok(socket_key == 0, "no socket registered");
93 
94 #ifdef LATER
95  PFS_thread fake_thread;
96  fake_thread.m_table_share_hash_pins= NULL;
97 
98  table= find_or_create_table_share(& fake_thread, false, "foo_db", 6, "foo_table", 9);
99  ok(table == NULL, "not created");
100  table= find_or_create_table_share(& fake_thread, false, "bar_db", 6, "bar_table", 9);
101  ok(table == NULL, "not created");
102  table= find_or_create_table_share(& fake_thread, false, "foo_db", 6, "foo_table", 9);
103  ok(table == NULL, "not created");
104 #endif
105 
106  mutex= find_mutex_class(0);
107  ok(mutex == NULL, "no mutex key 0");
108  mutex= find_mutex_class(1);
109  ok(mutex == NULL, "no mutex key 1");
110  mutex= find_mutex_class(9999);
111  ok(mutex == NULL, "no mutex key 9999");
112 
113  rwlock= find_rwlock_class(0);
114  ok(rwlock == NULL, "no rwlock key 0");
115  rwlock= find_rwlock_class(1);
116  ok(rwlock == NULL, "no rwlock key 1");
117  rwlock= find_rwlock_class(9999);
118  ok(rwlock == NULL, "no rwlock key 9999");
119 
120  cond= find_cond_class(0);
121  ok(cond == NULL, "no cond key 0");
122  cond= find_cond_class(1);
123  ok(cond == NULL, "no cond key 1");
124  cond= find_cond_class(9999);
125  ok(cond == NULL, "no cond key 9999");
126 
127  thread= find_thread_class(0);
128  ok(thread == NULL, "no thread key 0");
129  thread= find_thread_class(1);
130  ok(thread == NULL, "no thread key 1");
131  thread= find_thread_class(9999);
132  ok(thread == NULL, "no thread key 9999");
133 
134  file= find_file_class(0);
135  ok(file == NULL, "no file key 0");
136  file= find_file_class(1);
137  ok(file == NULL, "no file key 1");
138  file= find_file_class(9999);
139  ok(file == NULL, "no file key 9999");
140 
141  socket= find_socket_class(0);
142  ok(socket == NULL, "no socket key 0");
143  socket= find_socket_class(1);
144  ok(socket == NULL, "no socket key 1");
145  socket= find_socket_class(9999);
146  ok(socket == NULL, "no socket key 9999");
147 
153 }
154 
155 void test_mutex_registration()
156 {
157  int rc;
158  PFS_sync_key key;
159  PFS_mutex_class *mutex;
160 
161  rc= init_sync_class(5, 0, 0);
162  ok(rc == 0, "room for 5 mutex");
163 
164  key= register_mutex_class("FOO", 3, 0);
165  ok(key == 1, "foo registered");
166  key= register_mutex_class("BAR", 3, 0);
167  ok(key == 2, "bar registered");
168  key= register_mutex_class("FOO", 3, 0);
169  ok(key == 1, "foo re registered");
170  key= register_mutex_class("M-3", 3, 0);
171  ok(key == 3, "M-3 registered");
172  key= register_mutex_class("M-4", 3, 0);
173  ok(key == 4, "M-4 registered");
174  key= register_mutex_class("M-5", 3, 0);
175  ok(key == 5, "M-5 registered");
176  ok(mutex_class_lost == 0, "lost nothing");
177  key= register_mutex_class("M-6", 3, 0);
178  ok(key == 0, "M-6 not registered");
179  ok(mutex_class_lost == 1, "lost 1 mutex");
180  key= register_mutex_class("M-7", 3, 0);
181  ok(key == 0, "M-7 not registered");
182  ok(mutex_class_lost == 2, "lost 2 mutex");
183  key= register_mutex_class("M-3", 3, 0);
184  ok(key == 3, "M-3 re registered");
185  ok(mutex_class_lost == 2, "lost 2 mutex");
186  key= register_mutex_class("M-5", 3, 0);
187  ok(key == 5, "M-5 re registered");
188  ok(mutex_class_lost == 2, "lost 2 mutex");
189 
190  mutex= find_mutex_class(0);
191  ok(mutex == NULL, "no key 0");
192  mutex= find_mutex_class(3);
193  ok(mutex != NULL, "found key 3");
194  ok(strncmp(mutex->m_name, "M-3", 3) == 0, "key 3 is M-3");
195  ok(mutex->m_name_length == 3, "name length 3");
196  mutex= find_mutex_class(9999);
197  ok(mutex == NULL, "no key 9999");
198 
200 }
201 
202 void test_rwlock_registration()
203 {
204  int rc;
205  PFS_sync_key key;
206  PFS_rwlock_class *rwlock;
207 
208  rc= init_sync_class(0, 5, 0);
209  ok(rc == 0, "room for 5 rwlock");
210 
211  key= register_rwlock_class("FOO", 3, 0);
212  ok(key == 1, "foo registered");
213  key= register_rwlock_class("BAR", 3, 0);
214  ok(key == 2, "bar registered");
215  key= register_rwlock_class("FOO", 3, 0);
216  ok(key == 1, "foo re registered");
217  key= register_rwlock_class("RW-3", 4, 0);
218  ok(key == 3, "RW-3 registered");
219  key= register_rwlock_class("RW-4", 4, 0);
220  ok(key == 4, "RW-4 registered");
221  key= register_rwlock_class("RW-5", 4, 0);
222  ok(key == 5, "RW-5 registered");
223  key= register_rwlock_class("RW-6", 4, 0);
224  ok(key == 0, "RW-6 not registered");
225  key= register_rwlock_class("RW-7", 4, 0);
226  ok(key == 0, "RW-7 not registered");
227  key= register_rwlock_class("RW-3", 4, 0);
228  ok(key == 3, "RW-3 re registered");
229  key= register_rwlock_class("RW-5", 4, 0);
230  ok(key == 5, "RW-5 re registered");
231 
232  rwlock= find_rwlock_class(0);
233  ok(rwlock == NULL, "no key 0");
234  rwlock= find_rwlock_class(3);
235  ok(rwlock != NULL, "found key 3");
236  ok(strncmp(rwlock->m_name, "RW-3", 4) == 0, "key 3 is RW-3");
237  ok(rwlock->m_name_length == 4, "name length 4");
238  rwlock= find_rwlock_class(9999);
239  ok(rwlock == NULL, "no key 9999");
240 
242 }
243 
244 void test_cond_registration()
245 {
246  int rc;
247  PFS_sync_key key;
248  PFS_cond_class *cond;
249 
250  rc= init_sync_class(0, 0, 5);
251  ok(rc == 0, "room for 5 cond");
252 
253  key= register_cond_class("FOO", 3, 0);
254  ok(key == 1, "foo registered");
255  key= register_cond_class("BAR", 3, 0);
256  ok(key == 2, "bar registered");
257  key= register_cond_class("FOO", 3, 0);
258  ok(key == 1, "foo re registered");
259  key= register_cond_class("C-3", 3, 0);
260  ok(key == 3, "C-3 registered");
261  key= register_cond_class("C-4", 3, 0);
262  ok(key == 4, "C-4 registered");
263  key= register_cond_class("C-5", 3, 0);
264  ok(key == 5, "C-5 registered");
265  key= register_cond_class("C-6", 3, 0);
266  ok(key == 0, "C-6 not registered");
267  key= register_cond_class("C-7", 3, 0);
268  ok(key == 0, "C-7 not registered");
269  key= register_cond_class("C-3", 3, 0);
270  ok(key == 3, "C-3 re registered");
271  key= register_cond_class("C-5", 3, 0);
272  ok(key == 5, "C-5 re registered");
273 
274  cond= find_cond_class(0);
275  ok(cond == NULL, "no key 0");
276  cond= find_cond_class(3);
277  ok(cond != NULL, "found key 3");
278  ok(strncmp(cond->m_name, "C-3", 3) == 0, "key 3 is C-3");
279  ok(cond->m_name_length == 3, "name length 3");
280  cond= find_cond_class(9999);
281  ok(cond == NULL, "no key 9999");
282 
284 }
285 
286 void test_thread_registration()
287 {
288  int rc;
289  PFS_thread_key key;
290  PFS_thread_class *thread;
291 
292  rc= init_thread_class(5);
293  ok(rc == 0, "room for 5 thread");
294 
295  key= register_thread_class("FOO", 3, 0);
296  ok(key == 1, "foo registered");
297  key= register_thread_class("BAR", 3, 0);
298  ok(key == 2, "bar registered");
299  key= register_thread_class("FOO", 3, 0);
300  ok(key == 1, "foo re registered");
301  key= register_thread_class("Thread-3", 8, 0);
302  ok(key == 3, "Thread-3 registered");
303  key= register_thread_class("Thread-4", 8, 0);
304  ok(key == 4, "Thread-4 registered");
305  key= register_thread_class("Thread-5", 8, 0);
306  ok(key == 5, "Thread-5 registered");
307  key= register_thread_class("Thread-6", 8, 0);
308  ok(key == 0, "Thread-6 not registered");
309  key= register_thread_class("Thread-7", 8, 0);
310  ok(key == 0, "Thread-7 not registered");
311  key= register_thread_class("Thread-3", 8, 0);
312  ok(key == 3, "Thread-3 re registered");
313  key= register_thread_class("Thread-5", 8, 0);
314  ok(key == 5, "Thread-5 re registered");
315 
316  thread= find_thread_class(0);
317  ok(thread == NULL, "no key 0");
318  thread= find_thread_class(3);
319  ok(thread != NULL, "found key 3");
320  ok(strncmp(thread->m_name, "Thread-3", 8) == 0, "key 3 is Thread-3");
321  ok(thread->m_name_length == 8, "name length 8");
322  thread= find_thread_class(9999);
323  ok(thread == NULL, "no key 9999");
324 
326 }
327 
328 void test_file_registration()
329 {
330  int rc;
331  PFS_file_key key;
333 
334  rc= init_file_class(5);
335  ok(rc == 0, "room for 5 file");
336 
337  key= register_file_class("FOO", 3, 0);
338  ok(key == 1, "foo registered");
339  key= register_file_class("BAR", 3, 0);
340  ok(key == 2, "bar registered");
341  key= register_file_class("FOO", 3, 0);
342  ok(key == 1, "foo re registered");
343  key= register_file_class("File-3", 6, 0);
344  ok(key == 3, "File-3 registered");
345  key= register_file_class("File-4", 6, 0);
346  ok(key == 4, "File-4 registered");
347  key= register_file_class("File-5", 6, 0);
348  ok(key == 5, "File-5 registered");
349  key= register_file_class("File-6", 6, 0);
350  ok(key == 0, "File-6 not registered");
351  key= register_file_class("File-7", 6, 0);
352  ok(key == 0, "File-7 not registered");
353  key= register_file_class("File-3", 6, 0);
354  ok(key == 3, "File-3 re registered");
355  key= register_file_class("File-5", 6, 0);
356  ok(key == 5, "File-5 re registered");
357 
358  file= find_file_class(0);
359  ok(file == NULL, "no key 0");
360  file= find_file_class(3);
361  ok(file != NULL, "found key 3");
362  ok(strncmp(file->m_name, "File-3", 6) == 0, "key 3 is File-3");
363  ok(file->m_name_length == 6, "name length 6");
364  file= find_file_class(9999);
365  ok(file == NULL, "no key 9999");
366 
368 }
369 
370 void test_socket_registration()
371 {
372  int rc;
373  PFS_socket_key key;
374  PFS_socket_class *socket;
375 
376  rc= init_socket_class(5);
377  ok(rc == 0, "room for 5 socket");
378 
379  key= register_socket_class("FOO", 3, 0);
380  ok(key == 1, "foo registered");
381  key= register_socket_class("BAR", 3, 0);
382  ok(key == 2, "bar registered");
383  key= register_socket_class("FOO", 3, 0);
384  ok(key == 1, "foo re registered");
385  key= register_socket_class("Socket-3", 8, 0);
386  ok(key == 3, "Socket-3 registered");
387  key= register_socket_class("Socket-4", 8, 0);
388  ok(key == 4, "Socket-4 registered");
389  key= register_socket_class("Socket-5", 8, 0);
390  ok(key == 5, "Socket-5 registered");
391  ok(socket_class_lost == 0, "lost nothing");
392  key= register_socket_class("Socket-6", 8, 0);
393  ok(key == 0, "Socket-6 not registered");
394  ok(socket_class_lost == 1, "lost 1 socket");
395  key= register_socket_class("Socket-7", 8, 0);
396  ok(key == 0, "Socket-7 not registered");
397  ok(socket_class_lost == 2, "lost 2 socket");
398  key= register_socket_class("Socket-3", 8, 0);
399  ok(key == 3, "Socket-3 re registered");
400  ok(socket_class_lost == 2, "lost 2 socket");
401  key= register_socket_class("Socket-5", 8, 0);
402  ok(key == 5, "Socket-5 re registered");
403  ok(socket_class_lost == 2, "lost 2 socket");
404 
405  socket= find_socket_class(0);
406  ok(socket == NULL, "no key 0");
407  socket= find_socket_class(3);
408  ok(socket != NULL, "found key 3");
409  ok(strncmp(socket->m_name, "Socket-3", 8) == 0, "key 3 is Socket-3");
410  ok(socket->m_name_length == 8, "name length 3");
411  socket= find_socket_class(9999);
412  ok(socket == NULL, "no key 9999");
413 
415 }
416 
417 void test_table_registration()
418 {
419 #ifdef LATER
420  PFS_table_share *table_share;
421  PFS_table_share *table_share_2;
422 
423  PFS_thread fake_thread;
424  fake_thread.m_table_share_hash_pins= NULL;
425 
426  table_share_lost= 0;
427  table_share= find_or_create_table_share(& fake_thread, false, "db1", 3, "t1", 2);
428  ok(table_share == NULL, "not created");
429  ok(table_share_lost == 1, "lost the table");
430 
431  table_share_lost= 0;
432  init_table_share(5);
434 
435  table_share= find_or_create_table_share(& fake_thread, false, "db1", 3, "t1", 2);
436  ok(table_share != NULL, "created db1.t1");
437  ok(table_share_lost == 0, "not lost");
438 
439  table_share_2= find_or_create_table_share(& fake_thread, false, "db1", 3, "t1", 2);
440  ok(table_share_2 != NULL, "found db1.t1");
441  ok(table_share_lost == 0, "not lost");
442  ok(table_share == table_share_2, "same table");
443 
444  table_share_2= find_or_create_table_share(& fake_thread, false, "db1", 3, "t2", 2);
445  ok(table_share_2 != NULL, "created db1.t2");
446  ok(table_share_lost == 0, "not lost");
447 
448  table_share_2= find_or_create_table_share(& fake_thread, false, "db2", 3, "t1", 2);
449  ok(table_share_2 != NULL, "created db2.t1");
450  ok(table_share_lost == 0, "not lost");
451 
452  table_share_2= find_or_create_table_share(& fake_thread, false, "db2", 3, "t2", 2);
453  ok(table_share_2 != NULL, "created db2.t2");
454  ok(table_share_lost == 0, "not lost");
455 
456  table_share_2= find_or_create_table_share(& fake_thread, false, "db3", 3, "t3", 2);
457  ok(table_share_2 != NULL, "created db3.t3");
458  ok(table_share_lost == 0, "not lost");
459 
460  table_share_2= find_or_create_table_share(& fake_thread, false, "db4", 3, "t4", 2);
461  ok(table_share_2 == NULL, "lost db4.t4");
462  ok(table_share_lost == 1, "lost");
463 
464  table_share_lost= 0;
465  table_share_2= find_or_create_table_share(& fake_thread, false, "db1", 3, "t2", 2);
466  ok(table_share_2 != NULL, "found db1.t2");
467  ok(table_share_lost == 0, "not lost");
468  ok(strncmp(table_share_2->m_schema_name, "db1", 3) == 0 , "schema db1");
469  ok(table_share_2->m_schema_name_length == 3, "length 3");
470  ok(strncmp(table_share_2->m_table_name, "t2", 2) == 0 , "table t2");
471  ok(table_share_2->m_table_name_length == 2, "length 2");
472 
475 #endif
476 }
477 
478 #ifdef LATER
479 void set_wait_stat(PFS_instr_class *klass)
480 {
481  PFS_single_stat *stat;
482  stat= & global_instr_class_waits_array[klass->m_event_name_index];
483 
484  stat->m_count= 12;
485  stat->m_min= 5;
486  stat->m_max= 120;
487  stat->m_sum= 999;
488 }
489 
490 bool is_empty_stat(PFS_instr_class *klass)
491 {
492  PFS_single_stat *stat;
493  stat= & global_instr_class_waits_array[klass->m_event_name_index];
494 
495  if (stat->m_count != 0)
496  return false;
497  if (stat->m_min != (ulonglong) -1)
498  return false;
499  if (stat->m_max != 0)
500  return false;
501  if (stat->m_sum != 0)
502  return false;
503  return true;
504 }
505 #endif
506 
507 void test_instruments_reset()
508 {
509  int rc;
510  PFS_sync_key key;
511  PFS_file_key file_key;
512  PFS_socket_key socket_key;
513  PFS_mutex_class *mutex_1;
514  PFS_mutex_class *mutex_2;
515  PFS_mutex_class *mutex_3;
516  PFS_rwlock_class *rwlock_1;
517  PFS_rwlock_class *rwlock_2;
518  PFS_rwlock_class *rwlock_3;
519  PFS_cond_class *cond_1;
520  PFS_cond_class *cond_2;
521  PFS_cond_class *cond_3;
522  PFS_file_class *file_1;
523  PFS_file_class *file_2;
524  PFS_file_class *file_3;
525  PFS_socket_class *socket_1;
526  PFS_socket_class *socket_2;
527  PFS_socket_class *socket_3;
528 
529  rc= init_sync_class(3, 3, 3);
530  ok(rc == 0, "init (sync)");
531  rc= init_thread_class(3);
532  ok(rc == 0, "init (thread)");
533  rc= init_file_class(3);
534  ok(rc == 0, "init (file)");
535  rc= init_socket_class(3);
536  ok(rc == 0, "init (socket)");
537 
538  key= register_mutex_class("M-1", 3, 0);
539  ok(key == 1, "mutex registered");
540  key= register_mutex_class("M-2", 3, 0);
541  ok(key == 2, "mutex registered");
542  key= register_mutex_class("M-3", 3, 0);
543  ok(key == 3, "mutex registered");
544 
545  key= register_rwlock_class("RW-1", 4, 0);
546  ok(key == 1, "rwlock registered");
547  key= register_rwlock_class("RW-2", 4, 0);
548  ok(key == 2, "rwlock registered");
549  key= register_rwlock_class("RW-3", 4, 0);
550  ok(key == 3, "rwlock registered");
551 
552  key= register_cond_class("C-1", 3, 0);
553  ok(key == 1, "cond registered");
554  key= register_cond_class("C-2", 3, 0);
555  ok(key == 2, "cond registered");
556  key= register_cond_class("C-3", 3, 0);
557  ok(key == 3, "cond registered");
558 
559  file_key= register_file_class("F-1", 3, 0);
560  ok(file_key == 1, "file registered");
561  file_key= register_file_class("F-2", 3, 0);
562  ok(file_key == 2, "file registered");
563  file_key= register_file_class("F-3", 3, 0);
564  ok(file_key == 3, "file registered");
565 
566  socket_key= register_socket_class("S-1", 3, 0);
567  ok(socket_key == 1, "socket registered");
568  socket_key= register_socket_class("S-2", 3, 0);
569  ok(socket_key == 2, "socket registered");
570  socket_key= register_socket_class("S-3", 3, 0);
571  ok(socket_key == 3, "socket registered");
572 
573  mutex_1= find_mutex_class(1);
574  ok(mutex_1 != NULL, "mutex key 1");
575  mutex_2= find_mutex_class(2);
576  ok(mutex_2 != NULL, "mutex key 2");
577  mutex_3= find_mutex_class(3);
578  ok(mutex_3 != NULL, "mutex key 3");
579 
580  rwlock_1= find_rwlock_class(1);
581  ok(rwlock_1 != NULL, "rwlock key 1");
582  rwlock_2= find_rwlock_class(2);
583  ok(rwlock_2 != NULL, "rwlock key 2");
584  rwlock_3= find_rwlock_class(3);
585  ok(rwlock_3 != NULL, "rwlock key 3");
586 
587  cond_1= find_cond_class(1);
588  ok(cond_1 != NULL, "cond key 1");
589  cond_2= find_cond_class(2);
590  ok(cond_2 != NULL, "cond key 2");
591  cond_3= find_cond_class(3);
592  ok(cond_3 != NULL, "cond key 3");
593 
594  file_1= find_file_class(1);
595  ok(file_1 != NULL, "file key 1");
596  file_2= find_file_class(2);
597  ok(file_2 != NULL, "file key 2");
598  file_3= find_file_class(3);
599  ok(file_3 != NULL, "file key 3");
600 
601  socket_1= find_socket_class(1);
602  ok(socket_1 != NULL, "socket key 1");
603  socket_2= find_socket_class(2);
604  ok(socket_2 != NULL, "socket key 2");
605  socket_3= find_socket_class(3);
606  ok(socket_3 != NULL, "socket key 3");
607 
608 #ifdef LATER
609  set_wait_stat(mutex_1);
610  set_wait_stat(mutex_2);
611  set_wait_stat(mutex_3);
612  set_wait_stat(rwlock_1);
613  set_wait_stat(rwlock_2);
614  set_wait_stat(rwlock_3);
615  set_wait_stat(cond_1);
616  set_wait_stat(cond_2);
617  set_wait_stat(cond_3);
618  set_wait_stat(file_1);
619  set_wait_stat(file_2);
620  set_wait_stat(file_3);
621 
622  ok(! is_empty_stat(mutex_1), "mutex_1 stat is populated");
623  ok(! is_empty_stat(mutex_2), "mutex_2 stat is populated");
624  ok(! is_empty_stat(mutex_3), "mutex_3 stat is populated");
625  ok(! is_empty_stat(rwlock_1), "rwlock_1 stat is populated");
626  ok(! is_empty_stat(rwlock_2), "rwlock_2 stat is populated");
627  ok(! is_empty_stat(rwlock_3), "rwlock_3 stat is populated");
628  ok(! is_empty_stat(cond_1), "cond_1 stat is populated");
629  ok(! is_empty_stat(cond_2), "cond_2 stat is populated");
630  ok(! is_empty_stat(cond_3), "cond_3 stat is populated");
631  ok(! is_empty_stat(file_1), "file_1 stat is populated");
632  ok(! is_empty_stat(file_2), "file_2 stat is populated");
633  ok(! is_empty_stat(file_3), "file_3 stat is populated");
634 
635  reset_global_wait_stat();
636 
637  ok(is_empty_stat(mutex_1), "mutex_1 stat is cleared");
638  ok(is_empty_stat(mutex_2), "mutex_2 stat is cleared");
639  ok(is_empty_stat(mutex_3), "mutex_3 stat is cleared");
640  ok(is_empty_stat(rwlock_1), "rwlock_1 stat is cleared");
641  ok(is_empty_stat(rwlock_2), "rwlock_2 stat is cleared");
642  ok(is_empty_stat(rwlock_3), "rwlock_3 stat is cleared");
643  ok(is_empty_stat(cond_1), "cond_1 stat is cleared");
644  ok(is_empty_stat(cond_2), "cond_2 stat is cleared");
645  ok(is_empty_stat(cond_3), "cond_3 stat is cleared");
646  ok(is_empty_stat(file_1), "file_1 stat is cleared");
647  ok(is_empty_stat(file_2), "file_2 stat is cleared");
648  ok(is_empty_stat(file_3), "file_3 stat is cleared");
649 #endif
650 
654 }
655 
656 void do_all_tests()
657 {
659 
660  test_no_registration();
661  test_mutex_registration();
662  test_rwlock_registration();
663  test_cond_registration();
664  test_thread_registration();
665  test_file_registration();
666  test_socket_registration();
667  test_table_registration();
668  test_instruments_reset();
669 
671 }
672 
673 int main(int, char **)
674 {
675  plan(181);
676  MY_INIT("pfs_instr_info-t");
677  do_all_tests();
678  return 0;
679 }
680