Bug #79074 mysqltest fails to properly group an expected error clause and its query
Submitted: 2 Nov 2015 13:24 Modified: 4 Jan 2016 14:18
Reporter: Andrei Elkin Email Updates:
Status: Closed Impact on me:
None 
Category:Tests Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[2 Nov 2015 13:24] Andrei Elkin
Description:
When 

  --error An_expected_error

is separated from the following query merely by the end of if-{}-block mark,
that is by the closing '}', like here

if (1)
{
  --error ER_BAD_TABLE_ERROR
}
DROP TABLE that_does_not_exist_either;

The expected error won't be counted by mysqltest, so the test just [ fail ],
like query 'DROP TABLE that_does_not_exist_either' failed: 1051: Unknown table 'test.that_does_not_exist_either'
Notice 1051 is exactly ER_BAD_TABLE_ERROR.

This mysqltest parsing behaviour does not look correct, and should be
explained and rectified.

How to repeat:
# The first block to work out as expected
--error ER_BAD_TABLE_ERROR
DROP TABLE that_does_not_exist;

# The 2nd to [ fail ], as described
if (1)
{
  --error ER_BAD_TABLE_ERROR
}
DROP TABLE that_does_not_exist_either;

Suggested fix:
Make sure not detach --error from the following query even if
there's '}' closing, or '{' opening symbol or a compound block ahead.
[4 Jan 2016 14:18] Paul DuBois
Fixed in 5.7.11.

Changes for test suite. No changelog entry needed.