Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7187860
PhutilProcessRefTestCase.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
PhutilProcessRefTestCase.php
View Options
<?php
final
class
PhutilProcessRefTestCase
extends
PhutilTestCase
{
public
function
testIdentifyOverseerProcess
()
{
// Test if various process argument vectors are correctly identified as
// daemon overseer processes or not. We're hoping to identify legitimate
// daemons and ignore false positives for processes with titles that look
// similar but are not really daemons, like "grep phd-daemon".
$tests
=
array
(
array
(
array
(
'php'
,
'phd-daemon'
),
true
,
),
array
(
array
(
'/path/to/php'
,
'/path/to/phd-daemon'
),
true
,
),
array
(
array
(
'/path/to/phd-daemon'
),
true
,
),
array
(
array
(
'phd-daemon'
),
true
,
),
array
(
array
(
'php'
,
'phd-daemon'
,
'-l'
,
'instance-label'
),
true
,
),
array
(
array
(
'grep phd-daemon'
),
false
,
),
array
(
array
(
'this-is-a-phd-daemon'
),
false
,
),
);
foreach
(
$tests
as
$case
)
{
list
(
$argv
,
$expect
)
=
$case
;
$ref
=
id
(
new
PhutilProcessRef
())
->
setArgv
(
$argv
);
$actual
=
$ref
->
getIsOverseer
();
$this
->
assertEqual
(
$expect
,
$actual
,
pht
(
'argv: %s'
,
implode
(
' '
,
$argv
)));
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Jul 8, 07:41 (9 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
796061
Default Alt Text
PhutilProcessRefTestCase.php (1 KB)
Attached To
Mode
R118 Arcanist - fork
Attached
Detach File
Event Timeline
Log In to Comment