r68557 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68556‎ | r68557 | r68558 >
Date:09:01, 25 June 2010
Author:tstarling
Status:deferred (Comments)
Tags:
Comment:
* Fixed the makefile to only run enabled tests, instead of every file in the directory with "test" in its name. Did this by moving the test list to a common PHP file, accessible by both the makefile and a new PHPUnit_TextUI_Command subclass.
* Removed the perl dependency from the default "make test". There doesn't seem to be a memory issue anymore, but you can always use one of the non-default targets if it recurs.
* Fixed a couple of test/suite names broken in r68544.
* Added custom CSS to Special:Selenium, accidentally missing from r68555.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialSelenium.php (modified) (history)
  • /trunk/phase3/maintenance/tests/Makefile (modified) (history)
  • /trunk/phase3/maintenance/tests/MediaWikiParserTest.php (modified) (history)
  • /trunk/phase3/maintenance/tests/ParserHelpers.php (modified) (history)
  • /trunk/phase3/maintenance/tests/TestFileList.php (added) (history)
  • /trunk/phase3/maintenance/tests/phpunit (modified) (history)
  • /trunk/phase3/maintenance/tests/phpunit.xml (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/tests/phpunit
@@ -24,6 +24,18 @@
2525 EOF;
2626 }
2727
28 -$command = new PHPUnit_TextUI_Command;
 28+class MWPHPUnitCommand extends PHPUnit_TextUI_Command {
 29+ protected function handleCustomTestSuite() {
 30+ require( dirname( __FILE__ ) . '/TestFileList.php' );
 31+ $suite = new PHPUnit_Framework_TestSuite;
 32+ foreach ( $testFiles as $file ) {
 33+ $suite->addTestFile( $file );
 34+ }
 35+ $suite->setName( 'MediaWiki test suite' );
 36+ $this->arguments['test'] = $suite;
 37+ }
 38+}
 39+
 40+$command = new MWPHPUnitCommand;
2941 $command->run( $argv );
3042
Index: trunk/phase3/maintenance/tests/ParserHelpers.php
@@ -49,6 +49,10 @@
5050 return $result;
5151 }
5252
 53+ public function toString() {
 54+ return $this->test['test'];
 55+ }
 56+
5357 }
5458
5559 class ParserTestSuiteBackend extends ParserTest {
Index: trunk/phase3/maintenance/tests/Makefile
@@ -1,23 +1,32 @@
2 -# See
3 -# http://lists.wikimedia.org/pipermail/wikitech-l/2010-February/046657.html
4 -# for why prove(1) is the default target and not phpunit(1)
 2+# If you have problems with excessive memory usage, use the "tap" or "separate" targets.
53
6 -.PHONY: help test
7 -all test: tap
 4+TEST_FILES=$(shell php -r 'include( "./TestFileList.php" ); echo implode( " ", $$testFiles );')
 5+TEST_FILE_TARGETS=$(subst .php,.target,$(TEST_FILES))
86
9 -tap:
10 - prove -e 'php phpunit.php --tap' *Test*.php
 7+.PHONY: help test phpunit tap separate install $(TEST_FILE_TARGETS)
118
 9+all test: phpunit
 10+
1211 phpunit:
13 - phpunit
 12+ php phpunit
1413
 14+tap:
 15+ prove -e 'php phpunit --tap' *Test*.php
 16+
 17+separate: $(TEST_FILE_TARGETS)
 18+
 19+# Need --tap because without it, the target specification doesn't work
 20+$(TEST_FILE_TARGETS) : %.target : %.php
 21+ php phpunit --tap $<
 22+
1523 install:
1624 pear channel-discover pear.phpunit.de
1725 pear install phpunit/PHPUnit
1826
1927 help:
20 - # Options:
21 - # test (default) Run the tests individually through Test::Harness's prove(1)
22 - # phpunit Run all the tests with phpunit
23 - # install Install PHPUnit from phpunit.de
24 - # help You're looking at it!
 28+ # Targets:
 29+ # phpunit (default) Run all the tests with phpunit
 30+ # separate Run each test file in a separate process
 31+ # tap Run the tests individually through Test::Harness's prove(1)
 32+ # install Install PHPUnit from phpunit.de
 33+ # help You're looking at it!
Index: trunk/phase3/maintenance/tests/phpunit.xml
@@ -5,36 +5,8 @@
66 convertErrorsToExceptions="true"
77 convertNoticesToExceptions="true"
88 convertWarningsToExceptions="true"
9 - stopOnFailure="false">
10 - <testsuite name="MediaWiki Test Suite">
11 - <!-- <directory>.</directory> -->
12 - <!-- <file>ApiTest.php</file> -->
13 - <!-- <file>ApiWatchTest.php</file> -->
14 - <file>CdbTest.php</file>
15 - <file>DatabaseSqliteTest.php</file>
16 - <file>DatabaseTest.php</file>
17 - <file>GlobalTest.php</file>
18 - <!--<file>HttpTest.php</file>-->
19 - <file>IPTest.php</file>
20 - <file>ImageFunctionsTest.php</file>
21 - <file>LanguageConverterTest.php</file>
22 - <file>LicensesTest.php</file>
23 - <file>LocalFileTest.php</file>
24 - <file>MediaWikiParserTest.php</file>
25 - <file>MessageTest.php</file>
26 - <file>RevisionTest.php</file>
27 - <file>SanitizerTest.php</file>
28 - <file>SearchDbTest.php</file>
29 - <file>SearchEngineTest.php</file>
30 - <file>SearchUpdateTest.php</file>
31 - <file>SiteConfigurationTest.php</file>
32 - <file>TimeAdjustTest.php</file>
33 - <file>TitlePermissionTest.php</file>
34 - <file>TitleTest.php</file>
35 - <file>UploadTest.php</file>
36 - <file>UploadFromUrlTestSuite.php</file>
37 - <file>XmlTest.php</file>
38 - </testsuite>
 9+ stopOnFailure="false">
 10+ <!-- for the test file list, see TestFileList.php -->
3911 <groups>
4012 <exclude>
4113 <group>Broken</group>
Index: trunk/phase3/maintenance/tests/TestFileList.php
@@ -0,0 +1,30 @@
 2+<?php
 3+
 4+$testFiles = array(
 5+ #'ApiTest.php',
 6+ #'ApiWatchTest.php',
 7+ 'CdbTest.php',
 8+ 'DatabaseSqliteTest.php',
 9+ 'DatabaseTest.php',
 10+ 'GlobalTest.php',
 11+ #'HttpTest.php',
 12+ 'IPTest.php',
 13+ 'ImageFunctionsTest.php',
 14+ 'LanguageConverterTest.php',
 15+ 'LicensesTest.php',
 16+ 'LocalFileTest.php',
 17+ 'MediaWikiParserTest.php',
 18+ 'MessageTest.php',
 19+ 'RevisionTest.php',
 20+ 'SanitizerTest.php',
 21+ 'SearchDbTest.php',
 22+ 'SearchEngineTest.php',
 23+ 'SearchUpdateTest.php',
 24+ 'SiteConfigurationTest.php',
 25+ 'TimeAdjustTest.php',
 26+ 'TitlePermissionTest.php',
 27+ 'TitleTest.php',
 28+ 'UploadTest.php',
 29+ 'UploadFromUrlTestSuite.php',
 30+ 'XmlTest.php',
 31+);
Property changes on: trunk/phase3/maintenance/tests/TestFileList.php
___________________________________________________________________
Name: svn:eol-style
132 + native
Index: trunk/phase3/maintenance/tests/MediaWikiParserTest.php
@@ -11,6 +11,7 @@
1212 public function __construct() {
1313 $this->backend = new ParserTestSuiteBackend;
1414 parent::__construct();
 15+ $this->setName( 'Parser tests' );
1516 }
1617
1718 public function run( PHPUnit_Framework_TestResult $result = null, $filter = false,
Index: trunk/phase3/includes/specials/SpecialSelenium.php
@@ -48,6 +48,7 @@
4949 $result = new PHPUnit_Framework_TestResult;
5050 $logger = new SeleniumTestHTMLLogger;
5151 $result->addListener( new SeleniumTestListener( $logger ) );
 52+ $logger->setHeaders();
5253
5354 // run tests
5455 $suite = new SeleniumTestSuite;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r68544* Removed require/require_once from maintenance scripts where possible, repla...tstarling02:55, 25 June 2010
r68555* Integrated the selenium tests into MediaWiki properly, and removed the inse...tstarling05:55, 25 June 2010

Comments

#Comment by 😂 (talk | contribs)   12:53, 25 June 2010

I'm told the memory issue is still present in 5.2. I've been running 5.3 for ages so I never confirmed.

Status & tagging log