Bug #59555 mtr prints wrong file and line number when tests fail
Submitted: 17 Jan 2011 14:46 Modified: 25 Apr 2017 13:26
Reporter: Sven Sandberg Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S7 (Test Cases)
Version:5.1+ OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any

[17 Jan 2011 14:46] Sven Sandberg
Description:
When a test case fails, mtr sometimes prints the wrong line number. This seems to happen if the test fails inside a while loop and it is not the first iteration of the loop. Maybe there are other cases too.

This was previously reported as one half of BUG#59002, but that bug was closed since a fix to the first half of BUG#59002 was pushed.

How to repeat:
--let $i = 2
while ($i) {
  dec $i;
  if (!$i) {
    execute this nonsense query on line 5;
  }
}

When executing the above test case, MTR fails with the following message:

mysqltest: At line 7: query 'execute this nonsense query on line 5' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nonsense query on line 5' at line 1

Note that the error was on line 5 but the test reports line 7.
[17 Jan 2011 16:09] Valeriy Kravchuk
Verified with current mysql-5.1 tree on Mac OS X:

macbook-pro:mysql-test openxs$ ./mtr bug59555
Logging: ./mtr  bug59555
110117 18:07:44 [Warning] Setting lower_case_table_names=2 because file system for /var/folders/dX/dXCzvuSlHX4Op1g-o1jIWk+++TI/-Tmp-/YnGpzBhvOF/ is case insensitive
110117 18:07:44 [Note] Plugin 'FEDERATED' is disabled.
110117 18:07:44 [Note] Plugin 'ndbcluster' is disabled.
MySQL Version 5.1.56
Checking supported features...
 - skipping ndbcluster
 - SSL connections supported
 - binaries are debug compiled
Collecting tests...
vardir: /Users/openxs/dbs/5.1/mysql-test/var
Checking leftover processes...
Removing old var directory...
Creating var directory '/Users/openxs/dbs/5.1/mysql-test/var'...
Installing system database...
Using server port 51257

==============================================================================

TEST                                      RESULT   TIME (ms)
------------------------------------------------------------

worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 13000..13009
main.bug59555                            [ fail ]
        Test ended at 2011-01-17 18:07:50

CURRENT_TEST: main.bug59555
mysqltest: At line 7: query 'execute this nonsense query on line 5' failed: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'nonsense query on line 5' at line 1
...
[20 Mar 2015 13:28] Sven Sandberg
Posted by developer:
 
Update: this is still reproducible in all trees now.
[25 Apr 2017 13:26] Paul DuBois
Posted by developer:
 
Fixed in 8.0.2.

Work was done for test suite. No changelog entry needed.