mariadb/mysql-test/suite/tokudb.change_column/t/change_bin.py
Rich Prohaska c4ddc9d9ea refs #5333 replace table data diff for hot column expansion tests
git-svn-id: file:///svn/mysql/tests/mysql-test@47647 c7de825b-a66e-492c-adef-691d508d4ae1
2012-09-10 22:18:49 +00:00

37 lines
1.3 KiB
Python

#!/usr/bin/env python
# generate alter table test cases for char types
import sys
def gen_test(n):
print "CREATE TABLE t (a BINARY(%d));" % (n)
for v in [ 0, 1, 2, 4, 8, 16, 32, 64, 126, 127 ]:
print "INSERT INTO t VALUES (%d);" % (v)
for i in range(2,256):
if i < n:
print "--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/"
print "--error ER_UNSUPPORTED_EXTENSION"
else:
print "CREATE TABLE ti LIKE t;"
print "ALTER TABLE ti ENGINE=myisam;"
print "INSERT INTO ti SELECT * FROM t;"
print "ALTER TABLE ti CHANGE COLUMN a a BINARY(%d);" % (i)
print "ALTER TABLE t CHANGE COLUMN a a BINARY(%d);" % (i)
if i >= n:
print "let $diff_tables=test.t, test.ti;"
print "source include/diff_tables.inc;"
print "DROP TABLE ti;"
print "DROP TABLE t;"
def main():
print "# this test is generated by change_bin.py"
print "--disable_warnings"
print "DROP TABLE IF EXISTS t,ti;"
print "--enable_warnings"
print "SET SESSION DEFAULT_STORAGE_ENGINE=\"TokuDB\";"
print "SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;"
# all n takes too long to run, so here is a subset of tests
for n in [ 1, 2, 3, 4, 5, 6, 7, 8, 16, 31, 32, 63, 64, 127, 128, 254, 255 ]:
gen_test(n)
return 0
sys.exit(main())