Bug #48863 mysql test: enable and disable case insensitive compare mode
Submitted: 18 Nov 2009 12:29 Modified: 17 Jun 2010 19:42
Reporter: Jørgen Austvik Email Updates:
Status: Closed Impact on me:
Category:Tools: MTR / mysql-test-run Severity:S4 (Feature request)
Version: OS:Any
Assigned to: Bjørn Munch CPU Architecture:Any

[18 Nov 2009 12:29] Jørgen Austvik

E.g. with "lower-case-table-names = 2", upper case table names can be returned in error messages in lower case, while the correct table name is upper case. If the same test is run on "lower-case-table-names = 0", the table name in an error string will be in the correct upper case.

For some tables (e.g. information_schema, performance_schema) the test is not free to select table names for it self.

This means we have to use include/have_lower0.inc for some of these test, which lessens the code coverage for platforms with lower-case-table-names = 2.

Possible Solution?

If we could add some settings to the mysql test language that toggled case sensitive and case insensitive comparison of the output for regions of the test, we could get some better coverage on some platforms, and make writing tests a little easier for some cases.

How to repeat:

Suggested fix:
Add --set-case-insensitive-compare and --set-case-sensitive-compare to the mysql test language
[18 Nov 2009 12:52] Bjørn Munch
This is not possible as suggested; comparison is not done by mysqltest itself but by external diff of the whole output.

What we could do, is to add commands to turn on or off conversion of all output to lower case, then the result would be independent of original case.
[18 Nov 2009 13:12] Jørgen Austvik
There are at least three ways to do this:
1. split up the output in snippets which starts and stops on each -set-case[in]sensitive-compare, run diff with and without -i on the correct parts.
2. send all output through a process that reads from stdin and writes to stdout. when this process receives a signal it will lowercase everything, when it receives another signal it will stop to transform the input.
3. preserve have the --set-case[in]sensitive markers in the result file, post-process it by removing the markers and lowercasing the correct parts before running diff.
[19 Nov 2009 15:53] Marc ALFF
GNU diff has an --ignore-case option ...

The option name might be different for other diff implementations,
but it is very likely that there is an equivalent.
[19 Nov 2009 16:08] Bjørn Munch
We cannot depend on options that may or may not be available and may work this way or that, and mysqltest also needs to work if we have NO diff available. Besides, this solution would ignore case differences for all of the output; we would not have the option to turn it on and off.
[23 Nov 2009 9:46] Bjørn Munch
Another alternative: if this problem only affects a few isolated statements (and not a long sequence of them), we could offer something similar to replace_result which applies only to the following statement. E.g. "--convert-to-lower" would convert the output of the *next* statement to lower case.
[9 Dec 2009 12:47] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

[6 Jan 2010 8:43] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

[6 Jan 2010 13:47] Bjørn Munch
Pushed to 5.1-mtr, trunk-mtr, next-mr-mtr, 6.0-codebase-mtr
[20 Feb 2010 9:32] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100220092844-jh07ayojyxn8uh9p) (version source revid:bjorn.munch@sun.com-20100106093632-yy2ts5rndk3cchvm) (merge vers: 6.0.14-alpha) (pib:16)
[20 Feb 2010 9:34] Bugs System
Pushed into 5.5.3-m2 (revid:alik@sun.com-20100220092622-wvhh1vfy5tjq4mhu) (version source revid:bjorn.munch@sun.com-20100106085744-tr26s8escdaiu7ky) (merge vers: 5.5.1-m2) (pib:16)
[20 Feb 2010 9:37] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100220092730-paoo5t9gcajs5dq8) (version source revid:bjorn.munch@sun.com-20100106090111-s6smcs0si1ohiiu5) (pib:16)
[22 Feb 2010 20:27] Paul DuBois
Noted in 5.5.3, 6.0.14 changelogs.

mysqltest now has a new lowercase_result command that converts the
output of the next statement to lowercase. This is useful for test
cases where the lettercase may vary between platforms. 

Setting report to Need Merge pending push to 5.1.x, Celosia.
[1 Mar 2010 8:46] Bugs System
Pushed into 5.1.45 (revid:joro@sun.com-20100301083827-xnimmrjg6bh33o1o) (version source revid:azundris@mysql.com-20100222175719-viuh0f3gdsrkgv0r) (merge vers: 5.1.45) (pib:16)
[1 Mar 2010 16:28] Paul DuBois
Noted in 5.1.45 changelog.
[17 Jun 2010 11:59] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:39] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:martin.skold@mysql.com-20100609140708-52rvuyq4q500sxkq) (merge vers: 5.1.45-ndb-6.2.19) (pib:16)
[17 Jun 2010 13:25] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)