~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
#
2
# Testing the MySQL command line client(mysql)
3
#
4
5
--disable_warnings
6
drop table if exists t1;
7
--enable_warnings
8
9
#
10
# Test the "delimiter" functionality
11
# Bug#9879
12
#
13
create table t1(a int);
14
insert into t1 values(1);
15
16
# Test delimiters
755.1.2 by Monty Taylor
Updated mysql.test for distcheck.
17
# This breaks vpath builds - and I don't care enough about it to fix
18
# drizzletest. We can re-enable this in the new test system
19
#--exec $MYSQL test 2>&1 < "$DRIZZLE_TEST_DIR/t/mysql_delimiter.sql"
1 by brian
clean slate
20
21
--disable_query_log
22
# Test delimiter : supplied on the command line
23
select "Test delimiter : from command line" as "_";
24
--exec $MYSQL test --delimiter=":" -e "select * from t1:"
25
# Test delimiter :; supplied on the command line
26
select "Test delimiter :; from command line" as "_";
27
--exec $MYSQL test --delimiter=":;" -e "select * from t1:;"
28
# Test 'go' command (vertical output) \G
29
select "Test 'go' command(vertical output) \G" as "_";
30
--exec $MYSQL test -e "select * from t1\G"
31
# Test 'go' command \g
32
select "Test  'go' command \g" as "_";
33
--exec $MYSQL test -e "select * from t1\g"
34
--enable_query_log
35
drop table t1;
36
37
#
38
# BUG9998 - MySQL client hangs on USE "database"
39
#
40
create table t1(a int);
41
lock tables t1 write;
42
--exec $MYSQL -e "use test; select database();"
43
unlock tables;
44
drop table t1;
45
46
#
47
# Bug#16859 -- NULLs in columns must not truncate data as if a C-language "string".
48
#
309 by Brian Aker
Merge from Monty
49
#--exec $MYSQL -t test -e "create table t1 (col1 binary(4), col2 varchar(10), col3 int); insert into t1 values ('a', 'b', 123421),('a ', '0123456789', 4), ('abcd', '', 4); select concat('>',col1,'<'), col2, col3 from t1; drop table t1;" 2>&1
1 by brian
clean slate
50
51
#
52
# Bug#17939 Wrong table format when using UTF8 strings
53
#
520.1.12 by Brian Aker
Adding back more tests.
54
--exec $MYSQL --table -e "SELECT 'John Doe' as '__tañgè Ñãmé'" 2>&1
55
--exec $MYSQL --table -e "SELECT '__tañgè Ñãmé' as 'John Doe'" 2>&1
1 by brian
clean slate
56
57
#
58
# Bug#18265 -- mysql client: No longer right-justifies numeric columns
59
#
520.1.12 by Brian Aker
Adding back more tests.
60
--exec $MYSQL -t test -e "create table t1 (i int, j int, k char(25)); insert into t1 (i) values (1); insert into t1 (k) values ('<----------------------->'); insert into t1 (k) values ('<-----'); insert into t1 (k) values ('Τη γλώσσα'); insert into t1 (k) values ('ᛖᚴ ᚷᛖᛏ'); select * from t1; DROP TABLE t1;"
1 by brian
clean slate
61
62
#
63
# "DESCRIBE" commands may return strange NULLness flags.
64
#
520.1.12 by Brian Aker
Adding back more tests.
65
--exec $MYSQL test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
66
--exec $MYSQL -t test -e "create table t1 (i int, j int not null, k int); insert into t1 values (null, 1, null); select * from t1; describe t1; drop table t1;"
1 by brian
clean slate
67
68
#
69
# Bug#19564: mysql displays NULL instead of space
70
#
71
--exec $MYSQL test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;" 
72
--exec $MYSQL -t test -e "create table b19564 (i int, s1 char(1)); insert into b19564 values (1, 'x'); insert into b19564 values (2, NULL); insert into b19564 values (3, ' '); select * from b19564 order by i; drop table b19564;" 
73
74
#
75
# Bug#21618: NULL shown as empty string in client
76
#
77
--exec $MYSQL test -e "select unhex('zz');" 
78
--exec $MYSQL -t test -e "select unhex('zz');" 
79
80
# Bug#19265 describe command does not work from mysql prompt
81
#
82
83
create table t1(a int, b varchar(255), c int);
84
--exec $MYSQL test -e "desc t1"
85
--exec $MYSQL test -e "desc t1\g"
86
drop table t1;
87
520.1.12 by Brian Aker
Adding back more tests.
88
#--disable_parsing
1 by brian
clean slate
89
#
90
# Bug#21042  	mysql client segfaults on importing a mysqldump export
91
#
309 by Brian Aker
Merge from Monty
92
#--error 1
93
#--exec $MYSQL test -e "connect verylongdatabasenamethatshouldblowthe256byteslongbufferincom_connectfunctionxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxkxendcccccccdxxxxxxxxxxxxxxxxxkskskskskkskskskskskskskskskskkskskskskkskskskskskskskskskend" 2>&1
94
#--enable_parsing
1 by brian
clean slate
95
96
97
#
98
# Bug #20432: mysql client interprets commands in comments
99
#
100
101
# if the client sees the 'use' within the comment, we haven't fixed
102
--exec echo "/*"          >  $MYSQLTEST_VARDIR/tmp/bug20432.sql
103
--exec echo "use"         >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
104
--exec echo "*/"          >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
105
--exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
106
107
# SQL can have embedded comments => workie
108
--exec echo "select /*"   >  $MYSQLTEST_VARDIR/tmp/bug20432.sql
109
--exec echo "use"         >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
110
--exec echo "*/ 1"        >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
111
--exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
112
113
# client commands on the other hand must be at BOL => error
114
--exec echo "/*"          >  $MYSQLTEST_VARDIR/tmp/bug20432.sql
115
--exec echo "xxx"         >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
116
--exec echo "*/ use"      >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
117
--error 1
118
--exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
119
120
# client comment recognized, but parameter missing => error
121
--exec echo "use"         >  $MYSQLTEST_VARDIR/tmp/bug20432.sql
122
--exec $MYSQL              < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
123
124
#
125
# Bug #20328: mysql client interprets commands in comments
126
#
309 by Brian Aker
Merge from Monty
127
#--exec $MYSQL -e "help" > $MYSQLTEST_VARDIR/tmp/bug20328_1.result
128
#--exec $MYSQL -e "help " > $MYSQLTEST_VARDIR/tmp/bug20328_2.result
129
#--diff_files $MYSQLTEST_VARDIR/tmp/bug20328_1.result $MYSQLTEST_VARDIR/tmp/bug20328_2.result
1 by brian
clean slate
130
131
#
132
# Bug #19216: Client crashes on long SELECT
133
#
134
# Create large SELECT
135
# - 3400 * 20 makes 68000 columns that is more than the
136
#   max number that can fit in a 16 bit number.
137
309 by Brian Aker
Merge from Monty
138
#--perl
139
#open(FILE,">","$ENV{'MYSQLTEST_VARDIR'}/tmp/b19216.tmp") or die;
140
#print FILE "select\n";
141
#print FILE "'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a',\n" x 3400;
142
#print FILE "'b';\n";
143
#close FILE;
144
#EOF
145
146
#--disable_query_log
147
#--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/b19216.tmp >/dev/null
148
#--enable_query_log
149
#
150
#--remove_file $MYSQLTEST_VARDIR/tmp/b19216.tmp
1 by brian
clean slate
151
152
#
153
# Bug#17583: mysql drops connection when stdout is not writable
154
#
155
create table t17583 (a int);
156
insert into t17583 (a) values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
157
insert into t17583 select a from t17583;
158
insert into t17583 select a from t17583;
159
insert into t17583 select a from t17583;
160
insert into t17583 select a from t17583;
161
insert into t17583 select a from t17583;
162
insert into t17583 select a from t17583;
163
insert into t17583 select a from t17583;
164
# Close to the minimal data needed to exercise bug.
165
select count(*) from t17583;
166
--exec echo "select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; select count(*) from t17583; " |$MYSQL test >&-
167
drop table t17583;
168
169
#
170
# Bug#20984: Reproducible MySQL client segmentation fault
171
#  + additional tests for the "com_connect" function in mysql
172
#
173
#
174
--echo Test connect without db- or host-name => reconnect
175
--exec $MYSQL test -e "\r" 2>&1
176
--exec $MYSQL test -e "connect" 2>&1
177
178
--echo Test connect with dbname only => new dbname, old hostname
179
--exec $MYSQL test -e "\r test" 2>&1
180
--exec $MYSQL test -e "connect test" 2>&1
181
--exec $MYSQL test -e "\rtest" 2>&1
182
--error 1
183
--exec $MYSQL test -e "connecttest" 2>&1
184
185
--echo Test connect with _invalid_ dbname only => new invalid dbname, old hostname
186
--error 1
187
--exec $MYSQL test -e "\r invalid" 2>&1
188
--error 1
189
--exec $MYSQL test -e "connect invalid" 2>&1
190
191
--echo Test connect with dbname + hostname
685.4.30 by Jay Pipes
Fixes mysql.test. Commented out executable commands which reference the test database, since we don't have one.
192
#--exec $MYSQL test -e "\r test localhost" 2>&1
193
#--exec $MYSQL test -e "connect test localhost" 2>&1
1 by brian
clean slate
194
195
--echo Test connect with dbname + _invalid_ hostname
196
# Mask the errno of the error message
309 by Brian Aker
Merge from Monty
197
#--replace_regex /\([0-9]*\)/(errno)/
198
#--error 1
199
#--exec $MYSQL test -e "\r test invalid_hostname" 2>&1
200
#--replace_regex /\([0-9]*\)/(errno)/
201
#--error 1
202
#--exec $MYSQL test -e "connect test invalid_hostname" 2>&1
203
204
#--echo The commands reported in the bug report
205
#--replace_regex /\([0-9]*\)/(errno)/
206
#--error 1
207
#--exec $MYSQL test -e "\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
208
#
209
##--replace_regex /\([0-9]*\)/(errno)/
210
##--error 1
211
##--exec echo '\r\r\n\r\n cyril\ has\ found\ a\ bug\ :)XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | $MYSQL 2>&1
212
#
213
#--echo Too long dbname
214
#--error 1
215
#--exec $MYSQL test -e "\r test_really_long_dbnamexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx localhost" 2>&1
216
#
217
#--echo Too long hostname
218
#--replace_regex /\([0-9]*\)/(errno)/
219
#--error 1
220
#--exec $MYSQL test -e "\r  test cyrils_superlonghostnameXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" 2>&1
1 by brian
clean slate
221
222
223
#
224
# Bug #21412: mysql cmdline client allows backslash(es) 
225
# as delimiter but can't recognize them
226
#
227
228
# This should work just fine...
309 by Brian Aker
Merge from Monty
229
#--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
230
#DELIMITER /
231
#SELECT 1/
232
#EOF
233
#--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
234
#remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
235
#
236
## This should give an error...
237
#--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
238
#DELIMITER \
239
#EOF
240
#--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
241
#remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
242
#
243
## As should this...
244
#--write_file $MYSQLTEST_VARDIR/tmp/bug21412.sql
245
#DELIMITER \\
246
#EOF
247
#--exec $MYSQL             < $MYSQLTEST_VARDIR/tmp/bug21412.sql 2>&1
248
#remove_file $MYSQLTEST_VARDIR/tmp/bug21412.sql;
249
#
1 by brian
clean slate
250
#
251
# Some coverage of not normally used parts
252
#
253
254
--disable_query_log
685.4.30 by Jay Pipes
Fixes mysql.test. Commented out executable commands which reference the test database, since we don't have one.
255
#--exec $MYSQL test -e "show status" 2>&1 > /dev/null
1 by brian
clean slate
256
--exec $MYSQL --help 2>&1 > /dev/null
257
--exec $MYSQL --version 2>&1 > /dev/null
258
--enable_query_log
259
260
#
261
# bug #26851: Mysql Client --pager Buffer Overflow
262
#
263
264
# allow error 7(invalid argument) since --pager does not always exist in mysql
685.4.30 by Jay Pipes
Fixes mysql.test. Commented out executable commands which reference the test database, since we don't have one.
265
--error 0,1,7
1 by brian
clean slate
266
--exec $MYSQL --pager="540bytelengthstringxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -e "select 1" > /dev/null 2>&1
267
268
#
269
# Bug#29323 mysql client only accetps ANSI encoded files
270
#
309 by Brian Aker
Merge from Monty
271
#--write_file $MYSQLTEST_VARDIR/tmp/bug29323.sql
272
#select "This is a file starting with UTF8 BOM 0xEFBBBF";
273
#EOF
274
#--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug29323.sql 2>&1
275
#remove_file $MYSQLTEST_VARDIR/tmp/bug29323.sql;
1 by brian
clean slate
276
277
--echo End of 5.0 tests
278
279
#
280
# Bug#26780: patch to add auto vertical output option to the cli.
281
#
282
# Make this wide enough that it will wrap almost everywhere.
685.4.30 by Jay Pipes
Fixes mysql.test. Commented out executable commands which reference the test database, since we don't have one.
283
#--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0;"
1 by brian
clean slate
284
# Too short to wrap.
685.4.30 by Jay Pipes
Fixes mysql.test. Commented out executable commands which reference the test database, since we don't have one.
285
#--exec $MYSQL test --auto-vertical-output --table -e "SELECT 1;"
1 by brian
clean slate
286
287
--echo End of tests