From fd8ed0ba5c8c21f00157dadb99327326df4b8392 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Fri, 15 May 2009 19:23:00 +0000 Subject: [PATCH] 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. --- maintenance/parserTests.inc | 7 ++++--- maintenance/parserTests.php | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/maintenance/parserTests.inc b/maintenance/parserTests.inc index 0aa55ef7fb..4ccc9328b9 100644 --- a/maintenance/parserTests.inc +++ b/maintenance/parserTests.inc @@ -26,7 +26,7 @@ /** */ $options = array( 'quick', 'color', 'quiet', 'help', 'show-output', 'record' ); -$optionsWithArgs = array( 'regex', 'seed' ); +$optionsWithArgs = array( 'regex', 'seed', 'setversion' ); require_once( 'commandLine.inc' ); require_once( "$IP/maintenance/parserTestsParserHook.php" ); @@ -1396,7 +1396,7 @@ class DbTestRecorder extends DbTestPreviewer { * and all that fun stuff */ function start() { - global $wgDBtype, $wgDBprefix; + global $wgDBtype, $wgDBprefix, $options; $this->db->begin(); if( ! $this->db->tableExists( 'testrun' ) @@ -1415,7 +1415,8 @@ class DbTestRecorder extends DbTestPreviewer { $this->db->insert( 'testrun', array( 'tr_date' => $this->db->timestamp(), - 'tr_mw_version' => SpecialVersion::getVersion(), + 'tr_mw_version' => isset( $options['setversion'] ) ? + $options['setversion'] : SpecialVersion::getVersion(), 'tr_php_version' => phpversion(), 'tr_db_version' => $this->db->getServerVersion(), 'tr_uname' => php_uname() diff --git a/maintenance/parserTests.php b/maintenance/parserTests.php index 9a1a4807c7..c7e22602fa 100644 --- a/maintenance/parserTests.php +++ b/maintenance/parserTests.php @@ -40,6 +40,8 @@ Options: --file= Run test cases from a custom file instead of parserTests.txt --record Record tests in database --compare Compare with recorded results, without updating the database. + --setversion When using --record, set the version string to use (useful + with git-svn so that you can get the exact revision) --keep-uploads Re-use the same upload directory for each test, don't delete it --fuzz Do a fuzz test instead of a normal test --seed Start the fuzz test from the specified seed -- 2.20.1