29 require_once (__DIR__ .
"/../../../testing/db/createEmptyTestEnvironment.php");
31 $TEST_RESULT_PATH =
"./test_result";
39 public $WGET_PATH =
"";
40 public $DB_COMMAND =
"";
42 public $SYSCONF_DIR =
"";
59 list($test_name, $db_conf, $DB_NAME,
$PG_CONN) = setupTestEnv($cwd,
"wget_agent");
61 $REPO_NAME =
"testDbRepo".$test_name;
63 $WGET_PATH =
'../../agent/wget_agent';
65 if(file_exists($WGET_PATH))
67 $usage =
'Usage: ../../agent/wget_agent [options] [OBJ]';
71 $this->assertFileExists($WGET_PATH,
72 $message =
'FATAL: cannot find executable file, stop testing\n');
75 $WGET_PATH = $WGET_PATH.
" -C -c $db_conf";
76 $last = exec(
"$WGET_PATH -h 2>&1", $out, $rtn);
77 $this->assertEquals($usage, $out[0]);
92 global $TEST_RESULT_PATH;
96 $command =
"$WGET_PATH https://mirrors.kernel.org/fossology/releases/3.0.0/fedora/20/x86_64/ -A rpm -R fossology-common-3.0.0-1.fc20.x86_64.rpm,fossology-debuginfo-3.0.0-1.fc20.x86_64.rpm,fossology-web-3.0.0-1.fc20.x86_64.rpm,fossology-3.0.0-1.fc20.src.rpm -d $TEST_RESULT_PATH";
98 $this->assertFileExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/3.0.0/fedora/20/x86_64/fossology-3.0.0-1.fc20.x86_64.rpm");
99 $this->assertFileExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/3.0.0/fedora/20/x86_64/fossology-wgetagent-3.0.0-1.fc20.x86_64.rpm");
100 $this->assertFileNotExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/3.0.0/fedora/20/x86_64/fossology-debuginfo-3.0.0-1.fc20.x86_64.rpm");
115 global $TEST_RESULT_PATH;
119 $command =
"$WGET_PATH https://mirrors.kernel.org/fossology/releases/3.0.0/debian/7.0/ -A deb -R fossology-* -d $TEST_RESULT_PATH";
122 $this->assertFileExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/3.0.0/debian/7.0/fossology_3.0.0-1_i386.deb");
123 $this->assertFileNotExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/3.0.0/debian/7.0/fossology-ununpack_3.0.0-1_amd64.deb");
138 global $TEST_RESULT_PATH;
142 $command =
"$WGET_PATH https://mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/ -A rpm -R fossology-2.0.0-1.fc15.src.rpm,fossology-common-2.0.0-1.fc15.x86_64.rpm -l 1 -d $TEST_RESULT_PATH";
145 $this->assertFileNotExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/i386/fossology-common-2.0.0-1.fc15.x86_64.rpm");
146 $this->assertFileNotExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/x86_64/fossology-common-2.0.0-1.fc15.x86_64.rpm");
147 $this->assertFileExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/i386");
148 $this->assertFileExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/x86_64");
160 global $TEST_RESULT_PATH;
164 $command =
"$WGET_PATH https://mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/i386/fossology-db-2.0.0-1.fc15.i386.rpm";
167 $this->assertFileExists(
"mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/i386/fossology-db-2.0.0-1.fc15.i386.rpm");
168 exec(
"/bin/rm -rf 'mirrors.kernel.org'");
185 $command =
"$WGET_PATH 'http://www.fossology.org/~vincent/test/test%20dir(special)/WINKERS%20-%20Final_tcm19-16386.doc' -d './test result(special)'";
188 $this->assertFileExists(
"test result(special)/www.fossology.org/~vincent/test/test dir(special)/WINKERS - Final_tcm19-16386.doc");
189 exec(
"/bin/rm -rf 'test result(special)'");
202 global $TEST_RESULT_PATH;
206 $command =
"$WGET_PATH https://mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/i386/ -A fossology* -R fossology-2.0.0-1.fc15.i386.rpm,fossology-2.0.0-1.fc15.src.rpm -d $TEST_RESULT_PATH -l 2";
209 $this->assertFileExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/i386/fossology-pkgagent-2.0.0-1.fc15.i386.rpm");
210 $this->assertFileNotExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/2.0.0/Fedora/15/i386/fossology-2.0.0-1.fc15.src.rpm");
223 global $TEST_RESULT_PATH;
227 $command =
"$WGET_PATH https://mirrors.kernel.org/fossology/releases/2.0.0/Debian/squeeze/6.0/ -A fossology-scheduler_2.0.0* -R gz,fossology-scheduler_2.0.0-1_i386* -d $TEST_RESULT_PATH -l 1";
230 $this->assertFileExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/2.0.0/Debian/squeeze/6.0/fossology-scheduler_2.0.0-1_amd64.deb");
231 $this->assertFileNotExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/2.0.0/Debian/squeeze/6.0/fossology-scheduler_2.0.0-1_i386.deb");
241 if (is_dir(
"/srv/fossology/$REPO_NAME")) {
242 exec(
"sudo chmod 2770 /srv/fossology/$REPO_NAME");
243 exec(
"sudo chown fossy /srv/fossology/$REPO_NAME -R");
244 exec(
"sudo chgrp fossy /srv/fossology/$REPO_NAME -R");
246 if (is_dir($db_conf)) {
247 exec(
"sudo chown fossy $SYSCONF_DIR -R");
248 exec(
"sudo chgrp fossy $SYSCONF_DIR -R");
259 $foss_conf = $db_conf.
"/fossology.conf";
260 exec(
"sudo sed 's/.$proxy_type.*=.*/$proxy_type=$porxy/' $foss_conf >/tmp/fossology.conf");
261 exec(
"sudo mv /tmp/fossology.conf $foss_conf");
273 global $TEST_RESULT_PATH;
278 $command =
"$WGET_PATH ftp://releases.ubuntu.com/releases/trusty/SHA1SUMS -d $TEST_RESULT_PATH";
280 $this->assertFileExists(
"$TEST_RESULT_PATH/releases.ubuntu.com/releases/trusty/SHA1SUMS");
292 global $TEST_RESULT_PATH;
296 $command =
"$WGET_PATH https://mirrors.kernel.org/fossology/releases/2.0.0/Debian/squeeze/6.0/fossology-mimetype_2.0.0-1_amd64.deb -d $TEST_RESULT_PATH";
298 $this->assertFileExists(
"$TEST_RESULT_PATH/mirrors.kernel.org/fossology/releases/2.0.0/Debian/squeeze/6.0/fossology-mimetype_2.0.0-1_amd64.deb");
302 $command =
"$WGET_PATH https://mirrors.kernel.org/fossology/releases/2.0.0/Debian/squeeze/6.0/fossology-mimetype_2.0.0-1_amd64.deb -d $TEST_RESULT_PATH";
316 global $TEST_RESULT_PATH;
321 $command =
"$WGET_PATH https://www.google.com/images/srpr/nav_logo80.png -l 1 -d $TEST_RESULT_PATH";
323 $this->assertFileExists(
"$TEST_RESULT_PATH/www.google.com/images/srpr/nav_logo80.png");
331 global $TEST_RESULT_PATH;
337 exec(
"/bin/rm -rf $TEST_RESULT_PATH $SYSCONF_DIR");
339 if (!empty($DB_COMMAND) && !empty($DB_NAME)) {
340 exec(
"$DB_COMMAND -d $DB_NAME");
test_proxy_ftp()
Test proxy ftp.
test_proxy_http()
Test proxy http and no proxy.
test_proxy_https()
Test proxy https.
testDownloadDirCurrentDirLevel0()
Download one file(one url)
change_proxy($proxy_type, $porxy)
Change proxy to test.
testDownloadAcceptRejectType1()
download one dir(one url)
preparations()
Replace default repo with new repo.
testDownloadDirHasNoChildDirLevel0()
Download one dir(one url)
testDownloadDirHasChildDirLevel0()
download one dir(one url)
testtDownloadAcceptRejectType2()
download one dir(one url)
testDownloadDirHasChildDirLevel1()
Download one dir(one url)
foreach($Options as $Option=> $OptVal) if(0==$reference_flag &&0==$nomos_flag) $PG_CONN
list_t type structure used to keep various lists. (e.g. there are multiple lists).
testDownloadURLDesAbnormal()
download one file(one url)