12 include_once(__DIR__.
'/../../../lib/php/Test/Agent/AgentTestMockHelper.php');
13 include_once(__DIR__.
'/SchedulerTestRunner.php');
31 public function run($uploadId, $userId=2, $groupId=2, $jobId=1, $args=
"")
33 $sysConf = $this->testDb->getFossSysConf();
35 $agentName =
"compatibility";
37 $agentDir = dirname(__DIR__, 4).
'/build/src/compatibility';
38 $execDir =
"$agentDir/agent";
39 system(
"install -D $agentDir/VERSION $sysConf/mods-enabled/$agentName/VERSION");
40 system(
"install -D $agentDir/agent/$agentName $sysConf/mods-enabled/$agentName/agent/$agentName");
41 $pCmd =
"echo $uploadId | $execDir/$agentName --userID=$userId --groupID=$groupId --jobId=$jobId --scheduler_start -c $sysConf $args";
42 $pipeFd = popen($pCmd,
"r");
43 $success = $pipeFd !==
false;
48 while (($buffer = fgets($pipeFd, 4096)) !==
false) {
51 $retCode = pclose($pipeFd);
53 print
"failed opening pipe to $pCmd";
56 unlink(
"$sysConf/mods-enabled/$agentName/VERSION");
57 unlink(
"$sysConf/mods-enabled/$agentName/agent/$agentName");
58 rmdir(
"$sysConf/mods-enabled/$agentName/agent/");
59 rmdir(
"$sysConf/mods-enabled/$agentName");
60 rmdir(
"$sysConf/mods-enabled");
61 unlink($sysConf.
"/fossology.conf");
63 return array($success, $output, $retCode);
Handles scheduler interaction.
run($uploadId, $userId=2, $groupId=2, $jobId=1, $args="")
Function to run agent from scheduler.