diff options
author | Andrew McDonnell <bugs@andrewmcdonnell.net> | 2013-02-28 23:17:17 +1030 |
---|---|---|
committer | Andrew McDonnell <bugs@andrewmcdonnell.net> | 2013-02-28 23:17:17 +1030 |
commit | a0ab3d0d37fe53d1888f1456dbab1026583556b5 (patch) | |
tree | 34e8388af2a7a88ff824de1fc2467b1a705d294b /storage/oqgraph | |
parent | ce46146b35601af05d5a36be6f63e3f624d8cb6d (diff) | |
download | mariadb-git-a0ab3d0d37fe53d1888f1456dbab1026583556b5.tar.gz |
Regression test for #1134338 and #1134337 and #1134265
Diffstat (limited to 'storage/oqgraph')
-rw-r--r-- | storage/oqgraph/regressiontest.sql.in | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/storage/oqgraph/regressiontest.sql.in b/storage/oqgraph/regressiontest.sql.in new file mode 100644 index 00000000000..f40acb32fb8 --- /dev/null +++ b/storage/oqgraph/regressiontest.sql.in @@ -0,0 +1,81 @@ +/* How to run me: using the C preprocessor: + * cpp -P regressiontest.sql.in |client/mysql --skip-pager --force --silent test + * + * Expected result: + * 1. No mysqld crash + * 2. Error -1 + * 3. Successful DESCRIBEs where noted + */ + +#define Create_OQ_TABLE(name) \ + CREATE TABLE name ( \ + latch SMALLINT UNSIGNED NULL, \ + origid BIGINT UNSIGNED NULL, \ + destid BIGINT UNSIGNED NULL, \ + weight DOUBLE NULL, \ + seq BIGINT UNSIGNED NULL, \ + linkid BIGINT UNSIGNED NULL, \ + KEY (latch, origid, destid) USING HASH, \ + KEY (latch, destid, origid) USING HASH \ + ) ENGINE=OQGRAPH + +#define Drop(name) DROP TABLE IF EXISTS `name` + +#define P1(x) #x +#define P2(x) P1(x) +#define EXPECT_ERROR_1 select P2(__LINE__) , 'Expect error -1:' +#define EXPECT_SUCCESS(x) select P2(__LINE__) , 'Expect ' x ':' + +/* status*/ +warnings +Drop(not_backing); +Drop(backing); +Drop(oqtable); + +CREATE TABLE `not_backing` ( + `id` int(10) unsigned NOT NULL DEFAULT '0', + `info` varchar(20) DEFAULT NULL, + KEY `name` (`info`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE `backing` ( + `id` int(10) unsigned NOT NULL DEFAULT '0', + `parent` int(10) unsigned DEFAULT NULL, + `weight` real(10,4) NOT NULL DEFAULT 0.0, + `info` varchar(20) DEFAULT NULL, + `not_id_type` varchar(20) DEFAULT NULL, + `not_weight_type` varchar(20) DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `name` (`info`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +/* Attempt to create with no attributes. Fail expcted. */ +select __LINE__ ; Create_OQ_TABLE( oqtable); describe oqtable; + +/* Attempt to create with various attributes missing, but at least one present */ +/* Create will succeed, and then cause describe to fail */ +select 'Attributes test...'; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE=''; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='bogus'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='not_backing'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing'; describe oqtable; +/* attributes are processed insid ha_oqgraph::open left to right. So if dont put data_table in the following they all look the same as data_table=''*/ +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID=''; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='bogus'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='not_id_type'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='id'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='id',DESTID=''; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='id',DESTID='bogus'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='id',DESTID='not_id_type'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='bogus',DESTID='id'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='not_id_type',DESTID='id'; describe oqtable; +EXPECT_SUCCESS('successful DESCRIBE'); Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='id',DESTID='id'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='id',DESTID='id',WEIGHT='bogus'; describe oqtable; +EXPECT_ERROR_1; Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='id',DESTID='id',WEIGHT='not_weight_type'; describe oqtable; +EXPECT_SUCCESS('successful DESCRIBE'); Drop(oqtable); Create_OQ_TABLE( oqtable), DATA_TABLE='backing',ORIGID='id',DESTID='id',WEIGHT='weight'; describe oqtable; +Drop(oqtable); + +/* As at Feb 28, DATA_TABLE='x' does not check if x exists or is wrong structure, on hq_oqgraph::open (describe) + +/* show tables; */ + |