From 709522ccb20cb2d5eddb619d3bea9d28c7a8cf7e Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 22 Jun 2022 21:35:59 +0200 Subject: debugging --- .github/workflows/testWindows.yml | 3 ++- _test/core/DokuWikiTest.php | 4 ++++ inc/HTTP/HTTPClient.php | 4 ++-- lib/plugins/config/_test/DocumentationTest.php | 14 +++++++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testWindows.yml b/.github/workflows/testWindows.yml index 43fe624c5..8875cfc39 100644 --- a/.github/workflows/testWindows.yml +++ b/.github/workflows/testWindows.yml @@ -22,6 +22,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, intl, bz2 + ini-values: max_execution_time=0 - name: Setup problem matchers run: | @@ -35,4 +36,4 @@ jobs: - name: Run PHPUnit run: | cd _test - php phpunit.phar --verbose --stderr + php -d max_execution_time=1800 phpunit.phar --verbose --debug --stderr diff --git a/_test/core/DokuWikiTest.php b/_test/core/DokuWikiTest.php index 553353af8..c67d84847 100644 --- a/_test/core/DokuWikiTest.php +++ b/_test/core/DokuWikiTest.php @@ -59,6 +59,10 @@ abstract class DokuWikiTest extends PHPUnit\Framework\TestCase { * @return void */ public function setUp() : void { + // reset execution time if it's enabled + if(ini_get('max_execution_time') > 0) { + set_time_limit(90); + } // reload config global $conf, $config_cascade; diff --git a/inc/HTTP/HTTPClient.php b/inc/HTTP/HTTPClient.php index 5c7491ee9..6830ced55 100644 --- a/inc/HTTP/HTTPClient.php +++ b/inc/HTTP/HTTPClient.php @@ -258,7 +258,7 @@ class HTTPClient { if (is_null($socket) || feof($socket)) { $this->debug('opening connection', $connectionId); // open socket - $socket = @fsockopen($server,$port,$errno, $errstr, $this->timeout); + $socket = fsockopen($server,$port,$errno, $errstr, $this->timeout); if (!$socket){ $this->status = -100; $this->error = "Could not connect to $server:$port\n$errstr ($errno)"; @@ -687,7 +687,7 @@ class HTTPClient { $sel_w = null; $sel_e = null; // wait for stream ready or timeout (1sec) - if(@stream_select($sel_r,$sel_w,$sel_e,1) === false){ + if(stream_select($sel_r,$sel_w,$sel_e,1) === false){ usleep(1000); continue; } diff --git a/lib/plugins/config/_test/DocumentationTest.php b/lib/plugins/config/_test/DocumentationTest.php index 3474616d9..6bf79df38 100644 --- a/lib/plugins/config/_test/DocumentationTest.php +++ b/lib/plugins/config/_test/DocumentationTest.php @@ -18,6 +18,8 @@ use dokuwiki\plugin\config\core\Setting\SettingHidden; */ class DocumentationTest extends \DokuWikiTest { + protected $http; + /** * @return \Generator|array[] */ @@ -45,10 +47,16 @@ class DocumentationTest extends \DokuWikiTest */ public function testDocs($key, $url) { - $http = new DokuHTTPClient(); - $check = $http->get($url); + if ($this->http === null) { + $this->http = new DokuHTTPClient(); + $this->http->timeout = 15; + } + + echo ini_get('max_execution_time'); + + $check = $this->http->get($url); $fail = (bool)strpos($check, 'topic does not exist'); $msg = "Setting '$key' should have documentation at $url."; - $this->assertFalse($fail, $msg . ' ' . $http->status . ' ' . $http->error); + $this->assertFalse($fail, $msg . ' ' . $this->http->status . ' ' . $this->http->error); } } -- cgit v1.2.3