Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7402366
SandboxInterpreterTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
SandboxInterpreterTest.php
View Options
<?php
namespace
MediaWiki\Extension\Scribunto\Tests\Engines\LuaSandbox
;
use
MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxEngine
;
use
MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxInterpreter
;
use
MediaWiki\Extension\Scribunto\Tests\Engines\LuaCommon\LuaInterpreterTestBase
;
if
(
!
wfIsCLI
()
)
{
exit
;
}
/**
* @group Lua
* @group LuaSandbox
* @covers \MediaWiki\Extension\Scribunto\Engines\LuaSandbox\LuaSandboxInterpreter
*/
class
SandboxInterpreterTest
extends
LuaInterpreterTestBase
{
/** @var array */
public
$stdOpts
=
[
'memoryLimit'
=>
50000000
,
'cpuLimit'
=>
30
,
];
protected
function
newInterpreter
(
$opts
=
[]
)
{
$opts
+=
$this
->
stdOpts
;
$engine
=
new
LuaSandboxEngine
(
$this
->
stdOpts
);
return
new
LuaSandboxInterpreter
(
$engine
,
$opts
);
}
public
function
testGetMemoryUsage
()
{
$interpreter
=
$this
->
newInterpreter
();
$chunk
=
$interpreter
->
loadString
(
's = string.rep("x", 1000000)'
,
'mem'
);
$interpreter
->
callFunction
(
$chunk
);
$mem
=
$interpreter
->
getPeakMemoryUsage
();
$this
->
assertGreaterThan
(
1000000
,
$mem
,
'memory usage'
);
$this
->
assertLessThan
(
10000000
,
$mem
,
'memory usage'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Nov 21, 18:01 (5 d, 17 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
42/2a/4132d771d1c360038240153b4460
Default Alt Text
SandboxInterpreterTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment