private function runBootloaderTests(PhageAgentBootloader $boot) { $name = get_class($boot); $exec = new ExecFuture('%C', $boot->getBootCommand()); $exec->write($boot->getBootSequence(), $keep_open = true); $exec_channel = new PhutilExecChannel($exec); $agent = new PhutilJSONProtocolChannel($exec_channel); $agent->write(array('type' => 'EXEC', 'key' => 1, 'command' => 'echo phage')); $this->agentExpect($agent, array('type' => 'RSLV', 'key' => 1, 'err' => 0, 'stdout' => "phage\n", 'stderr' => ''), "'echo phage' for {$name}"); $agent->write(array('type' => 'EXIT')); }
public function testJSONChannelBasics() { list($x, $y) = PhutilSocketChannel::newChannelPair(); $xp = new PhutilJSONProtocolChannel($x); $yp = new PhutilJSONProtocolChannel($y); $dict = array('rand' => mt_rand(), 'list' => array(1, 2, 3), 'null' => null); $xp->write($dict); $xp->flush(); $result = $yp->waitForMessage(); $this->assertEqual($dict, $result, pht('Values are identical.')); }