| Bug #59794 | Enable unit testing of classes which depend on a working THD environment | ||
|---|---|---|---|
| Submitted: | 28 Jan 2011 12:38 | Modified: | 1 Feb 2011 15:47 |
| Reporter: | Tor Didriksen | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Tests | Severity: | S3 (Non-critical) |
| Version: | OS: | Any | |
| Assigned to: | Tor Didriksen | CPU Architecture: | Any |
[28 Jan 2011 13:37]
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: http://lists.mysql.com/commits/129870 3563 Tor Didriksen 2011-01-28 Bug #59794 Enable unit testing of classes which depend on a working THD environment Large parts of the codebase depend on a THD instance in order to be tested. The THD needs to be modified, so it can be used in unit tests. Some global initialization also needs to be done. @ include/my_global.h MY_INTnn_NUM_DECIMAL_DIGITS are always used in unsigned context. @ sql/mysqld.cc init_thread_environment() must be callable by unit tests. @ sql/mysqld.h init_thread_environment() must be callable by unit tests. @ sql/sql_class.cc Disable plugins for unit tests. @ sql/sql_class.h Disable plugins for unit tests. @ sql/sql_plugin.cc Disable plugins for unit tests. @ unittest/gunit/CMakeLists.txt Add new linkage rules for unit tests which depend on server libraries. @ unittest/gunit/item-t.cc New unit test.
[1 Feb 2011 7:53]
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: http://lists.mysql.com/commits/130099 3583 Tor Didriksen 2011-02-01 Bug #59794 Enable unit testing of classes which depend on a working THD environment Large parts of the codebase depend on a THD instance in order to be tested. The THD needs to be modified, so it can be used in unit tests. Some global initialization also needs to be done: - init_thread_environment() - randominit() - xid_cache_init() - delegates_init() @ include/my_global.h MY_INTnn_NUM_DECIMAL_DIGITS are always used in unsigned context. @ sql/mysqld.cc init_thread_environment() must be callable by unit tests. @ sql/mysqld.h init_thread_environment() must be callable by unit tests. @ sql/sql_class.cc Disable plugins for unit tests. @ sql/sql_class.h Disable plugins for unit tests. @ sql/sql_plugin.cc Disable plugins for unit tests. @ unittest/gunit/CMakeLists.txt Add new linkage rules for unit tests which depend on server libraries. @ unittest/gunit/item-t.cc New unit test.
[1 Feb 2011 7:53]
Bugs System
Pushed into mysql-trunk 5.6.2 (revid:tor.didriksen@oracle.com-20110201075246-uf0bppayywpvtgr7) (version source revid:tor.didriksen@oracle.com-20110201075246-uf0bppayywpvtgr7) (merge vers: 5.6.2) (pib:24)
[1 Feb 2011 15:47]
Paul DuBois
Changes for test suite. No changelog entry needed.

Description: Large parts of the codebase depend on a THD instance in order to be tested. The THD needs to be modified, so it can be used in unit tests. Some global initialization also needs to be done. How to repeat: Try to compile and run { Item_int *item_int= new Item_int(42); } in a unit test. Suggested fix: In THD: Do not load/unload plugins when running unit tests. Make some of the initialization functions in mysqld.cc accessible (i.e. non-static)