23 include_once(__DIR__.
'/../../../lib/php/Test/Agent/AgentTestMockHelper.php');
24 include_once(__DIR__.
'/SchedulerTestRunner.php');
42 public function run($uploadId, $userId=2, $groupId=2, $jobId=1, $args=
"")
44 $sysConf = $this->testDb->getFossSysConf();
48 $agentDir = dirname(dirname(__DIR__));
49 $execDir =
"$agentDir/agent";
50 system(
"install -D $agentDir/VERSION $sysConf/mods-enabled/$agentName/VERSION");
51 system(
"install -D $agentDir/agent/$agentName $sysConf/mods-enabled/$agentName/agent/$agentName");
52 $pCmd =
"echo $uploadId | $execDir/$agentName --userID=$userId --groupID=$groupId --jobId=$jobId --scheduler_start -c $sysConf $args";
53 $pipeFd = popen($pCmd,
"r");
54 $success = $pipeFd !==
false;
59 while (($buffer = fgets($pipeFd, 4096)) !==
false) {
62 $retCode = pclose($pipeFd);
64 print
"failed opening pipe to $cmd";
67 unlink(
"$sysConf/mods-enabled/$agentName/VERSION");
68 unlink(
"$sysConf/mods-enabled/$agentName/agent/$agentName");
69 rmdir(
"$sysConf/mods-enabled/$agentName/agent/");
70 rmdir(
"$sysConf/mods-enabled/$agentName");
71 rmdir(
"$sysConf/mods-enabled");
72 unlink($sysConf.
"/fossology.conf");
74 return array($success, $output, $retCode);
Handles scheduler interaction.
run($uploadId, $userId=2, $groupId=2, $jobId=1, $args="")
Function to run agent from scheduler.