2014-07-18 20:03:06 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @group GlobalFunctions
|
|
|
|
|
* @covers ::wfShellExec
|
|
|
|
|
*/
|
2020-06-30 15:09:24 +00:00
|
|
|
class WfShellExecTest extends MediaWikiIntegrationTestCase {
|
2018-08-18 13:51:29 +00:00
|
|
|
public function testT69870() {
|
2019-06-15 06:35:18 +00:00
|
|
|
if ( wfIsWindows() ) {
|
|
|
|
|
// T209159: Anonymous pipe under Windows does not support asynchronous read and write,
|
|
|
|
|
// and the default buffer is too small (~4K), it is easy to be blocked.
|
|
|
|
|
$this->markTestSkipped(
|
|
|
|
|
'T209159: Anonymous pipe under Windows cannot withstand such a large amount of data'
|
|
|
|
|
);
|
|
|
|
|
}
|
2014-07-18 20:03:06 +00:00
|
|
|
|
|
|
|
|
// Test several times because it involves a race condition that may randomly succeed or fail
|
|
|
|
|
for ( $i = 0; $i < 10; $i++ ) {
|
2019-06-15 06:35:18 +00:00
|
|
|
$output = wfShellExec( 'printf "%-333333s" "*"' );
|
2014-07-18 20:03:06 +00:00
|
|
|
$this->assertEquals( 333333, strlen( $output ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|