~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/symlink.test

  • Committer: Stewart Smith
  • Date: 2009-06-16 00:45:15 UTC
  • mto: (1119.2.6 merge)
  • mto: This revision was merged to the branch mainline in revision 1124.
  • Revision ID: stewart@flamingspork.com-20090616004515-bgr8e62psvn2820l
make snowman test not leave tables behind after running

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--source include/have_symlink.inc
 
2
#--source include/not_windows.inc
 
3
 
 
4
--disable_warnings
 
5
drop table if exists t1,t2,t7,t8,t9;
 
6
drop database if exists mysqltest;
 
7
--enable_warnings
 
8
 
 
9
#
 
10
# First create little data to play with
 
11
#
 
12
 
 
13
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a));
 
14
create table t2 (a int not null auto_increment, b char(16) not null, primary key (a));
 
15
insert into t1 (b) values ("test"),("test1"),("test2"),("test3");
 
16
insert into t2 (b) select b from t1;
 
17
insert into t1 (b) select b from t2;
 
18
insert into t2 (b) select b from t1;
 
19
insert into t1 (b) select b from t2;
 
20
insert into t2 (b) select b from t1;
 
21
insert into t1 (b) select b from t2;
 
22
insert into t2 (b) select b from t1;
 
23
insert into t1 (b) select b from t2;
 
24
insert into t2 (b) select b from t1;
 
25
insert into t1 (b) select b from t2;
 
26
insert into t2 (b) select b from t1;
 
27
insert into t1 (b) select b from t2;
 
28
insert into t2 (b) select b from t1;
 
29
insert into t1 (b) select b from t2;
 
30
insert into t2 (b) select b from t1;
 
31
insert into t1 (b) select b from t2;
 
32
insert into t2 (b) select b from t1;
 
33
insert into t1 (b) select b from t2;
 
34
drop table t2;
 
35
 
 
36
#
 
37
# Start the test
 
38
# We use t9 here to not crash with tables generated by the backup test
 
39
 
40
 
 
41
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
42
eval create temporary table t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="$MYSQLTEST_VARDIR/tmp" index directory="$MYSQLTEST_VARDIR/run";
 
43
 
 
44
insert into t9 select * from t1;
 
45
check table t9;
 
46
optimize table t9;
 
47
SET GLOBAL myisam_sort_buffer_size=1024;
 
48
check table t9;
 
49
alter table t9 add column c int not null;
 
50
 
 
51
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
52
show create table t9;
 
53
 
 
54
# Test renames
 
55
alter table t9 rename t8, add column d int not null;
 
56
alter table t8 rename t7;
 
57
# because "rename table t7 to t9" should obviously not support temp tables. GAH
 
58
alter table t7 rename t9;
 
59
# Drop old t1 table, keep t9
 
60
drop table t1;
 
61
 
 
62
#
 
63
# Test error handling
 
64
# Note that we are using the above table t9 here!
 
65
#
 
66
 
 
67
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
68
SHOW CREATE TABLE t9;
 
69
 
 
70
--error 1103,1103
 
71
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam data directory="tmp";
 
72
 
 
73
# Check that we cannot link over a table from another database.
 
74
 
 
75
create database mysqltest;
 
76
 
 
77
--error 1,1
 
78
create temporary table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="/this-dir-does-not-exist";
 
79
 
 
80
--error 1103,1103
 
81
create temporary table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) engine=myisam index directory="not-hard-path";
 
82
 
 
83
# Check moving table t9 from default database to mysqltest;
 
84
# In this case the symlinks should be removed.
 
85
 
 
86
alter table t9 rename mysqltest.t9;
 
87
select count(*) from mysqltest.t9;
 
88
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
89
show create table mysqltest.t9;
 
90
drop database mysqltest;
 
91
 
 
92
#
 
93
# Test changing data dir (Bug #1662)
 
94
#
 
95
 
 
96
create temporary table t1 (a int not null) engine=myisam;
 
97
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
98
eval alter table t1 data directory="$MYSQLTEST_VARDIR/tmp";
 
99
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
100
show create table t1;
 
101
alter table t1 add b int;
 
102
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
103
eval alter table t1 data directory="$MYSQLTEST_VARDIR/log";
 
104
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
105
show create table t1;
 
106
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
107
eval alter table t1 index directory="$MYSQLTEST_VARDIR/log";
 
108
show create table t1;
 
109
drop table t1;
 
110
 
 
111
#
 
112
# Bug#8706 - temporary table with data directory option fails
 
113
#
 
114
connect (session1,localhost,root,,);
 
115
connect (session2,localhost,root,,);
 
116
 
 
117
connection session1;
 
118
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
119
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 9 a;
 
120
# If running test suite with a non standard tmp dir, the "show create table"
 
121
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
 
122
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
123
show create table t1;
 
124
 
 
125
connection session2;
 
126
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
127
eval create temporary table t1 (a int) engine=myisam data directory="$MYSQLTEST_VARDIR/log" select 99 a;
 
128
# If running test suite with a non standard tmp dir, the "show create table"
 
129
# will print "DATA_DIRECTORY=". Use replace_result to mask it out
 
130
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
131
show create table t1;
 
132
 
 
133
connection default;
 
134
 
 
135
--echo End of 4.1 tests
 
136
 
 
137
--echo End of 5.0 tests
 
138
 
 
139
#
 
140
# Bug 311013 - specifying non existent directory does not give an error
 
141
# We use the ARCHIVE engine instead of MyISAM here for testing the data
 
142
# directory option since the file names output by MyISAM are always 
 
143
# different so the output would be non-deterministic
 
144
#
 
145
--error 1005
 
146
eval CREATE TABLE t1(a INT) engine=archive
 
147
DATA DIRECTORY='/foo/bar/far';
 
148
 
 
149
# BUG#25677 - With --skip-symbolic-links option on, DATA DIRECTORY clause is
 
150
#             silently ignored
 
151
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
152
--error 1478
 
153
eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='$MYSQLTEST_VARDIR/tmp';
 
154
 
 
155
--echo End of 5.1 tests
 
156
SET GLOBAL myisam_sort_buffer_size=DEFAULT;