[go: up one dir, main page]

Page MenuHomePhabricator

MediaWiki code coverage fails on Zend PHP 7.0 due to a database error
Closed, ResolvedPublic

Description

I have crafted Jenkins job mediawiki-core-code-coverage-php7 which runs the PHPUnit suite with phpdbg on Jessie and with Zend PHP 7.0. It fails with a database error though:

https://integration.wikimedia.org/ci/job/mediawiki-core-code-coverage-php7/7/

mw-dberror.log
Mon Oct 10 8:43:43 UTC 2016     integration-slave-jessie-1004   jenkins_u0_mw-unittest_
  Block::newLoad  [Null]  1       no such table: unittest_ipblocks
  SELECT  * FROM unittest_ipblocks    WHERE ipb_address = 'UTBlockee'  

Mon Oct 10 8:43:57 UTC 2016     integration-slave-jessie-1004   jenkins_u0_mw-unittest_
  User::loadFromDatabase  [Null]  1       no such table: unittest_user
  SELECT * FROM unittest_user    WHERE user_id = '2'  LIMIT 1
mw-exception.log
2016-10-10 08:43:57 integration-slave-jessie-1004 jenkins_u0_mw-unittest_:
  [2605549f1fb07ed4ac21da84] [no req]
  DBQueryError from line 1037 of includes/libs/rdbms/database/Database.php:
    A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
    Query:
      SELECT *  
      FROM unittest_user
      WHERE user_id = '2'  LIMIT 1

Function: User::loadFromDatabase
Error: 1 no such table: unittest_user

 #0 includes/libs/rdbms/database/Database.php(895): Database->reportQueryError(string, integer, string, string, boolean)
 #1 includes/libs/rdbms/database/Database.php(1237): Database->query(string, string)
 #2 includes/libs/rdbms/database/Database.php(1305): Database->select(string, array, array, string, array, array)
 #3 includes/user/User.php(1236): Database->selectRow(string, array, array, string, array)
 #4 includes/user/User.php(480): User->loadFromDatabase(integer)
 #5 includes/libs/objectcache/WANObjectCache.php(880): User->{closure}(boolean, integer, array, NULL)
 #6 includes/libs/objectcache/WANObjectCache.php(997): WANObjectCache->{closure}(boolean, integer, array, NULL)
 #7 includes/libs/objectcache/WANObjectCache.php(883): WANObjectCache->doGetWithSetCallback(string, integer, Closure, array, NULL)
 #8 includes/user/User.php(494): WANObjectCache->getWithSetCallback(string, integer, Closure, array)
 #9 includes/user/User.php(436): User->loadFromCache()
#10 includes/user/User.php(396): User->loadFromId(integer)
#11 includes/user/User.php(2088): User->load()
#12 tests/phpunit/includes/BlockTest.php(18): User->getId()
#13 tests/phpunit/MediaWikiTestCase.php(388): BlockTest->addDBData()
#14 vendor/phpunit/phpunit/src/Framework/TestSuite.php(747): MediaWikiTestCase->run(PHPUnit_Framework_TestResult)
#15 vendor/phpunit/phpunit/src/Framework/TestSuite.php(747): PHPUnit_Framework_TestSuite->run(PHPUnit_Framework_TestResult)
#16 vendor/phpunit/phpunit/src/Framework/TestSuite.php(747): PHPUnit_Framework_TestSuite->run(PHPUnit_Framework_TestResult)
#17 vendor/phpunit/phpunit/src/TextUI/TestRunner.php(440): PHPUnit_Framework_TestSuite->run(PHPUnit_Framework_TestResult)
#18 vendor/phpunit/phpunit/src/TextUI/Command.php(149): PHPUnit_TextUI_TestRunner->doRun(PHPUnit_Framework_TestSuite, array)
#19 vendor/phpunit/phpunit/src/TextUI/Command.php(100): PHPUnit_TextUI_Command->run(array, boolean)
#20 tests/phpunit/phpunit.php(133): PHPUnit_TextUI_Command::main()
#21 maintenance/doMaintenance.php(110): PHPUnitMaintClass->execute()
#22 tests/phpunit/phpunit.php(163): require(string)
#23 {main}

The cloned tables with a unittest_ prefix are not available, either because they are not cloned properly or the test suite somehow switch to a new database connection which would not have the tables available (they are temporary ones).

Event Timeline

And mediawiki db name is MW_DB=jenkins_u0_mw

Not sure, but this could be linked to T155147 - I say that because MediaWikiTestCase::needsDB() and addDBData() are mentionned, just like in the other task. In a nutshell, the other task is about not reinitializing the DB in tests but there are bad interactions between static and non-static methods, and given this task is about tests not initializing the DB, perhaps there are common root causes.

Legoktm subscribed.

This was resolved at some point, running the coverage job on PHP 7 works fine: https://integration.wikimedia.org/ci/job/mediawiki-core-code-coverage-php7/

The coverage result is a bit different though, 21.3% (44784/210421 elements) on PHP 5 versus 20.5% (38354/187470 elements) on PHP 7. But it's also nearly twice as fast, which is probably worth pursuing further.