Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2889384
ArcanistHostMemorySnapshotTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
ArcanistHostMemorySnapshotTestCase.php
View Options
<?php
final
class
ArcanistHostMemorySnapshotTestCase
extends
PhutilTestCase
{
public
function
testSnapshotSwapTotalBytes
(
)
{
$test_cases
=
array
(
'meminfo_swap_normal.txt'
=>
4294963200
,
'meminfo_swap_zero.txt'
=>
0
,
'meminfo_swap_missing.txt'
=>
false
,
'meminfo_swap_invalid.txt'
=>
false
,
'meminfo_swap_badunits.txt'
=>
false
,
'meminfo_swap_duplicate.txt'
=>
false
,
)
;
$test_dir
=
dirname
(
__FILE__
)
.
'/data/'
;
foreach
(
$test_cases
as
$test_file
=>
$expect
)
{
$test_data
=
Filesystem
::
readFile
(
$test_dir
.
$test_file
)
;
$caught
=
null
;
$actual
=
null
;
try
{
$snapshot
=
ArcanistHostMemorySnapshot
::
newFromRawMeminfo
(
$test_file
,
$test_data
)
;
$actual
=
$snapshot
->
getTotalSwapBytes
(
)
;
}
catch
(
Exception
$ex
)
{
if
(
$expect
===
false
)
{
$caught
=
$ex
;
}
else
{
throw
$ex
;
}
}
catch
(
Throwable
$ex
)
{
throw
$ex
;
}
if
(
$expect
===
false
)
{
$this
->
assertTrue
(
(
$caught
instanceof
Exception
)
,
pht
(
'Expected exception for "%s".'
,
$test_file
)
)
;
}
else
{
$this
->
assertEqual
(
$expect
,
$actual
,
pht
(
'Result for "%s".'
,
$test_file
)
)
;
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Jan 19 2025, 12:05 (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1119856
Default Alt Text
ArcanistHostMemorySnapshotTestCase.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment