From 3ddafb719a819daabf449551026ffec27e00a8ea Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 30 Jun 2011 19:47:26 +0000 Subject: [PATCH] Remove --upload option to parserTests.php and backend RemoteTestRecorder -- was only used for since-removed CR integration --- includes/AutoLoader.php | 1 - tests/parser/parserTest.inc | 2 - tests/parserTests.php | 1 - tests/testHelpers.inc | 93 ------------------------------------- 4 files changed, 97 deletions(-) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 2227a9fcec..b24fa40de9 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -846,7 +846,6 @@ $wgAutoloadLocalClasses = array( 'DbTestPreviewer' => 'tests/testHelpers.inc', 'DbTestRecorder' => 'tests/testHelpers.inc', 'DummyTermColorer' => 'tests/testHelpers.inc', - 'RemoteTestRecorder' => 'tests/testHelpers.inc', 'TestFileIterator' => 'tests/testHelpers.inc', 'TestRecorder' => 'tests/testHelpers.inc', diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 43f6d0d295..f4a952cde0 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -185,8 +185,6 @@ class ParserTest { $options['setversion'] : SpecialVersion::getVersion(); } elseif ( isset( $options['compare'] ) ) { $this->recorder = new DbTestPreviewer( $this ); - } elseif ( isset( $options['upload'] ) ) { - $this->recorder = new RemoteTestRecorder( $this ); } else { $this->recorder = new TestRecorder( $this ); } diff --git a/tests/parserTests.php b/tests/parserTests.php index 580f6fbb5c..99ea2ed439 100644 --- a/tests/parserTests.php +++ b/tests/parserTests.php @@ -51,7 +51,6 @@ Options: --seed Start the fuzz test from the specified seed --help Show this help message --run-disabled run disabled tests - --upload Upload test results to remote wiki (per \$wgParserTestRemote) ENDS; exit( 0 ); diff --git a/tests/testHelpers.inc b/tests/testHelpers.inc index 5cf42afb24..5d56e62590 100644 --- a/tests/testHelpers.inc +++ b/tests/testHelpers.inc @@ -349,99 +349,6 @@ class DbTestRecorder extends DbTestPreviewer { } } -class RemoteTestRecorder extends TestRecorder { - function start() { - parent::start(); - - $this->results = array(); - $this->ping( 'running' ); - } - - function record( $test, $result ) { - parent::record( $test, $result ); - $this->results[$test] = (bool)$result; - } - - function end() { - $this->ping( 'complete', $this->results ); - parent::end(); - } - - /** - * Inform a CodeReview instance that we've started or completed a test run... - * - * @param $status string: "running" - tell it we've started - * "complete" - provide test results array - * "abort" - something went horribly awry - * @param $results array of test name => true/false - */ - function ping( $status, $results = false ) { - global $wgParserTestRemote, $IP; - - $remote = $wgParserTestRemote; - $revId = SpecialVersion::getSvnRevision( $IP ); - $jsonResults = FormatJson::encode( $results ); - - if ( !$remote ) { - print "Can't do remote upload without configuring \$wgParserTestRemote!\n"; - exit( 1 ); - } - - // Generate a hash MAC to validate our credentials - $message = array( - $remote['repo'], - $remote['suite'], - $revId, - $status, - ); - - if ( $status == "complete" ) { - $message[] = $jsonResults; - } - $hmac = hash_hmac( "sha1", implode( "|", $message ), $remote['secret'] ); - - $postData = array( - 'action' => 'codetestupload', - 'format' => 'json', - 'repo' => $remote['repo'], - 'suite' => $remote['suite'], - 'rev' => $revId, - 'status' => $status, - 'hmac' => $hmac, - ); - - if ( $status == "complete" ) { - $postData['results'] = $jsonResults; - } - - $response = $this->post( $remote['api-url'], $postData ); - - if ( $response === false ) { - print "CodeReview info upload failed to reach server.\n"; - exit( 1 ); - } - - $responseData = FormatJson::decode( $response, true ); - - if ( !is_array( $responseData ) ) { - print "CodeReview API response not recognized...\n"; - wfDebug( "Unrecognized CodeReview API response: $response\n" ); - exit( 1 ); - } - - if ( isset( $responseData['error'] ) ) { - $code = $responseData['error']['code']; - $info = $responseData['error']['info']; - print "CodeReview info upload failed: $code $info\n"; - exit( 1 ); - } - } - - function post( $url, $data ) { - return Http::post( $url, array( 'postData' => $data ) ); - } -} - class TestFileIterator implements Iterator { private $file; private $fh; -- 2.20.1