Skip to content

Commit 6d96d33

Browse files
author
Luis Soares
committed
BUG#48738: post-push fix. Multi-platform test improvements, mainly
to make the test run gracefully on windows. There was also a syntax error in windows part of the test.
1 parent b640b8f commit 6d96d33

File tree

2 files changed

+29
-80
lines changed

2 files changed

+29
-80
lines changed

mysql-test/r/binlog_delete_and_flush_index.result

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ RESET MASTER;
22
CREATE TABLE t1 (a int);
33
### assertion: index file contains regular entries
44
SET @index=LOAD_FILE('MYSQLD_DATADIR/master-bin.index');
5-
master-bin.000001
5+
SELECT @index;
6+
@index
7+
MYSQLD_DATADIR/master-bin.000001
68

79
### assertion: show original binlogs
810
show binary logs;
@@ -15,8 +17,10 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a int)
1517
FLUSH LOGS;
1618
### assertion: index file contains renamed binlog and the new one
1719
SET @index=LOAD_FILE('MYSQLD_DATADIR/master-bin.index');
18-
master-bin-b34582.000001
19-
master-bin.000002
20+
SELECT @index;
21+
@index
22+
MYSQLD_DATADIR/master-bin-b34582.000001
23+
MYSQLD_DATADIR/master-bin.000002
2024

2125
### assertion: original binlog content still exists, despite we
2226
### renamed and changed the index file
@@ -39,6 +43,8 @@ master-bin.000002 #
3943
### assertion: assert that not purged binlog file exists
4044
### assertion: show index file contents and these should match show binary logs issued above
4145
SET @index=LOAD_FILE('MYSQLD_DATADIR/master-bin.index');
42-
master-bin.000002
46+
SELECT @index;
47+
@index
48+
MYSQLD_DATADIR/master-bin.000002
4349

4450
RESET MASTER;

mysql-test/t/binlog_delete_and_flush_index.test

Lines changed: 19 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,10 @@ RESET MASTER;
4545
CREATE TABLE t1 (a int);
4646

4747
-- echo ### assertion: index file contains regular entries
48-
-- replace_regex /[\\\/].*master/MYSQLD_DATADIR\/master/
48+
-- replace_result $datadir MYSQLD_DATADIR
4949
-- eval SET @index=LOAD_FILE('$index')
50-
if (`SELECT convert(@@version_compile_os using latin1)
51-
IN ('Win32','Win64','Windows')`)
52-
{
53-
-- disable_query_log
54-
-- disable_result_log
55-
-- let $a= `SELECT REPLACE (@index, '$datadir\', '')`
56-
-- enable_result_log
57-
-- enable_query_log
58-
59-
-- echo $a
60-
61-
}
62-
if (!`SELECT convert(@@version_compile_os using latin1)
63-
IN ('Win32','Win64','Windows')`)
64-
{
65-
-- disable_query_log
66-
-- disable_result_log
67-
-- let $a= `SELECT REPLACE (@index, '$datadir/', '')`
68-
-- enable_result_log
69-
-- enable_query_log
70-
71-
-- echo $a
72-
}
50+
-- replace_result $datadir MYSQLD_DATADIR
51+
SELECT @index;
7352

7453
--echo ### assertion: show original binlogs
7554
-- source include/show_binary_logs.inc
@@ -79,49 +58,34 @@ if (!`SELECT convert(@@version_compile_os using latin1)
7958

8059
# action: copy binlogs to other names and change entries in index file
8160
-- copy_file $datadir/master-bin.000001 $datadir/master-bin-b34582.000001
82-
-- let newbinfile=$datadir/master-bin-b34582.000001
83-
let INDEX_FILE=$index;
61+
-- let newbinfile= $datadir/master-bin-b34582.000001
62+
-- let INDEX_FILE= $index
8463
perl;
85-
$newbinfile= $ENV{'newbinfile'};
64+
use File::Spec;
65+
$newbinfile= File::Spec->rel2abs($ENV{'newbinfile'});
8666
$file= $ENV{'INDEX_FILE'};
8767
open(FILE, ">$file") || die "Unable to open $file.";
8868
truncate(FILE,0);
89-
print FILE $newbinfile . "\n";
69+
print FILE "$newbinfile";
9070
close ($file);
9171
EOF
9272

73+
# append a new line (platform independent)
74+
-- append_file $index
75+
76+
EOF
77+
9378
# action: should cause rotation, and creation of new binlogs
9479
FLUSH LOGS;
9580

9681
# file is not used anymore - remove it (mysql closed on flush logs).
9782
-- remove_file $datadir/master-bin.000001
9883

9984
-- echo ### assertion: index file contains renamed binlog and the new one
100-
-- replace_regex /[\\\/].*master/MYSQLD_DATADIR\/master/
85+
-- replace_result $datadir MYSQLD_DATADIR
10186
-- eval SET @index=LOAD_FILE('$index')
102-
if (`SELECT convert(@@version_compile_os using latin1)
103-
IN ('Win32','Win64','Windows')`)
104-
{
105-
-- disable_query_log
106-
-- disable_result_log
107-
-- let $a= `SELECT REPLACE (@index, '$datadir\', '')`
108-
-- enable_result_log
109-
-- enable_query_log
110-
111-
-- echo $a
112-
113-
}
114-
if (!`SELECT convert(@@version_compile_os using latin1)
115-
IN ('Win32','Win64','Windows')`)
116-
{
117-
-- disable_query_log
118-
-- disable_result_log
119-
-- let $a= `SELECT REPLACE (@index, '$datadir/', '')`
120-
-- enable_result_log
121-
-- enable_query_log
122-
123-
-- echo $a
124-
}
87+
-- replace_result $datadir MYSQLD_DATADIR
88+
SELECT @index;
12589

12690
-- echo ### assertion: original binlog content still exists, despite we
12791
-- echo ### renamed and changed the index file
@@ -147,30 +111,9 @@ DROP TABLE t1;
147111
-- file_exists $datadir/$current_binlog
148112

149113
-- echo ### assertion: show index file contents and these should match show binary logs issued above
150-
-- replace_regex /[\\\/].*master/MYSQLD_DATADIR\/master/
114+
-- replace_result $datadir MYSQLD_DATADIR
151115
-- eval SET @index=LOAD_FILE('$index')
152-
if (`SELECT convert(@@version_compile_os using latin1)
153-
IN ('Win32','Win64','Windows')`)
154-
{
155-
-- disable_query_log
156-
-- disable_result_log
157-
-- let $a= `SELECT REPLACE (@index, '$datadir\', '')`
158-
-- enable_result_log
159-
-- enable_query_log
160-
161-
-- echo $a
162-
163-
}
164-
if (!`SELECT convert(@@version_compile_os using latin1)
165-
IN ('Win32','Win64','Windows')`)
166-
{
167-
-- disable_query_log
168-
-- disable_result_log
169-
-- let $a= `SELECT REPLACE (@index, '$datadir/', '')`
170-
-- enable_result_log
171-
-- enable_query_log
172-
173-
-- echo $a
174-
}
116+
-- replace_result $datadir MYSQLD_DATADIR
117+
SELECT @index;
175118

176119
RESET MASTER;

0 commit comments

Comments
 (0)