1#------------------------------------------------------------------------------
2# Test mysql_tzinfo_to_sql program against bundled zoneinfo files.
3# The mysql_tzinfo_to_sql program loads the time zone tables in the mysql
4# database. It is used on systems that have a zoneinfo database (the set of
5# files describing time zones).
6# Examples of such systems are Linux, FreeBSD, Solaris, and Mac OS X. One
7# likely location for these files is the /usr/share/zoneinfo directory
8# (/usr/share/lib/zoneinfo on Solaris) This test loads zoneinfo files from
9# std_data/zoneinfo to ensure stability.
10# usage:
11# 1] mysql_tzinfo_to_sql tz_dir
12# 2] mysql_tzinfo_to_sql tz_file tz_name
13# 3] mysql_tzinfo_to_sql --leap tz_file
14# Test aims loading zone tables in the mysql with above command.
15# Data is loaded into zone table from test_zone database instead of mysql
16# database.
17#------------------------------------------------------------------------------
18--source include/not_windows.inc
19# no embeeded run
20--source include/not_embedded.inc
21
22# Create tables zone tables in test_zone database
23CREATE DATABASE test_zone;
24USE test_zone;
25CREATE TABLE time_zone as SELECT * FROM mysql.time_zone WHERE 1 = 0;
26CREATE TABLE time_zone_leap_second as SELECT * FROM mysql.time_zone_leap_second WHERE 1 = 0;
27CREATE TABLE time_zone_name as SELECT * FROM mysql.time_zone_name WHERE 1 = 0;
28CREATE TABLE time_zone_transition as SELECT * FROM mysql.time_zone_transition WHERE 1 = 0;
29CREATE TABLE time_zone_transition_type as SELECT * FROM mysql.time_zone_transition_type WHERE 1 = 0;
30
31--echo # Load zone table for Japanese zones. (mysql_tzinfo_to_sql std_data/Japan test_japan).
32--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/std_data/Japan test_japan >$MYSQLTEST_VARDIR/tmp/loadzonefile.sql
33--source $MYSQLTEST_VARDIR/tmp/loadzonefile.sql
34
35--echo # Load Moscow zone table with --leap option. (mysql_tzinfo_to_sql --leap std_data/Moscow_leap)
36--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/std_data/Moscow_leap >$MYSQLTEST_VARDIR/tmp/loadzonefile.sql
37--source $MYSQLTEST_VARDIR/tmp/loadzonefile.sql
38
39--echo # Load zone table files in Europe folder. (mysql_tzinfo_to_sql std_data/Europe)
40--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/std_data/Europe >$MYSQLTEST_VARDIR/tmp/loadzonefile.sql
41--source $MYSQLTEST_VARDIR/tmp/loadzonefile.sql
42
43# Load timezone info file with garbage content
44--error 1
45--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/std_data/Factory test_junk_content
46
47# Cleanup
48DROP DATABASE test_zone;
49--remove_file $MYSQLTEST_VARDIR/tmp/loadzonefile.sql
50