22 #include "my_config.h"
23 #include <gtest/gtest.h>
25 #ifdef OPTIMIZER_TRACE
28 #include <mysys_err.h>
30 #ifdef HAVE_SYS_WAIT_H
34 namespace opt_trace_unittest {
36 const ulonglong all_features= Opt_trace_context::default_features;
43 #define check_json_compliance(str, length) \
46 do_check_json_compliance(str, length); \
58 void do_check_json_compliance(
const char *str,
size_t length)
67 const char python_cmd[]=
69 "import json, re, sys;"
70 "s= sys.stdin.read();"
71 "s= re.sub('/\\\\*[ A-Za-z_]* \\\\*/', '', s);"
72 "json.loads(s, 'utf-8')\"";
74 FILE *fd= popen(python_cmd,
"w");
75 ASSERT_TRUE(NULL != fd);
76 ASSERT_NE(0
U, length);
77 ASSERT_EQ(1
U, fwrite(str, length, 1, fd));
85 void my_error_handler(uint error,
const char *str, myf MyFlags);
88 class TraceContentTest :
public ::testing::Test
94 static void SetUpTestCase()
96 system_charset_info= &my_charset_utf8_general_ci;
100 error_handler_hook= my_error_handler;
103 DBUG_SET(
"o," IF_WIN(
"NUL",
"/dev/null"));
107 bool TraceContentTest::oom;
110 void my_error_handler(uint error,
const char *str, myf MyFlags)
112 const uint EE=
static_cast<uint
>(EE_OUTOFMEMORY);
113 EXPECT_EQ(EE, error);
115 TraceContentTest::oom=
true;
120 TEST_F(TraceContentTest, ConstructAndDestruct)
126 TEST_F(TraceContentTest, Empty)
128 ASSERT_FALSE(trace.start(
true,
false,
false,
false, -1, 1, ULONG_MAX,
130 EXPECT_TRUE(trace.is_started());
131 EXPECT_TRUE(trace.support_I_S());
142 Opt_trace_iterator it(&trace);
147 ASSERT_FALSE(it.at_end());
150 const char expected[]=
"{\n}";
151 EXPECT_STREQ(expected, info.trace_ptr);
152 EXPECT_EQ(
sizeof(expected) - 1, info.trace_length);
153 check_json_compliance(info.trace_ptr, info.trace_length);
154 EXPECT_EQ(0
U, info.missing_bytes);
155 EXPECT_FALSE(info.missing_priv);
159 ASSERT_TRUE(it.at_end());
164 TEST_F(TraceContentTest, NormalUsage)
166 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
170 oto.add_select_number(123456);
176 oto1.add_alnum(
"one key",
"one value").
177 add(
"another key", 100
U);
179 ota.add_alnum(
"one string element");
181 ota.add_hex(12318421343459ULL);
183 oto.add(
"yet another key", -1000LL);
186 ota.add(1LL).add(2).add(3LL).add(4LL);
190 Opt_trace_iterator it(&trace);
191 ASSERT_FALSE(it.at_end());
194 const char expected[]=
196 " \"select#\": 123456,\n"
197 " \"one array\": [\n"
200 " \"one key\": \"one value\",\n"
201 " \"another key\": 100\n"
203 " \"one string element\",\n"
206 " ] /* one array */,\n"
207 " \"yet another key\": -1000,\n"
208 " \"another array\": [\n"
213 " ] /* another array */\n"
215 EXPECT_STREQ(expected, info.trace_ptr);
216 EXPECT_EQ(
sizeof(expected) - 1, info.trace_length);
217 check_json_compliance(info.trace_ptr, info.trace_length);
218 EXPECT_EQ(0
U, info.missing_bytes);
219 EXPECT_FALSE(info.missing_priv);
222 ASSERT_TRUE(it.at_end());
227 TEST_F(TraceContentTest, BuggyObject)
229 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
238 oto1.add_alnum(
"one value");
242 ota.add_alnum(
"one string element");
245 oto.add(
"yet another key", -1000LL);
248 ota.add(1LL).add(2LL).add(3LL).add(4LL);
252 Opt_trace_iterator it(&trace);
253 ASSERT_FALSE(it.at_end());
256 const char expected[]=
258 " \"one array\": [\n"
261 " \"unknown_key_1\": \"one value\",\n"
262 " \"unknown_key_2\": 326,\n"
263 " \"unknown_key_3\": {\n"
266 " \"one string element\",\n"
268 " ] /* one array */,\n"
269 " \"yet another key\": -1000,\n"
270 " \"another array\": [\n"
275 " ] /* another array */\n"
277 EXPECT_STREQ(expected, info.trace_ptr);
278 EXPECT_EQ(
sizeof(expected) - 1, info.trace_length);
279 check_json_compliance(info.trace_ptr, info.trace_length);
280 EXPECT_EQ(0
U, info.missing_bytes);
281 EXPECT_FALSE(info.missing_priv);
284 ASSERT_TRUE(it.at_end());
289 TEST_F(TraceContentTest, BuggyArray)
291 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
297 ota.add(
"superfluous key", 200.4);
298 ota.add(
"not necessary", 326);
301 oto.add(
"yet another key", -1000LL);
304 ota.add(1LL).add(2LL).add(3LL).add(4LL);
308 Opt_trace_iterator it(&trace);
309 ASSERT_FALSE(it.at_end());
312 const char expected[]=
314 " \"one array\": [\n"
318 " } /* not needed */\n"
319 " ] /* one array */,\n"
320 " \"yet another key\": -1000,\n"
321 " \"another array\": [\n"
326 " ] /* another array */\n"
328 EXPECT_STREQ(expected, info.trace_ptr);
329 EXPECT_EQ(
sizeof(expected) - 1, info.trace_length);
330 check_json_compliance(info.trace_ptr, info.trace_length);
331 EXPECT_EQ(0
U, info.missing_bytes);
332 EXPECT_FALSE(info.missing_priv);
335 ASSERT_TRUE(it.at_end());
340 TEST_F(TraceContentTest, DisableISWithObject)
342 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
351 oto1.add_alnum(
"one key",
"one value").
352 add(
"another key", 100LL);
354 oto1.add(
"a third key",
false);
356 oto2.add(
"key inside", 1LL);
359 oto2.add(
"another key inside", 5LL);
361 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
368 ota.add_alnum(
"one string element");
372 oto.add(
"yet another key", -1000LL);
375 ota.add(1LL).add(2LL).add(3LL).add(4LL);
379 Opt_trace_iterator it(&trace);
380 ASSERT_FALSE(it.at_end());
383 const char expected[]=
385 " \"one array\": [\n"
388 " \"one key\": \"one value\",\n"
389 " \"another key\": 100\n"
391 " \"one string element\",\n"
393 " ] /* one array */,\n"
394 " \"yet another key\": -1000,\n"
395 " \"another array\": [\n"
400 " ] /* another array */\n"
402 EXPECT_STREQ(expected, info.trace_ptr);
403 EXPECT_EQ(
sizeof(expected) - 1, info.trace_length);
404 check_json_compliance(info.trace_ptr, info.trace_length);
405 EXPECT_EQ(0
U, info.missing_bytes);
406 EXPECT_FALSE(info.missing_priv);
409 ASSERT_TRUE(it.at_end());
414 TEST_F(TraceContentTest, DisableISWithCall)
417 trace.disable_I_S_for_this_and_children();
418 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
427 oto1.add_alnum(
"one key",
"one value").
428 add(
"another key", 100LL);
429 oto1.add(
"a third key",
false);
431 oto2.add(
"key inside", 1LL);
433 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
441 oto2.add(
"another key inside", 5LL);
443 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
450 ota.add_alnum(
"one string element");
453 oto.add(
"yet another key", -1000LL);
456 ota.add(1LL).add(2LL).add(3LL).add(4LL);
461 Opt_trace_iterator it(&trace);
462 ASSERT_TRUE(it.at_end());
470 ASSERT_FALSE(trace->start(
true,
false,
true,
false, offset, limit,
471 ULONG_MAX, all_features));
495 #define check(trace, names) { SCOPED_TRACE(""); do_check(&trace, names); }
499 Opt_trace_iterator it(trace);
501 for (
const char **name= names ; *name != NULL ; name++)
503 ASSERT_FALSE(it.at_end());
505 const size_t name_len= strlen(*name);
506 EXPECT_EQ(name_len + 11, info.trace_length);
507 EXPECT_EQ(0, strncmp(info.trace_ptr + 5, *name, name_len));
508 EXPECT_EQ(0
U, info.missing_bytes);
511 ASSERT_TRUE(it.at_end());
516 TEST_F(TraceContentTest, Offset)
518 make_one_trace(&trace,
"100", -1 , 1 );
519 const char *expected_traces0[]= {
"100", NULL};
520 check(trace, expected_traces0);
521 make_one_trace(&trace,
"101", -1, 1);
523 const char *expected_traces1[]= {
"101", NULL};
524 check(trace, expected_traces1);
525 make_one_trace(&trace,
"102", -1, 1);
526 const char *expected_traces2[]= {
"102", NULL};
527 check(trace, expected_traces2);
529 const char *expected_traces_empty[]= {NULL};
530 check(trace, expected_traces_empty);
531 make_one_trace(&trace,
"103", -3, 2);
532 make_one_trace(&trace,
"104", -3, 2);
533 make_one_trace(&trace,
"105", -3, 2);
534 make_one_trace(&trace,
"106", -3, 2);
535 make_one_trace(&trace,
"107", -3, 2);
536 make_one_trace(&trace,
"108", -3, 2);
537 make_one_trace(&trace,
"109", -3, 2);
538 const char *expected_traces3[]= {
"107",
"108", NULL};
539 check(trace, expected_traces3);
541 check(trace, expected_traces_empty);
542 make_one_trace(&trace,
"110", 3, 2);
543 make_one_trace(&trace,
"111", 3, 2);
544 make_one_trace(&trace,
"112", 3, 2);
545 make_one_trace(&trace,
"113", 3, 2);
546 make_one_trace(&trace,
"114", 3, 2);
547 make_one_trace(&trace,
"115", 3, 2);
548 make_one_trace(&trace,
"116", 3, 2);
549 const char *expected_traces10[]= {
"113",
"114", NULL};
550 check(trace, expected_traces10);
552 check(trace, expected_traces_empty);
553 make_one_trace(&trace,
"117", 0, 1);
554 make_one_trace(&trace,
"118", 0, 1);
555 make_one_trace(&trace,
"119", 0, 1);
556 const char *expected_traces17[]= {
"117", NULL};
557 check(trace, expected_traces17);
559 make_one_trace(&trace,
"120", 0, 0);
560 make_one_trace(&trace,
"121", 0, 0);
561 make_one_trace(&trace,
"122", 0, 0);
562 const char *expected_traces20[]= {NULL};
563 check(trace, expected_traces20);
569 TEST_F(TraceContentTest, MaxMemSize)
571 ASSERT_FALSE(trace.start(
true,
false,
false,
false, -1,
572 1, 1000 , all_features));
577 for (
int i= 0;
i < 100;
i++)
579 ota.add_alnum(
"make it long");
583 Opt_trace_iterator it(&trace);
584 ASSERT_FALSE(it.at_end());
587 const char expected[]=
589 " \"one array\": [\n"
590 " \"make it long\",\n"
591 " \"make it long\",\n"
597 EXPECT_EQ(996
U, info.trace_length);
598 EXPECT_EQ(1027
U, info.missing_bytes);
599 EXPECT_FALSE(info.missing_priv);
601 EXPECT_EQ(0, strncmp(expected, info.trace_ptr,
sizeof(expected) - 1));
603 ASSERT_TRUE(it.at_end());
609 TEST_F(TraceContentTest, MaxMemSize2)
611 ASSERT_FALSE(trace.start(
true,
false,
false,
false, -2,
612 2, 21 , all_features));
616 oto.add_alnum(
"some key1",
"make it long");
620 ASSERT_FALSE(trace.start(
true,
false,
false,
false, -2,
621 2, 21, all_features));
624 oto.add_alnum(
"some key2",
"make it long");
627 Opt_trace_iterator it(&trace);
628 ASSERT_FALSE(it.at_end());
631 EXPECT_EQ(17
U, info.trace_length);
632 EXPECT_EQ(16
U, info.missing_bytes);
633 EXPECT_FALSE(info.missing_priv);
636 ASSERT_FALSE(it.at_end());
639 EXPECT_EQ(0
U, info.trace_length);
640 EXPECT_EQ(33
U, info.missing_bytes);
642 ASSERT_TRUE(it.at_end());
647 ASSERT_FALSE(trace.start(
true,
false,
false,
false, -2,
648 2, 21, all_features));
651 oto.add_alnum(
"some key3",
"make it long");
654 Opt_trace_iterator it2(&trace);
655 ASSERT_FALSE(it2.at_end());
656 it2.get_value(&info);
657 EXPECT_EQ(0
U, info.trace_length);
658 EXPECT_EQ(33
U, info.missing_bytes);
659 EXPECT_FALSE(info.missing_priv);
662 it2.get_value(&info);
667 EXPECT_EQ(14
U, info.trace_length);
668 EXPECT_EQ(19
U, info.missing_bytes);
669 EXPECT_FALSE(info.missing_priv);
671 ASSERT_TRUE(it2.at_end());
687 llstr(100 + count, key);
691 DBUG_SET(
"+d,opt_trace_oom_in_open_struct");
697 DBUG_SET(
"-d,opt_trace_oom_in_open_struct");
700 open_object(count, trace, simulate_oom);
707 TEST_F(TraceContentTest, OOMinBuffer)
709 ASSERT_FALSE(trace.start(
true,
false,
false,
false, -1, 1, ULONG_MAX,
715 DBUG_SET(
"+d,opt_trace_oom_in_buffers");
716 for (
int i= 0;
i < 30;
i++)
717 ota.add_alnum(
"_______________________________________________");
718 DBUG_SET(
"-d,opt_trace_oom_in_buffers");
722 Opt_trace_iterator it(&trace);
723 ASSERT_FALSE(it.at_end());
726 EXPECT_EQ(0
U, info.missing_bytes);
727 EXPECT_FALSE(info.missing_priv);
729 ASSERT_TRUE(it.at_end());
735 TEST_F(TraceContentTest, OOMinBookKeeping)
737 ASSERT_FALSE(trace.start(
true,
false,
false,
false, -1, 1, ULONG_MAX,
741 open_object(100, &trace,
true);
744 Opt_trace_iterator it(&trace);
745 ASSERT_FALSE(it.at_end());
748 EXPECT_EQ(0
U, info.missing_bytes);
749 EXPECT_FALSE(info.missing_priv);
751 ASSERT_TRUE(it.at_end());
757 TEST_F(TraceContentTest, OOMinPurge)
759 make_one_trace(&trace,
"103", -3, 2);
760 make_one_trace(&trace,
"104", -3, 2);
761 DBUG_SET(
"+d,opt_trace_oom_in_purge");
762 make_one_trace(&trace,
"105", -3, 2);
763 make_one_trace(&trace,
"106", -3, 2);
764 make_one_trace(&trace,
"107", -3, 2);
765 make_one_trace(&trace,
"108", -3, 2);
766 make_one_trace(&trace,
"109", -3, 2);
767 make_one_trace(&trace,
"110", -3, 2);
768 make_one_trace(&trace,
"111", -3, 2);
769 make_one_trace(&trace,
"112", -3, 2);
770 make_one_trace(&trace,
"113", -3, 2);
771 make_one_trace(&trace,
"114", -3, 2);
772 make_one_trace(&trace,
"115", -3, 2);
773 make_one_trace(&trace,
"116", -3, 2);
774 make_one_trace(&trace,
"117", -3, 2);
775 make_one_trace(&trace,
"118", -3, 2);
776 make_one_trace(&trace,
"119", -3, 2);
777 make_one_trace(&trace,
"120", -3, 2);
778 make_one_trace(&trace,
"121", -3, 2);
779 make_one_trace(&trace,
"122", -3, 2);
781 DBUG_SET(
"-d,opt_trace_oom_in_purge");
783 const char *expected_traces3[]= {
"119",
"120", NULL};
784 check(trace, expected_traces3);
789 make_one_trace(&trace,
"123", -3, 2);
790 const char *expected_traces4[]= {
"121",
"122", NULL};
791 check(trace, expected_traces4);
799 TEST_F(TraceContentTest, FilteringByFeature)
801 ASSERT_FALSE(trace.start(
true,
false,
false,
false, -1, 1, ULONG_MAX,
802 Opt_trace_context::MISC));
810 oto1.add_alnum(
"one key",
"one value").
811 add(
"another key", 100LL);
813 Opt_trace_context::MISC);
814 oto2.add(
"another key inside", 5LL);
820 Opt_trace_context::GREEDY_SEARCH);
823 oto.add(
"yet another key", -1000LL);
826 ota.add(1LL).add(2LL).add(3LL).add(4LL);
830 Opt_trace_iterator it(&trace);
831 ASSERT_FALSE(it.at_end());
834 const char expected[]=
836 " \"one array\": [\n"
841 " \"key for oto3\": \"...\",\n"
842 " \"yet another key\": -1000,\n"
843 " \"another array\": [\n"
850 EXPECT_STREQ(expected, info.trace_ptr);
851 EXPECT_EQ(
sizeof(expected) - 1, info.trace_length);
852 check_json_compliance(info.trace_ptr, info.trace_length);
853 EXPECT_EQ(0
U, info.missing_bytes);
854 EXPECT_FALSE(info.missing_priv);
857 ASSERT_TRUE(it.at_end());
862 TEST_F(TraceContentTest, Escaping)
864 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
868 for (uint c= 0; c <
sizeof(all_chars) - 2 ; c++)
871 all_chars[128]=
static_cast<char>(0xc3);
872 all_chars[129]=
static_cast<char>(0xa4);
874 trace.set_query(all_chars,
sizeof(all_chars), system_charset_info);
878 oto.add_utf8(
"somekey", all_chars,
sizeof(all_chars));
881 Opt_trace_iterator it(&trace);
882 ASSERT_FALSE(it.at_end());
886 const char expected[]=
888 " \"somekey\": \"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\u0008\\t\\n\\u000b\\u000c\\r\\u000e\\u000f\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017\\u0018\\u0019\\u001a\\u001b\\u001c\\u001d\\u001e\\u001f !\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ä\"\n"
890 EXPECT_STREQ(expected, info.trace_ptr);
891 EXPECT_EQ(
sizeof(expected) - 1, info.trace_length);
892 check_json_compliance(info.trace_ptr, info.trace_length);
893 EXPECT_EQ(0
U, info.missing_bytes);
894 EXPECT_FALSE(info.missing_priv);
896 EXPECT_EQ(
sizeof(all_chars), info.query_length);
898 EXPECT_EQ(0, memcmp(all_chars, info.query_ptr,
sizeof(all_chars)));
899 EXPECT_EQ(system_charset_info, info.query_charset);
901 ASSERT_TRUE(it.at_end());
906 TEST_F(TraceContentTest, NonUtf8)
908 ASSERT_FALSE(trace.start(
true,
false,
true,
false, -1, 1, ULONG_MAX,
918 const char all_chars[]=
"\xe9\xe8\xc4\xe0" "ABC";
920 trace.set_query(all_chars,
sizeof(all_chars), &my_charset_latin1);
930 oto.add_utf8(
"somekey", all_chars,
sizeof(all_chars) - 1);
933 Opt_trace_iterator it(&trace);
934 ASSERT_FALSE(it.at_end());
938 const char expected[]=
940 " \"somekey\": \"" "\xe9\xe8\xc4\xe0" "ABC\"\n"
942 EXPECT_STREQ(expected, info.trace_ptr);
943 EXPECT_EQ(
sizeof(expected) - 1, info.trace_length);
944 EXPECT_EQ(0
U, info.missing_bytes);
945 EXPECT_FALSE(info.missing_priv);
947 EXPECT_EQ(
sizeof(all_chars), info.query_length);
949 EXPECT_EQ(0, memcmp(all_chars, info.query_ptr,
sizeof(all_chars)));
951 ASSERT_TRUE(it.at_end());
960 TEST_F(TraceContentTest, Indent)
962 ASSERT_FALSE(trace.start(
true,
false,
false,
false, -1, 1, ULONG_MAX,
966 open_object(100, &trace,
false);
969 Opt_trace_iterator it(&trace);
970 ASSERT_FALSE(it.at_end());
996 EXPECT_EQ(21303
U, info.trace_length);
998 for (uint
i= 0;
i < info.trace_length;
i++)
999 if (info.trace_ptr[
i] ==
' ')
1001 EXPECT_EQ(20300
U, spaces);
1002 check_json_compliance(info.trace_ptr, info.trace_length);
1003 EXPECT_EQ(0
U, info.missing_bytes);
1004 EXPECT_FALSE(info.missing_priv);
1007 ASSERT_TRUE(it.at_end());
1012 TEST_F(TraceContentTest, MissingPrivilege)
1014 ASSERT_FALSE(trace.start(
true,
false,
true,
false, 0, 100, ULONG_MAX,
1023 oto1.add_alnum(
"one key",
"one value").
1024 add(
"another key", 100LL);
1025 oto1.add(
"a third key",
false);
1027 oto2.add(
"key inside", 1LL);
1028 ASSERT_FALSE(trace.start(
true,
false,
true,
false, 0, 100, ULONG_MAX,
1032 trace.missing_privilege();
1033 ASSERT_FALSE(trace.start(
true,
false,
true,
false, 0, 100,
1034 ULONG_MAX, all_features));
1037 oto4.add_alnum(
"in4",
"key4");
1043 oto2.add(
"another key inside", 5LL);
1045 ASSERT_FALSE(trace.start(
true,
false,
true,
false, 0, 100, ULONG_MAX,
1049 oto5.add(
"in5",
true);
1053 ota.add_alnum(
"one string element");
1056 oto.add(
"yet another key", -1000LL);
1059 ota.add(1LL).add(2LL).add(3LL).add(4LL);
1063 Opt_trace_iterator it(&trace);
1064 ASSERT_FALSE(it.at_end());
1065 Opt_trace_info info;
1066 it.get_value(&info);
1067 const char expected[]=
1069 " \"one array\": [\n"
1072 " \"one key\": \"one value\",\n"
1073 " \"another key\": 100,\n"
1074 " \"a third key\": false,\n"
1075 " \"a fourth key\": {\n"
1076 " \"key inside\": 1,\n"
1077 " \"another key inside\": 5\n"
1078 " } /* a fourth key */\n"
1080 " \"one string element\",\n"
1082 " ] /* one array */,\n"
1083 " \"yet another key\": -1000,\n"
1084 " \"another array\": [\n"
1089 " ] /* another array */\n"
1091 EXPECT_STREQ(expected, info.trace_ptr);
1092 EXPECT_EQ(
sizeof(expected) - 1, info.trace_length);
1093 check_json_compliance(info.trace_ptr, info.trace_length);
1094 EXPECT_EQ(0
U, info.missing_bytes);
1095 EXPECT_FALSE(info.missing_priv);
1098 ASSERT_FALSE(it.at_end());
1100 it.get_value(&info);
1101 const char expected2[]=
"";
1102 EXPECT_STREQ(expected2, info.trace_ptr);
1103 EXPECT_EQ(
sizeof(expected2) - 1, info.trace_length);
1104 EXPECT_EQ(0
U, info.missing_bytes);
1105 EXPECT_TRUE(info.missing_priv);
1107 ASSERT_FALSE(it.at_end());
1109 it.get_value(&info);
1110 const char expected3[]=
1114 EXPECT_STREQ(expected3, info.trace_ptr);
1115 EXPECT_EQ(
sizeof(expected3) - 1, info.trace_length);
1116 check_json_compliance(info.trace_ptr, info.trace_length);
1117 EXPECT_EQ(0
U, info.missing_bytes);
1118 EXPECT_FALSE(info.missing_priv);
1120 ASSERT_TRUE(it.at_end());
1125 TEST_F(TraceContentTest, MissingPrivilege2)
1131 ASSERT_FALSE(trace.start(
false,
false,
true,
false, 0, 100, ULONG_MAX,
1133 EXPECT_FALSE(trace.is_started());
1139 ASSERT_FALSE(trace.start(
false,
true,
true,
false, 0, 100, ULONG_MAX,
1141 EXPECT_TRUE(trace.is_started());
1142 trace.missing_privilege();
1144 ASSERT_FALSE(trace.start(
true,
false,
true,
false, 0, 100, ULONG_MAX,
1148 oto5.add(
"in5",
true);
1152 Opt_trace_iterator it(&trace);
1153 ASSERT_TRUE(it.at_end());
1162 TEST_F(TraceContentTest, NoOptTraceStmt)
1164 ASSERT_FALSE(trace.start(
false,
false,
false,
false, -1, 1, ULONG_MAX,
1166 EXPECT_FALSE(trace.is_started());
1168 ASSERT_FALSE(trace.start(
false,
false,
false,
false, -1, 1, ULONG_MAX,
1170 EXPECT_FALSE(trace.is_started());
1172 ASSERT_FALSE(trace.start(
false,
false,
false,
false, -1, 1, ULONG_MAX,
1174 EXPECT_FALSE(trace.is_started());
1182 #endif // OPTIMIZER_TRACE