00001 <?php 00002 # Copyright (C) 2004 Brion Vibber <brion@pobox.com> 00003 # http://www.mediawiki.org/ 00004 # 00005 # This program is free software; you can redistribute it and/or modify 00006 # it under the terms of the GNU General Public License as published by 00007 # the Free Software Foundation; either version 2 of the License, or 00008 # (at your option) any later version. 00009 # 00010 # This program is distributed in the hope that it will be useful, 00011 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 # GNU General Public License for more details. 00014 # 00015 # You should have received a copy of the GNU General Public License along 00016 # with this program; if not, write to the Free Software Foundation, Inc., 00017 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 # http://www.gnu.org/copyleft/gpl.html 00019 00026 require('parserTests.inc'); 00027 00028 if( isset( $options['help'] ) ) { 00029 echo <<<ENDS 00030 MediaWiki $wgVersion parser test suite 00031 Usage: php parserTests.php [options...] 00032 00033 Options: 00034 --quick Suppress diff output of failed tests 00035 --quiet Suppress notification of passed tests (shows only failed tests) 00036 --show-output Show expected and actual output 00037 --color[=yes|no] Override terminal detection and force color output on or off 00038 use wgCommandLineDarkBg = true; if your term is dark 00039 --regex Only run tests whose descriptions which match given regex 00040 --file=<testfile> Run test cases from a custom file instead of parserTests.txt 00041 --record Record tests in database 00042 --compare Compare with recorded results, without updating the database. 00043 --keep-uploads Re-use the same upload directory for each test, don't delete it 00044 --fuzz Do a fuzz test instead of a normal test 00045 --seed <n> Start the fuzz test from the specified seed 00046 --help Show this help message 00047 00048 00049 ENDS; 00050 exit( 0 ); 00051 } 00052 00053 # There is a convention that the parser should never 00054 # refer to $wgTitle directly, but instead use the title 00055 # passed to it. 00056 $wgTitle = Title::newFromText( 'Parser test script do not use' ); 00057 $tester = new ParserTest(); 00058 00059 if( isset( $options['file'] ) ) { 00060 $files = array( $options['file'] ); 00061 } else { 00062 // Default parser tests and any set from extensions or local config 00063 $files = $wgParserTestFiles; 00064 } 00065 00066 # Print out software version to assist with locating regressions 00067 $version = SpecialVersion::getVersion(); 00068 echo( "This is MediaWiki version {$version}.\n\n" ); 00069 00070 if ( isset( $options['fuzz'] ) ) { 00071 $tester->fuzzTest( $files ); 00072 } else { 00073 $ok = $tester->runTestsFromFiles( $files ); 00074 exit ($ok ? 0 : 1); 00075 }