1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Created suites for heap, archive and csv.

Moved test from main suite to the new suites.
Move tests from maria/t and maria/r to maria

mysql-test/mysql-test-run.pl:
  Added support for the new suites
This commit is contained in:
Michael Widenius
2012-04-04 00:16:38 +03:00
parent 34ed8f3379
commit b04c4801b0
110 changed files with 12 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,40 @@
# ===== csv_alter_table.1 =====
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
ALTER TABLE t1 ADD COLUMN b CHAR(5) NOT NULL;
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
b char(5) NO NULL
ALTER TABLE t1 DROP COLUMN b;
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
ALTER TABLE t1 MODIFY a BIGINT NOT NULL;
DESC t1;
Field Type Null Key Default Extra
a bigint(20) NO NULL
ALTER TABLE t1 CHANGE a a INT NOT NULL;
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
DROP TABLE t1;
# ===== csv_alter_table.2 =====
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
ALTER TABLE t1 ADD COLUMN b CHAR(5);
ERROR 42000: The storage engine for the table doesn't support nullable columns
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
ALTER TABLE t1 MODIFY a BIGINT;
ERROR 42000: The storage engine for the table doesn't support nullable columns
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
ALTER TABLE t1 CHANGE a a INT;
ERROR 42000: The storage engine for the table doesn't support nullable columns
DESC t1;
Field Type Null Key Default Extra
a int(11) NO NULL
DROP TABLE t1;

View File

@ -0,0 +1,56 @@
#-----------------------------------------------------------------------------
# csv_alter_table.test - .test file for MySQL regression suite
# Purpose: To test the behavior of the CSV engine
# Bug#31473 resulted in strict enforcement of non-nullable
# columns in CSV engine.
# Tests code for Bug#33696 - CSV engine allows NULLable
# Columns via ALTER TABLE statements
#
# Author pcrews
# Last modified: 2008-01-06
#-----------------------------------------------------------------------------
--source include/have_csv.inc
#############################################################################
# Testcase csv_alter_table.1: Positive test for ALTER table
#
#############################################################################
-- echo # ===== csv_alter_table.1 =====
-- disable_warnings
DROP TABLE IF EXISTS t1;
-- enable_warnings
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
ALTER TABLE t1 ADD COLUMN b CHAR(5) NOT NULL;
DESC t1;
ALTER TABLE t1 DROP COLUMN b;
DESC t1;
ALTER TABLE t1 MODIFY a BIGINT NOT NULL;
DESC t1;
ALTER TABLE t1 CHANGE a a INT NOT NULL;
DESC t1;
DROP TABLE t1;
#############################################################################
# Testcase csv_alter_table.2: Negative test for ALTER table
# These queries should not succeed / should throw errors
#############################################################################
-- echo # ===== csv_alter_table.2 =====
-- disable_warnings
DROP TABLE IF EXISTS t1;
-- enable_warnings
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
--error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 ADD COLUMN b CHAR(5);
DESC t1;
--error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 MODIFY a BIGINT;
DESC t1;
--error ER_CHECK_NOT_IMPLEMENTED
ALTER TABLE t1 CHANGE a a INT;
DESC t1;
DROP TABLE t1;

View File

@ -0,0 +1,57 @@
# ===== csv_not_null.1 =====
DROP TABLE IF EXISTS t1, t2;
# === Will fail -- no NOT NULL ===
CREATE TABLE t1 (a int) ENGINE = CSV;
ERROR 42000: The storage engine for the table doesn't support nullable columns
# === Good CREATE ===
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
# === Will fail -- ALL columns need NOT NULL ==
CREATE TABLE t2 (a int NOT NULL, b char(20)) ENGINE = CSV;
ERROR 42000: The storage engine for the table doesn't support nullable columns
DROP TABLE t1;
# ===== csv_not_null.2 =====
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int NOT NULL, b blob NOT NULL, c CHAR(20) NOT NULL,
d VARCHAR(20) NOT NULL, e enum('foo','bar') NOT NULL,f DATE NOT NULL)
ENGINE = CSV;
# === should result in default for each datatype ===
INSERT INTO t1 VALUES();
SELECT * FROM t1;
a b c d e f
0 foo 0000-00-00
INSERT INTO t1 VALUES(default,default,default,default,default,default);
SELECT * FROM t1;
a b c d e f
0 foo 0000-00-00
0 foo 0000-00-00
INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31');
SELECT * FROM t1;
a b c d e f
0 foo 0000-00-00
0 foo 0000-00-00
0 abc def ghi bar 1999-12-31
# === insert failures ===
INSERT INTO t1 VALUES(NULL,'ab','a','b','foo','2007-01-01');
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 VALUES(default(a),default(b), default(c), default(d),
default(e), default(f));
ERROR HY000: Field 'a' doesn't have a default value
DROP TABLE t1;
# ===== csv_not_null.3 =====
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a int NOT NULL, b char(10) NOT NULL) ENGINE = CSV;
INSERT INTO t1 VALUES();
SELECT * FROM t1;
a b
0
UPDATE t1 set b = 'new_value' where a = 0;
SELECT * FROM t1;
a b
0 new_value
UPDATE t1 set b = NULL where b = 'new_value';
Warnings:
Warning 1048 Column 'b' cannot be null
SELECT * FROM t1;
a b
0
DROP TABLE t1;

View File

@ -0,0 +1,97 @@
#-----------------------------------------------------------------------------
# csv_not_null.test - .test file for MySQL regression suite
# Purpose: To test the behavior of the CSV engine
# Bug#31473 resulted in strict enforcement of non-nullable
# columns in CSV engine.
# NOTE: Main functionality tested - NOT NULL restrictions on CSV tables
# CREATE, INSERT, and UPDATE statements
# ALTER statements in separate file due to BUG#33696
# Author pcrews
# Last modified: 2008-01-04
#-----------------------------------------------------------------------------
--source include/have_csv.inc
#############################################################################
# Testcase csv_not_null.1: CREATE TABLE for CSV Engine requires explicit
# NOT NULL for each column
#############################################################################
-- echo # ===== csv_not_null.1 =====
-- disable_warnings
DROP TABLE IF EXISTS t1, t2;
-- enable_warnings
--echo # === Will fail -- no NOT NULL ===
--error ER_CHECK_NOT_IMPLEMENTED
CREATE TABLE t1 (a int) ENGINE = CSV;
--echo # === Good CREATE ===
CREATE TABLE t1 (a int NOT NULL) ENGINE = CSV;
--echo # === Will fail -- ALL columns need NOT NULL ==
--error ER_CHECK_NOT_IMPLEMENTED
CREATE TABLE t2 (a int NOT NULL, b char(20)) ENGINE = CSV;
DROP TABLE t1;
##############################################################################
# Testcase csv_not_null.2: INSERT tests -- validating behavior of INSERT
# statements for CSV
##############################################################################
-- echo # ===== csv_not_null.2 =====
-- disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a int NOT NULL, b blob NOT NULL, c CHAR(20) NOT NULL,
d VARCHAR(20) NOT NULL, e enum('foo','bar') NOT NULL,f DATE NOT NULL)
ENGINE = CSV;
-- echo # === should result in default for each datatype ===
-- disable_warnings
INSERT INTO t1 VALUES();
-- enable_warnings
SELECT * FROM t1;
-- disable_warnings
# Bug#33717 - INSERT...(default) fails for enum.
INSERT INTO t1 VALUES(default,default,default,default,default,default);
-- enable_warnings
SELECT * FROM t1;
INSERT INTO t1 VALUES(0,'abc','def','ghi','bar','1999-12-31');
SELECT * FROM t1;
-- echo # === insert failures ===
--error ER_BAD_NULL_ERROR
INSERT INTO t1 VALUES(NULL,'ab','a','b','foo','2007-01-01');
--error ER_NO_DEFAULT_FOR_FIELD
INSERT INTO t1 VALUES(default(a),default(b), default(c), default(d),
default(e), default(f));
DROP TABLE t1;
##############################################################################
# Testcase csv_not_null.3: UPDATE tests -- examining behavior of UPDATE
# statements for CSV
##############################################################################
-- echo # ===== csv_not_null.3 =====
-- disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
CREATE TABLE t1 (a int NOT NULL, b char(10) NOT NULL) ENGINE = CSV;
--disable_warnings
INSERT INTO t1 VALUES();
--enable_warnings
SELECT * FROM t1;
--disable_warnings
UPDATE t1 set b = 'new_value' where a = 0;
--enable_warnings
SELECT * FROM t1;
UPDATE t1 set b = NULL where b = 'new_value';
SELECT * FROM t1;
DROP TABLE t1;