MediaWiki
REL1_19
|
00001 <?php 00027 $otions = array( 'quick', 'color', 'quiet', 'help', 'show-output', 'record', 'run-disabled' ); 00028 $optionsWithArgs = array( 'regex', 'filter', 'seed', 'setversion' ); 00029 00030 require_once( dirname( __FILE__ ) . '/../maintenance/commandLine.inc' ); 00031 00032 if ( isset( $options['help'] ) ) { 00033 echo <<<ENDS 00034 MediaWiki $wgVersion parser test suite 00035 Usage: php parserTests.php [options...] 00036 00037 Options: 00038 --quick Suppress diff output of failed tests 00039 --quiet Suppress notification of passed tests (shows only failed tests) 00040 --show-output Show expected and actual output 00041 --color[=yes|no] Override terminal detection and force color output on or off 00042 use wgCommandLineDarkBg = true; if your term is dark 00043 --regex Only run tests whose descriptions which match given regex 00044 --filter Alias for --regex 00045 --file=<testfile> Run test cases from a custom file instead of parserTests.txt 00046 --record Record tests in database 00047 --compare Compare with recorded results, without updating the database. 00048 --setversion When using --record, set the version string to use (useful 00049 with git-svn so that you can get the exact revision) 00050 --keep-uploads Re-use the same upload directory for each test, don't delete it 00051 --fuzz Do a fuzz test instead of a normal test 00052 --seed <n> Start the fuzz test from the specified seed 00053 --help Show this help message 00054 --run-disabled run disabled tests 00055 00056 ENDS; 00057 exit( 0 ); 00058 } 00059 00060 # Cases of weird db corruption were encountered when running tests on earlyish 00061 # versions of SQLite 00062 if ( $wgDBtype == 'sqlite' ) { 00063 $db = wfGetDB( DB_MASTER ); 00064 $version = $db->getServerVersion(); 00065 if ( version_compare( $version, '3.6' ) < 0 ) { 00066 die( "Parser tests require SQLite version 3.6 or later, you have $version\n" ); 00067 } 00068 } 00069 00070 # There is a convention that the parser should never 00071 # refer to $wgTitle directly, but instead use the title 00072 # passed to it. 00073 $wgTitle = Title::newFromText( 'Parser test script do not use' ); 00074 $tester = new ParserTest($options); 00075 00076 if ( isset( $options['file'] ) ) { 00077 $files = array( $options['file'] ); 00078 } else { 00079 // Default parser tests and any set from extensions or local config 00080 $files = $wgParserTestFiles; 00081 } 00082 00083 # Print out software version to assist with locating regressions 00084 $version = SpecialVersion::getVersion(); 00085 echo( "This is MediaWiki version {$version}.\n\n" ); 00086 00087 if ( isset( $options['fuzz'] ) ) { 00088 $tester->fuzzTest( $files ); 00089 } else { 00090 $ok = $tester->runTestsFromFiles( $files ); 00091 exit ( $ok ? 0 : 1 ); 00092 }