17 $archive_path =
'/tmp/fossology';
26 public $command =
'/usr/local/bin/test.cp2foss';
28 function TestDashRNoArchive()
31 $error = exec(
"$this->command -p devnull -n fail -a /dev/null -d \"test should fail\" ",
34 $this->assertPattern(
'/Error, .* not greater than zero/', $output[0]);
37 $error = exec(
"$this->command -p stdin -n fail -a /dev/stdin -d 'stdin should fail'",
40 $this->assertPattern(
'/Stopping, can\'t process archive/', $output[1]);
54 function TestNoDashR()
64 "$this->command -p CP2fossTest/fldr1 -n fossology -a $archive_path -d 'no -R, only files saved' ", $output, $retval
66 echo
"\$output Only files is:\n"; dump($output); echo
"\n";
77 $find =
"find /tmp/fossology -maxdepth 1 -type f -print";
78 $last = exec($find, $findoutput, $retval);
79 $last = exec(
"tar -tf $output[1]", $tarout, $retval);
82 foreach ($findoutput as $path) {
83 $basenames[] = basename($path);
87 $diffs = array_diff($tarout, $basenames);
104 "$this->command -p CP2fossTest -n fossology -a $archive_path -R -d '-R all contents saved' ",
112 echo
"output All contents is:\n"; dump($output); echo
"\n";
119 $temp_tar =
"/tmp/test.tar.bz2";
120 chdir($apath) or die(
"Can't cd to $apath, $php_errormsg\n");
122 $tcmd =
"tar -cjf $temp_tar --exclude='.svn' --exclude='.cvs' *";
123 $last = exec($tcmd, $Rtoutput, $retval);
124 $last = exec(
"tar -tf $output[1]", $tarout, $retval);
125 $last = exec(
"tar -tf $temp_tar", $Rtout, $retval);
126 foreach ($tarout as $p) {
128 $tpaths[] = rtrim($p);
130 foreach ($Rtout as $path) {
131 $Rtpaths[] = rtrim($path);
135 $diffs = array_diff($tpaths, $Rtpaths);