r50640 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50639‎ | r50640 | r50641 >
Date:19:23, 15 May 2009
Author:simetrical
Status:ok
Tags:
Comment:
Add --setversion option to parserTests

This overrides the version string stored in the database with --record.
When using git-svn, you can do

php maintenance/parserTests.php --quick --quiet --record \
--setversion=`git rev-parse HEAD`

to have comprehensible version info stored for the purposes of later
bisection. Previously just "1.16alpha" would be stored, which is
useless for tracking down the old revision -- you'd have to try guessing
based on date.

It might be useful for SpecialVersion::getVersion() to support git-svn,
but that's a more complicated and intrusive change for an admittedly
small minority, so I avoided it for now.
Modified paths:
  • /trunk/phase3/maintenance/parserTests.inc (modified) (history)
  • /trunk/phase3/maintenance/parserTests.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.inc
@@ -26,7 +26,7 @@
2727
2828 /** */
2929 $options = array( 'quick', 'color', 'quiet', 'help', 'show-output', 'record' );
30 -$optionsWithArgs = array( 'regex', 'seed' );
 30+$optionsWithArgs = array( 'regex', 'seed', 'setversion' );
3131
3232 require_once( 'commandLine.inc' );
3333 require_once( "$IP/maintenance/parserTestsParserHook.php" );
@@ -1396,7 +1396,7 @@
13971397 * and all that fun stuff
13981398 */
13991399 function start() {
1400 - global $wgDBtype, $wgDBprefix;
 1400+ global $wgDBtype, $wgDBprefix, $options;
14011401 $this->db->begin();
14021402
14031403 if( ! $this->db->tableExists( 'testrun' )
@@ -1415,7 +1415,8 @@
14161416 $this->db->insert( 'testrun',
14171417 array(
14181418 'tr_date' => $this->db->timestamp(),
1419 - 'tr_mw_version' => SpecialVersion::getVersion(),
 1419+ 'tr_mw_version' => isset( $options['setversion'] ) ?
 1420+ $options['setversion'] : SpecialVersion::getVersion(),
14201421 'tr_php_version' => phpversion(),
14211422 'tr_db_version' => $this->db->getServerVersion(),
14221423 'tr_uname' => php_uname()
Index: trunk/phase3/maintenance/parserTests.php
@@ -40,6 +40,8 @@
4141 --file=<testfile> Run test cases from a custom file instead of parserTests.txt
4242 --record Record tests in database
4343 --compare Compare with recorded results, without updating the database.
 44+ --setversion When using --record, set the version string to use (useful
 45+ with git-svn so that you can get the exact revision)
4446 --keep-uploads Re-use the same upload directory for each test, don't delete it
4547 --fuzz Do a fuzz test instead of a normal test
4648 --seed <n> Start the fuzz test from the specified seed

Status & tagging log