27 $archive_path =
'/tmp/fossology';
36 public $command =
'/usr/local/bin/test.cp2foss';
38 function TestDashRNoArchive()
41 $error = exec(
"$this->command -p devnull -n fail -a /dev/null -d \"test should fail\" ",
44 $this->assertPattern(
'/Error, .* not greater than zero/', $output[0]);
47 $error = exec(
"$this->command -p stdin -n fail -a /dev/stdin -d 'stdin should fail'",
50 $this->assertPattern(
'/Stopping, can\'t process archive/', $output[1]);
64 function TestNoDashR()
74 "$this->command -p CP2fossTest/fldr1 -n fossology -a $archive_path -d 'no -R, only files saved' ", $output, $retval
76 echo
"\$output Only files is:\n"; dump($output); echo
"\n";
87 $find =
"find /tmp/fossology -maxdepth 1 -type f -print";
88 $last = exec($find, $findoutput, $retval);
89 $last = exec(
"tar -tf $output[1]", $tarout, $retval);
92 foreach ($findoutput as $path) {
93 $basenames[] = basename($path);
97 $diffs = array_diff($tarout, $basenames);
114 "$this->command -p CP2fossTest -n fossology -a $archive_path -R -d '-R all contents saved' ",
122 echo
"output All contents is:\n"; dump($output); echo
"\n";
129 $temp_tar =
"/tmp/test.tar.bz2";
130 chdir($apath) or die(
"Can't cd to $apath, $php_errormsg\n");
132 $tcmd =
"tar -cjf $temp_tar --exclude='.svn' --exclude='.cvs' *";
133 $last = exec($tcmd, $Rtoutput, $retval);
134 $last = exec(
"tar -tf $output[1]", $tarout, $retval);
135 $last = exec(
"tar -tf $temp_tar", $Rtout, $retval);
136 foreach ($tarout as $p) {
138 $tpaths[] = rtrim($p);
140 foreach ($Rtout as $path) {
141 $Rtpaths[] = rtrim($path);
145 $diffs = array_diff($tpaths, $Rtpaths);