mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-26 08:42:40 +01:00
9b74cb4ee6
Summary: Ref T13395. Moves all remaining code in "libphutil/" into "arcanist/". Test Plan: Ran various arc workflows, although this probably has some remaining rough edges. Maniphest Tasks: T13395 Differential Revision: https://secure.phabricator.com/D20980
59 lines
1.3 KiB
PHP
59 lines
1.3 KiB
PHP
<?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)));
|
|
}
|
|
}
|
|
|
|
}
|