MediaWikiTestCase now calls wfProfileIn/wfProfileOut for each call
to a test function. This makes it easy to track down slow tests.
Change-Id: I5ff2fea957c082f41da37936fe44948ad006f573
}
public function run( array $argv, $exit = true ) {
}
public function run( array $argv, $exit = true ) {
+ wfProfileIn( __METHOD__ );
+
$ret = parent::run( $argv, false );
$ret = parent::run( $argv, false );
+ wfProfileOut( __METHOD__ );
+
// Return to real wiki db, so profiling data is preserved
MediaWikiTestCase::teardownTestDB();
// Return to real wiki db, so profiling data is preserved
MediaWikiTestCase::teardownTestDB();
*/
ObjectCache::$instances[CACHE_DB] = new HashBagOStuff;
*/
ObjectCache::$instances[CACHE_DB] = new HashBagOStuff;
+ $needsResetDB = false;
+ $logName = get_class( $this ) . '::' . $this->getName( false );
+
if( $this->needsDB() ) {
// set up a DB connection for this test to use
if( $this->needsDB() ) {
// set up a DB connection for this test to use
$this->checkDbIsSupported();
if( !self::$dbSetup ) {
$this->checkDbIsSupported();
if( !self::$dbSetup ) {
+ wfProfileIn( $logName . ' (clone-db)' );
+
// switch to a temporary clone of the database
self::setupTestDB( $this->db, $this->dbPrefix() );
if ( ( $this->db->getType() == 'oracle' || !self::$useTemporaryTables ) && self::$reuseDB ) {
$this->resetDB();
}
// switch to a temporary clone of the database
self::setupTestDB( $this->db, $this->dbPrefix() );
if ( ( $this->db->getType() == 'oracle' || !self::$useTemporaryTables ) && self::$reuseDB ) {
$this->resetDB();
}
+
+ wfProfileOut( $logName . ' (clone-db)' );
+ wfProfileIn( $logName . ' (prepare-db)' );
$this->addCoreDBData();
$this->addDBData();
$this->addCoreDBData();
$this->addDBData();
+ wfProfileOut( $logName . ' (prepare-db)' );
+
+ $needsResetDB = true;
+ }
- parent::run( $result );
+ wfProfileIn( $logName );
+ parent::run( $result );
+ wfProfileOut( $logName );
+ if( $needsResetDB ) {
+ wfProfileIn( $logName . ' (reset-db)' );
- } else {
- parent::run( $result );
+ wfProfileOut( $logName . ' (reset-db)' );
* happen in reverse order.
*/
protected function setUp() {
* happen in reverse order.
*/
protected function setUp() {
+ wfProfileIn( __METHOD__ );
$this->db->rollback();
}
}
$this->db->rollback();
}
}
+
+ wfProfileOut( __METHOD__ );
}
protected function tearDown() {
}
protected function tearDown() {
+ wfProfileIn( __METHOD__ );
+
// Cleaning up temporary files
foreach ( $this->tmpfiles as $fname ) {
if ( is_file( $fname ) || ( is_link( $fname ) ) ) {
// Cleaning up temporary files
foreach ( $this->tmpfiles as $fname ) {
if ( is_file( $fname ) || ( is_link( $fname ) ) ) {
$this->mwGlobals = array();
parent::tearDown();
$this->mwGlobals = array();
parent::tearDown();
+ wfProfileOut( __METHOD__ );