Bug #83107 InnoDB check in mysql_client_test is implemented incorrectly
Submitted: 22 Sep 2016 20:00 Modified: 6 Jan 2017 15:30
Reporter: Daniel Beer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.6.33 OS:Red Hat (6.6)
Assigned to: CPU Architecture:Any

[22 Sep 2016 20:00] Daniel Beer
Description:
A number of tests in mysql_client_test check if InnoDB is enabled on the server using a global named have_innodb. This global is filled in using the results of a SQL statement, but the result appears to be interpreted incorrectly, resulting in have_innodb always being set to 0.

The SQL statement has one column in the result:
SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') "AS `TRUE` FROM information_schema.engines WHERE engine = 'innodb'

But the code that interprets the results always looks for two rows (mysql_client_fw.c:295):
 if (row[0] && row[1])
 result= strcmp(row[1], "1") == 0;

This causes all tests that rely on InnoDB to be disabled, even if the server supports InnoDB.

How to repeat:
Test "test_bug12243" in mysql_client_test relies on InnoDB, but will never run even if InnoDB is enabled. To replicate, build and run mysql_client_test using this test with mysql 5.6.33:

$ mkdir /tmp/testdb
$ mysql_install_db --datadir=/tmp/testdb
$ mysql_client_test_embedded --server-arg=--datadir=/tmp/testdb test_bug12243

#####################################
client_connect  
#####################################

 Establishing a connection to '' ...OK
Connected to MySQL server version: 5.6.33-embedded-debug (50633)

 Creating a test database 'client_test_db' ...OK

#####################################
1 of (1/1): test_bug12243  
#####################################
This test requires InnoDB.

Suggested fix:
The following patch seems to fix the problem:

Index: mysql-client/tests/mysql_client_fw.c
===================================================================
--- mysql-client.orig/tests/mysql_client_fw.c
+++ mysql-client/tests/mysql_client_fw.c
@@ -292,8 +292,8 @@ static my_bool check_have_innodb(MYSQL *
  row= mysql_fetch_row(res);
  DIE_UNLESS(row);
 
- if (row[0] && row[1])
- result= strcmp(row[1], "1") == 0;
+ if (row[0])
+   result= strcmp(row[0], "1") == 0;
  mysql_free_result(res);
  return result;
 }
[22 Sep 2016 22:17] MySQL Verification Team
Thank you for the bug report.

#####################################
client_connect
#####################################

 Establishing a connection to '' ...OK
Connected to MySQL server version: 5.6.34-embedded-debug (50634)

 Creating a test database 'client_test_db' ...OK

#####################################
1 of (1/1): test_bug12243
#####################################
This test requires InnoDB.
[6 Jan 2017 15:30] Paul DuBois
Posted by developer:
 
Fixed in 5.6.36, 5.7.18, 8.0.1.

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