16 require_once __DIR__.
'/utility.php';
51 global $TEST_DATA_PATH;
52 global $TEST_RESULT_PATH;
54 if (empty($TEST_DATA_PATH) || empty($TEST_RESULT_PATH))
55 $this->markTestSkipped();
57 $this->testDb =
new TestPgDb(
'ununpackNormal');
58 $this->agentDir = dirname(__DIR__, 4).
"/build/src/ununpack";
60 $sysConf = $this->testDb->getFossSysConf();
62 $this->ununpack = $this->agentDir .
"/agent/ununpack -c " . $sysConf;
64 $this->testInstaller->init();
65 $this->testInstaller->install($this->agentDir);
67 $this->testDb->createSequences(array(),
true);
68 $this->testDb->createPlainTables(array(),
true);
69 $this->testDb->createInheritedTables(array());
70 $this->testDb->alterTables(array(),
true);
79 $this->testInstaller->uninstall($this->agentDir);
80 $this->testInstaller->clear();
81 $this->testInstaller->rmRepo();
84 global $TEST_RESULT_PATH;
86 if (!empty($TEST_RESULT_PATH));
87 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
98 $command = $this->ununpack.
" -i";
99 $last = exec($command, $usageOut, $rtn);
100 $this->assertEquals($rtn, 0);
113 global $TEST_DATA_PATH;
114 global $TEST_RESULT_PATH;
116 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/test.iso -d $TEST_RESULT_PATH";
119 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip.dir/test.dir/test.zip.dir/ununpack");
120 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip.dir/test.dir/test.jar.dir/ununpack");
133 global $TEST_DATA_PATH;
134 global $TEST_RESULT_PATH;
136 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/test.iso -d $TEST_RESULT_PATH -L $TEST_RESULT_PATH/log";
139 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip.dir/test.dir/test.zip.dir/ununpack");
140 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip.dir/test.dir/test.zip.dir/ununpack");
142 $this->assertFileExists(
"$TEST_RESULT_PATH/log");
155 global $TEST_DATA_PATH;
156 global $TEST_RESULT_PATH;
158 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/test.zip -d $TEST_RESULT_PATH -x";
160 $isDir = is_dir($TEST_RESULT_PATH .
"/test.zip.dir");
161 $this->assertTrue(!$isDir);
174 global $TEST_DATA_PATH;
175 global $TEST_RESULT_PATH;
177 $command = $this->ununpack.
" -qC -r 0 $TEST_DATA_PATH/testtwo.zip -d $TEST_RESULT_PATH";
179 $this->assertFileExists(
"$TEST_RESULT_PATH/testtwo.zip.dir/test.zip");
180 $isDir = is_dir(
"$TEST_RESULT_PATH/testtwo.zip.dir/test.zip.dir/");
181 $this->assertTrue(!$isDir);
191 global $TEST_DATA_PATH;
192 global $TEST_RESULT_PATH;
194 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/test.iso -d $TEST_RESULT_PATH";
197 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/test1.zip");
207 global $TEST_DATA_PATH;
208 global $TEST_RESULT_PATH;
211 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
212 "test.rpm -d $TEST_RESULT_PATH";
214 $this->assertFileExists(
"$TEST_RESULT_PATH/test.rpm.unpacked.dir/".
215 "usr/share/fossology/bsam/VERSION");
216 $this->assertFileExists(
"$TEST_RESULT_PATH/test.rpm.unpacked.dir/".
217 "usr/share/fossology/bsam/ui/ui-license.php");
227 global $TEST_DATA_PATH;
228 global $TEST_RESULT_PATH;
230 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
231 "emptydirs.tar -d $TEST_RESULT_PATH";
234 $this->assertFileExists(
"$TEST_RESULT_PATH/emptydirs.tar.dir/emptydirs/dir2/zerolenfile");
297 global $TEST_DATA_PATH;
298 global $TEST_RESULT_PATH;
300 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
301 "test.jar -d $TEST_RESULT_PATH";
304 $this->assertFileExists(
"$TEST_RESULT_PATH/test.jar.dir/ununpack");
314 global $TEST_DATA_PATH;
315 global $TEST_RESULT_PATH;
317 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
318 "testthree.zip -d $TEST_RESULT_PATH";
321 $this->assertFileExists(
"$TEST_RESULT_PATH/testthree.zip.dir/testtwo.zip.dir/test.zip.dir/".
364 global $TEST_DATA_PATH;
365 global $TEST_RESULT_PATH;
367 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
368 "test_1-1.dsc -d $TEST_RESULT_PATH";
371 $this->assertFileExists(
"$TEST_RESULT_PATH/test_1-1.dsc.unpacked/debian/README.Debian");
382 global $TEST_DATA_PATH;
383 global $TEST_RESULT_PATH;
386 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
387 "test.z -d $TEST_RESULT_PATH";
390 $this->assertFileExists(
"$TEST_RESULT_PATH/test.z.dir/test");
393 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
394 $isDir = is_dir($TEST_RESULT_PATH);
395 $this->assertTrue(!$isDir);
397 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
398 "testdir.tar.gz -d $TEST_RESULT_PATH";
401 $this->assertFileExists(
"$TEST_RESULT_PATH/testdir.tar.gz.dir/testdir.tar");
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 "fossI16L335U29.tar.bz2 -d $TEST_RESULT_PATH";
412 $this->assertFileExists(
"$TEST_RESULT_PATH/fossI16L335U29.tar.bz2.dir/fossI16L335U29.tar.dir/fossology/README");
422 global $TEST_DATA_PATH;
423 global $TEST_RESULT_PATH;
426 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
427 "test.tar.Z -d $TEST_RESULT_PATH";
430 $this->assertFileExists(
"$TEST_RESULT_PATH/test.tar.Z.dir/test.tar.dir/dir1/ununpack");
433 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
434 $isDir = is_dir($TEST_RESULT_PATH);
435 $this->assertTrue(!$isDir);
437 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
438 "fossI16L335U29.tar.bz2 -d $TEST_RESULT_PATH";
441 $this->assertFileExists(
"$TEST_RESULT_PATH/fossI16L335U29.tar.bz2.dir/fossI16L335U29.tar.dir/fossology/README");
451 global $TEST_DATA_PATH;
452 global $TEST_RESULT_PATH;
454 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
455 "test.pdf -d $TEST_RESULT_PATH";
458 $this->assertFileExists(
"$TEST_RESULT_PATH/test.pdf.dir/test");
485 global $TEST_DATA_PATH;
486 global $TEST_RESULT_PATH;
489 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
490 "ext2file.fs -d $TEST_RESULT_PATH";
493 $this->assertFileExists(
"$TEST_RESULT_PATH/ext2file.fs.dir/testtwo.zip.dir/test.zip.dir/ununpack");
496 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
497 $isDir = is_dir($TEST_RESULT_PATH);
498 $this->assertTrue(!$isDir);
500 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
501 "ext3file.fs -d $TEST_RESULT_PATH";
504 $this->assertFileExists(
"$TEST_RESULT_PATH/ext3file.fs.dir/testtwo.zip.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 "fatfile.fs -d $TEST_RESULT_PATH";
515 $this->assertFileExists(
"$TEST_RESULT_PATH/fatfile.fs.dir/testtwo.zip");
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 "ntfsfile.fs -d $TEST_RESULT_PATH";
526 $this->assertFileExists(
"$TEST_RESULT_PATH/ntfsfile.fs.dir/testtwo.zip.dir/test.zip.dir/ununpack");
553 global $TEST_DATA_PATH;
554 global $TEST_RESULT_PATH;
556 $command = $this->ununpack.
" -qCR -m 10 $TEST_DATA_PATH/".
557 "test.iso -d $TEST_RESULT_PATH";
560 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/"
561 .
"test1.zip.dir/test.dir/test.cpio");
562 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/"
563 .
"test1.zip.dir/test.dir/test.cpio.dir/ununpack");
564 $this->assertFileExists(
"$TEST_RESULT_PATH/test.iso.dir/test1.zip.tar.dir/"
565 .
"test1.zip.dir/test.dir/test.jar.dir/ununpack");
576 global $TEST_DATA_PATH;
577 global $TEST_RESULT_PATH;
579 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
580 "test.exe -d $TEST_RESULT_PATH";
584 $isDir = is_dir($TEST_RESULT_PATH .
"/test.ext.dir");
585 $this->assertTrue(!$isDir);
595 global $TEST_DATA_PATH;
596 global $TEST_RESULT_PATH;
598 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
599 "test.cpio -d $TEST_RESULT_PATH";
602 $this->assertFileExists(
"$TEST_RESULT_PATH/test.cpio.dir/ununpack");
613 global $TEST_DATA_PATH;
614 global $TEST_RESULT_PATH;
617 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
618 "test.zst -d $TEST_RESULT_PATH";
621 $this->assertFileExists(
"$TEST_RESULT_PATH/test.zst.dir/test.tar");
624 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
625 $isDir = is_dir($TEST_RESULT_PATH);
626 $this->assertTrue(!$isDir);
637 global $TEST_DATA_PATH;
638 global $TEST_RESULT_PATH;
641 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
642 "test.lz4 -d $TEST_RESULT_PATH";
645 $this->assertFileExists(
"$TEST_RESULT_PATH/test.lz4.dir/test.tar");
648 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
649 $isDir = is_dir($TEST_RESULT_PATH);
650 $this->assertTrue(!$isDir);
661 global $TEST_DATA_PATH;
662 global $TEST_RESULT_PATH;
665 $command = $this->ununpack.
" -qCR $TEST_DATA_PATH/".
666 "test.lzma -d $TEST_RESULT_PATH";
669 $this->assertFileExists(
"$TEST_RESULT_PATH/test.lzma.dir/test.tar");
672 exec(
"/bin/rm -rf $TEST_RESULT_PATH");
673 $isDir = is_dir($TEST_RESULT_PATH);
674 $this->assertTrue(!$isDir);
Test the ununpack agent cli parameters. (Normal)
testNormalJar()
Check for RAR files compressed on Windows systems.
testNormalZst()
Check for ZST file.
testNormalDsc()
Check for CAB and MSI files.
testNormalZip()
Check for ZIP files.
testNormalMultyProcess()
Check for multi process flag.
testNormalEXE()
Check for EXE files.
testNormalIso1()
Pass an iso to agent.
testNormalCompressedFile()
Check for Z, GZ and BZ2 files.
testNormalParamI()
Call agent with -i flag.
tearDown()
Teardown test repo and db.
testNormalLzma()
Check for lzma file.
testNormalParamr()
Check recurse flag.
testNormalPdf()
Check for PDF files.
testNormalIso2()
Pass an iso to agent.
testNormalTarball()
Check for Z, GZ and BZ2 tarballs.
testNormalTar()
Check for TAR files.
testNormalLz4()
Check for lz4 file.
testNormalcpio()
Check for CPIO files.
testNormalRpm()
Check for RPM files.
testNormalParamx()
Check clean flag.
testNormalFsImage()
Check for UPX files.
setUp()
Setup test repo and db.
testNormalParamL()
Pass a log file to the agent.