27 require_once
'./utility.php';
62 global $TEST_DATA_PATH;
63 global $TEST_RESULT_PATH;
65 if (empty($TEST_DATA_PATH) || empty($TEST_RESULT_PATH))
66 $this->markTestSkipped();
68 $this->testDb =
new TestPgDb(
'ununpackNormal');
69 $this->agentDir = dirname(dirname(__DIR__)).
"/";
71 $sysConf = $this->testDb->getFossSysConf();
73 $this->ununpack = $this->agentDir .
"/agent/ununpack -c " . $sysConf;
75 $this->testInstaller->init();
76 $this->testInstaller->install($this->agentDir);
78 $this->testDb->createSequences(array(),
true);
79 $this->testDb->createPlainTables(array(),
true);
80 $this->testDb->createInheritedTables(array());
81 $this->testDb->alterTables(array(),
true);
90 $this->testInstaller->uninstall($this->agentDir);
91 $this->testInstaller->clear();
92 $this->testInstaller->rmRepo();
95 global $TEST_RESULT_PATH;
97 if (!empty($TEST_RESULT_PATH));
98 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
109 $command = $this->ununpack.
" -i";
110 $last = exec($command, $usageOut, $rtn);
111 $this->assertEquals($rtn, 0);
124 global $TEST_DATA_PATH;
125 global $TEST_RESULT_PATH;
127 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/test.iso -d $TEST_RESULT_PATH";
130 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip.dir/test.dir/test.zip.dir/ununpack");
131 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip.dir/test.dir/test.jar.dir/ununpack");
144 global $TEST_DATA_PATH;
145 global $TEST_RESULT_PATH;
147 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/test.iso -d $TEST_RESULT_PATH -L $TEST_RESULT_PATH/log";
150 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip.dir/test.dir/test.zip.dir/ununpack");
151 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip.dir/test.dir/test.zip.dir/ununpack");
153 $this->assertFileExists(
"$TEST_RESULT_PATH/log");
166 global $TEST_DATA_PATH;
167 global $TEST_RESULT_PATH;
169 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/test.zip -d $TEST_RESULT_PATH -x";
171 $isDir = is_dir($TEST_RESULT_PATH .
"/test.zip.dir");
172 $this->assertTrue(!$isDir);
185 global $TEST_DATA_PATH;
186 global $TEST_RESULT_PATH;
188 $command = $this->ununpack.
" -qC -r 0 $TEST_DATA_PATH/testtwo.zip -d $TEST_RESULT_PATH";
190 $this->assertFileExists(
"$TEST_RESULT_PATH/testtwo.zip.dir/test.zip");
191 $isDir = is_dir(
"$TEST_RESULT_PATH/testtwo.zip.dir/test.zip.dir/");
192 $this->assertTrue(!$isDir);
202 global $TEST_DATA_PATH;
203 global $TEST_RESULT_PATH;
205 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/test.iso -d $TEST_RESULT_PATH";
208 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip");
218 global $TEST_DATA_PATH;
219 global $TEST_RESULT_PATH;
222 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
223 "test.rpm -d $TEST_RESULT_PATH";
225 $this->assertFileExists(
"$TEST_RESULT_PATH/test.rpm.unpacked.dir/".
226 "usr/share/fossology/bsam/VERSION");
227 $this->assertFileExists(
"$TEST_RESULT_PATH/test.rpm.unpacked.dir/".
228 "usr/share/fossology/bsam/ui/ui-license.php");
238 global $TEST_DATA_PATH;
239 global $TEST_RESULT_PATH;
241 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
242 "emptydirs.tar -d $TEST_RESULT_PATH";
245 $this->assertFileExists(
"$TEST_RESULT_PATH/emptydirs.tar.dir/emptydirs/dir2/zerolenfile");
308 global $TEST_DATA_PATH;
309 global $TEST_RESULT_PATH;
311 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
312 "test.jar -d $TEST_RESULT_PATH";
315 $this->assertFileExists(
"$TEST_RESULT_PATH/test.jar.dir/ununpack");
325 global $TEST_DATA_PATH;
326 global $TEST_RESULT_PATH;
328 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
329 "testthree.zip -d $TEST_RESULT_PATH";
332 $this->assertFileExists(
"$TEST_RESULT_PATH/testthree.zip.dir/testtwo.zip.dir/test.zip.dir/".
375 global $TEST_DATA_PATH;
376 global $TEST_RESULT_PATH;
378 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
379 "test_1-1.dsc -d $TEST_RESULT_PATH";
382 $this->assertFileExists(
"$TEST_RESULT_PATH/test_1-1.dsc.unpacked/debian/README.Debian");
393 global $TEST_DATA_PATH;
394 global $TEST_RESULT_PATH;
397 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
398 "test.z -d $TEST_RESULT_PATH";
401 $this->assertFileExists(
"$TEST_RESULT_PATH/test.z.dir/test");
404 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
405 $isDir = is_dir($TEST_RESULT_PATH);
406 $this->assertTrue(!$isDir);
408 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
409 "testdir.tar.gz -d $TEST_RESULT_PATH";
412 $this->assertFileExists(
"$TEST_RESULT_PATH/testdir.tar.gz.dir/testdir.tar");
415 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
416 $isDir = is_dir($TEST_RESULT_PATH);
417 $this->assertTrue(!$isDir);
419 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
420 "fossI16L335U29.tar.bz2 -d $TEST_RESULT_PATH";
423 $this->assertFileExists(
"$TEST_RESULT_PATH/fossI16L335U29.tar.bz2.dir/fossI16L335U29.tar.dir/fossology/README");
433 global $TEST_DATA_PATH;
434 global $TEST_RESULT_PATH;
437 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
438 "test.tar.Z -d $TEST_RESULT_PATH";
441 $this->assertFileExists(
"$TEST_RESULT_PATH/test.tar.Z.dir/test.tar.dir/dir1/ununpack");
444 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
445 $isDir = is_dir($TEST_RESULT_PATH);
446 $this->assertTrue(!$isDir);
448 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
449 "fossI16L335U29.tar.bz2 -d $TEST_RESULT_PATH";
452 $this->assertFileExists(
"$TEST_RESULT_PATH/fossI16L335U29.tar.bz2.dir/fossI16L335U29.tar.dir/fossology/README");
462 global $TEST_DATA_PATH;
463 global $TEST_RESULT_PATH;
465 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
466 "test.pdf -d $TEST_RESULT_PATH";
469 $this->assertFileExists(
"$TEST_RESULT_PATH/test.pdf.dir/test");
480 global $TEST_DATA_PATH;
481 global $TEST_RESULT_PATH;
496 global $TEST_DATA_PATH;
497 global $TEST_RESULT_PATH;
500 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
501 "ext2file.fs -d $TEST_RESULT_PATH";
504 $this->assertFileExists(
"$TEST_RESULT_PATH/ext2file.fs.dir/test.zip.dir/ununpack");
507 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
508 $isDir = is_dir($TEST_RESULT_PATH);
509 $this->assertTrue(!$isDir);
511 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
512 "ext3file.fs -d $TEST_RESULT_PATH";
515 $this->assertFileExists(
"$TEST_RESULT_PATH/ext3file.fs.dir/test.zip.dir/ununpack");
518 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
519 $isDir = is_dir($TEST_RESULT_PATH);
520 $this->assertTrue(!$isDir);
522 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
523 "fatfile.fs -d $TEST_RESULT_PATH";
526 $this->assertFileExists(
"$TEST_RESULT_PATH/fatfile.fs.dir/testtwo.zip");
529 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
530 $isDir = is_dir($TEST_RESULT_PATH);
531 $this->assertTrue(!$isDir);
533 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
534 "ntfsfile.fs -d $TEST_RESULT_PATH";
537 $this->assertFileExists(
"$TEST_RESULT_PATH/ntfsfile.fs.dir/test.zip.dir/ununpack");
564 global $TEST_DATA_PATH;
565 global $TEST_RESULT_PATH;
567 $command = $this->ununpack.
" -qCR -m 10 $TEST_DATA_PATH/".
568 "test.iso -d $TEST_RESULT_PATH";
571 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/" 572 .
"test1.zip.dir/test.dir/test.cpio");
573 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/" 574 .
"test1.zip.dir/test.dir/test.cpio.dir/ununpack");
575 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/" 576 .
"test1.zip.dir/test.dir/test.jar.dir/ununpack");
587 global $TEST_DATA_PATH;
588 global $TEST_RESULT_PATH;
590 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
591 "test.exe -d $TEST_RESULT_PATH";
595 $isDir = is_dir($TEST_RESULT_PATH .
"/test.ext.dir");
596 $this->assertTrue(!$isDir);
606 global $TEST_DATA_PATH;
607 global $TEST_RESULT_PATH;
609 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
610 "test.cpio -d $TEST_RESULT_PATH";
613 $this->assertFileExists(
"$TEST_RESULT_PATH/test.cpio.dir/ununpack");
testNormalTarball()
Check for Z, GZ and BZ2 tarballs.
testNormalRpm()
Check for RPM files.
testNormalIso1()
Pass an iso to agent.
testNormalParamL()
Pass a log file to the agent.
testNormalCompressedFile()
Check for Z, GZ and BZ2 files.
testNormalUpx()
Check for UPX files.
testNormalMultyProcess()
Check for multi process flag.
testNormalEXE()
Check for EXE files.
testNormalParamx()
Check clean flag.
tearDown()
Teardown test repo and db.
testNormalIso2()
Pass an iso to agent.
testNormalDsc()
Check for CAB and MSI files.
testNormalFsImage()
Check for disk images (file systems)
setUp()
Setup test repo and db.
Test the ununpack agent cli parameters. (Normal)
testNormalParamr()
Check recurse flag.
testNormalcpio()
Check for CPIO files.
testNormalZip()
Check for ZIP files.
testNormalJar()
Check for RAR files compressed on Windows systems.
testNormalTar()
Check for TAR files.
testNormalPdf()
Check for PDF files.
testNormalParamI()
Call agent with -i flag.