19 #include <CUnit/CUnit.h> 20 #include "wget_agent.h" 22 #include "libfodbreposysconf.h" 39 static char TempFile[MAX_LENGTH];
40 static char URL[MAX_LENGTH];
41 static char TempFileDir[MAX_LENGTH];
55 if (file_dir_existed(TempFileDir))
78 strcpy(URL,
"https://mirrors.kernel.org/fossology/releases/3.0.0/ubuntu/14.04/fossology.sources.list");
79 strcpy(TempFileDir,
"./test_result");
80 GetURL(TempFile, URL, TempFileDir);
81 int existed = file_dir_existed(
"./test_result/mirrors.kernel.org/fossology/releases/3.0.0/ubuntu/14.04/fossology.sources.list");
82 CU_ASSERT_EQUAL(existed, 1);
100 strcpy(URL,
"https://mirrors.kernel.org/fossology/releases/3.0.0/ubuntu/14.04/");
101 strcpy(TempFileDir,
"./test_result/");
102 strcpy(TempFile,
"./test_result/fossology.sources.list");
103 GetURL(TempFile, URL, TempFileDir);
104 int existed = file_dir_existed(
"./test_result/fossology.sources.list");
105 CU_ASSERT_EQUAL(existed, 1);
int GetURLClean()
clean the env
int RemoveDir(char *dirpath)
Remove all files under dirpath (rm -rf)
char GlobalParam[STRMAX]
Additional parameters.
int GetURL(char *TempFile, char *URL, char *TempFileDir)
Do the wget.
int GetURLInit()
initialize
void testGetURLAbnormal_URLIsOneDir()
the URL is one dir
CU_TestInfo testcases_GetURL[]
testcases for function GetURL
void testGetURLNormal_URLIsOneFile()
The URL is one file.