File: test_sql_errors.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (161 lines) | stat: -rw-r--r-- 5,629 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161

call mtr.add_suppression(".*test_sql_errors.*");
call mtr.add_suppression(".*Killing thread.*");

--echo # Creating tables
CREATE TABLE t_int (c1  TINYINT,
                    c2  SMALLINT,
                    c3  MEDIUMINT,
                    c4  INT,
                    c5  INTEGER,
                    c6  SMALLINT UNSIGNED,
                    c7  MEDIUMINT UNSIGNED,
                    c8  INT UNSIGNED,
                    c9  INTEGER);

CREATE TABLE t_bigint (c1  BIGINT,
                       c2  BIGINT UNSIGNED);

CREATE TABLE t_real (c1 REAL UNSIGNED,
                     c2 DOUBLE UNSIGNED,
                     c3 FLOAT UNSIGNED,
                     c4 DECIMAL UNSIGNED,
                     c5 NUMERIC UNSIGNED,
                     c6 DOUBLE,
                     c7 FLOAT,
                     c8 DECIMAL,
                     c9 NUMERIC);

CREATE TABLE t_date (c1 DATE,
                     c2 TIME,
                     c3 TIMESTAMP,
                     c4 DATETIME,
                     c5 YEAR);

CREATE TABLE t_char (c1 CHAR(32),
                     c2 VARCHAR(128) BINARY,
                     c3 VARCHAR(128),
                     c4 BINARY(128),
                     c5 VARBINARY(2048));

CREATE TABLE t_lob (c1  TINYBLOB,
                    c2  BLOB,
                    c3  MEDIUMBLOB,
                    c4  LONGBLOB,
                    c5  TINYTEXT,
                    c6  TEXT,
                    c7  MEDIUMTEXT,
                    c8  LONGTEXT,
                    c9  TINYTEXT BINARY,
                    c10 TEXT BINARY,
                    c11 MEDIUMTEXT BINARY,
                    c12 LONGTEXT BINARY);

CREATE TABLE t_spec (c1 BIT(16),
                     c2 ENUM('v1','v2','v3'),
                     c3 SET('v1','v2','v3'));

SET @orig_log_error_verbosity= @@GLOBAL.log_error_verbosity;
SET GLOBAL log_error_verbosity=3;

--echo # Inserting values into the tables
INSERT INTO t_int VALUES (91,92,93,94,95,96,97,98,99),(81,82,83,84,85,86,87,88,89);

INSERT INTO t_bigint VALUES (91,92),(81,82);

INSERT INTO t_real VALUES (8.51,8.52,8.53,8.54,8.55,8.56,8.57,8.58,8.59);

INSERT INTO t_real VALUES (9.51,9.52,9.53,9.54,9.55,9.56,9.57,9.58,9.59);

INSERT INTO t_date VALUES ('2015-07-06','20:15','2015-12-31 14:59:48','2014-11-30 13:58:47','2015');

INSERT INTO t_date VALUES ('2015-07-07','20:17','2013-12-31 17:59:47','2012-10-31 15:57:47','2010');

INSERT INTO t_char VALUES ('char-text','varchar-binary-text\nnext line','varchar-text','binary-text\nnext line','varbinary-text\nline 1\nline 2');

INSERT INTO t_char VALUES ('2char-text','2varchar-binary-text\nnext line','2varchar-text','2binary-text\nnext line','2varbinary-text\nline 1\nline 2');

INSERT INTO t_lob  VALUES ('tinyblob-text readable','blob-text readable','mediumblob-text readable',
                           'longblob-text readable','tinytext','text','mediumtext','longtext',
                           'tinytext-binary\nnext line','text-binary\nnext line',
                           'mediumtext-binary\nnext line','longtext-binary \nnext line');

INSERT INTO t_lob  VALUES ('2tinyblob-text readable','2blob-text readable','2mediumblob-text readable',
                           '2longblob-text readable','2tinytext','2text','2mediumtext','2longtext',
                           '2tinytext-binary\nnext line','2text-binary\nnext line',
                           '2mediumtext-binary\nnext line','2longtext-binary \nnext line');

INSERT INTO t_spec VALUES ( b'111', 'v1', 'v1');


--let GREP_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err

--echo ##########################################
--echo # Run plugin
--echo ##########################################
--replace_result $TEST_SQL_ERRORS TEST_SQL_ERRORS
eval INSTALL PLUGIN test_sql_errors SONAME '$TEST_SQL_ERRORS';

--disable_ps_protocol
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
/*first*/SELECT * FROM information_schema.processlist ORDER BY id;
--enable_ps_protocol

--echo ##########################################
--echo # Stop plugin
--echo ##########################################
UNINSTALL PLUGIN test_sql_errors;

--disable_ps_protocol
--replace_column 1 <ID> 3 <HOST_NAME> 6 <TIME>
/*first*/SELECT * FROM information_schema.processlist ORDER BY id;
--enable_ps_protocol

--echo ##########################################
--echo # Cleanup
--echo ##########################################

--echo # Dropping the created tables
DROP TABLE IF EXISTS t_int;
DROP TABLE IF EXISTS t_bigint;
DROP TABLE IF EXISTS t_real;
DROP TABLE IF EXISTS t_date;
DROP TABLE IF EXISTS t_char;
DROP TABLE IF EXISTS t_lob;
DROP TABLE IF EXISTS t_spec;

--echo ##########################################
--echo # Plugin log
--echo ##########################################
let $MYSQLD_DATADIR= `select @@datadir`;
cat_file $MYSQLD_DATADIR/test_sql_errors.log;
remove_file $MYSQLD_DATADIR/test_sql_errors.log;
--echo ##########################################
--echo # Server log
--echo ##########################################
--perl
  my $file= $ENV{'GREP_FILE'};
  my $pattern= ".*test_sql_errors.*";
  open(FILE, "$file") or die("Unable to open $file: $!\n");
  my $count = 0;
  while (<FILE>) {
    if ($_ =~ m/$pattern/) {
#      print "$_\n";
      $count++;
      break;
    }
  }
#  print "Count: $count\n";
  if ($count >= 9){
    print "test passed.\n";
  } else {
    print "test failed.\n";
  }
  close(FILE);
EOF
# The below force start is giving warnings in the server logs hence disabling warnings specifically
--disable_warnings
--source include/force_restart.inc
--enable_warnings

SET GLOBAL log_error_verbosity= @orig_log_error_verbosity;