78 int i,countPackages, transferResult;
79 static
int g_numFailed = 0;
82 void printTestResultPositiveExpected(const
char *function,
int result){
85 printf(
"%s successful\n",
function);
89 printf(
"%s failed\n",
function);
99 printf(
"%s successful\n",
function);
103 printf(
"%s failed\n",
function);
116 if(transferResult < 0 )
118 printf(
"Error: dlt_user_log_file_complete\n");
119 return transferResult;
124 printTestResultPositiveExpected(__FUNCTION__,transferResult);
126 return transferResult;
131 int total_size, used_size;
135 if(countPackages < 0 )
137 printf(
"Error: dlt_user_log_file_packagesCount\n");
138 printTestResultPositiveExpected(__FUNCTION__,countPackages);
147 if(transferResult >= 0)
150 for(i=1;i<=countPackages;i++)
153 if((total_size - used_size) < (total_size/2))
155 printf(
"Error: dlt_user_log_file_data\n");
156 printTestResultPositiveExpected(__FUNCTION__,transferResult);
162 if(transferResult < 0)
164 printf(
"Error: dlt_user_log_file_data\n");
165 printTestResultPositiveExpected(__FUNCTION__,transferResult);
166 return transferResult;
173 if(transferResult < 0)
175 printf(
"Error: dlt_user_log_file_end\n");
176 printTestResultPositiveExpected(__FUNCTION__,transferResult);
177 return transferResult;
182 printf(
"Error: dlt_user_log_file_header\n");
183 printTestResultPositiveExpected(__FUNCTION__,transferResult);
184 return transferResult;
189 printTestResultPositiveExpected(__FUNCTION__,transferResult);
199 if(transferResult < 0)
201 printf(
"Error: dlt_user_log_file_complete\n");
202 printTestResultPositiveExpected(__FUNCTION__,transferResult);
203 return transferResult;
207 printTestResultPositiveExpected(__FUNCTION__,transferResult);
208 return transferResult;
213 int total_size, used_size;
217 if(countPackages < 0 )
219 printf(
"Error: dlt_user_log_file_packagesCount\n");
220 printTestResultPositiveExpected(__FUNCTION__,countPackages);
230 if( transferResult >= 0){
233 for(i=1;i<=countPackages;i++)
236 if((total_size - used_size) < (total_size/2))
238 printf(
"Error: dlt_user_log_file_data\n");
239 printTestResultPositiveExpected(__FUNCTION__,transferResult);
245 if(transferResult < 0)
247 printf(
"Error: dlt_user_log_file_data\n");
248 printTestResultPositiveExpected(__FUNCTION__,transferResult);
249 return transferResult;
256 if(transferResult < 0)
258 printf(
"Error: dlt_user_log_file_end\n");
259 printTestResultPositiveExpected(__FUNCTION__,transferResult);
260 return transferResult;
265 printf(
"Error: dlt_user_log_file_header\n");
266 printTestResultPositiveExpected(__FUNCTION__,transferResult);
267 return transferResult;
271 printTestResultPositiveExpected(__FUNCTION__,transferResult);
283 if(transferResult < 0)
290 return transferResult;
293 return transferResult;
302 if(countPackages < 0 )
317 if( transferResult >= 0){
320 for(i=1;i<=countPackages;i++)
324 if(transferResult < 0)
326 printf(
"Error: dlt_user_log_file_data\n");
328 return transferResult;
335 if(transferResult < 0)
337 printf(
"Error: dlt_user_log_file_end\n");
339 return transferResult;
355 if(transferResult < 0)
362 return transferResult;
372 file1 =
"/usr/local/share/dlt-filetransfer/dlt-test-filetransfer-file";
374 file2 =
"/usr/local/share/dlt-filetransfer/dlt-test-filetransfer-image.png";
376 file3_1 =
"dlt-test-filetransfer-doesntExist_1";
378 file3_2 =
"dlt-test-filetransfer-doesntExist_2";
380 file3_3 =
"dlt-test-filetransfer-doesntExist_3";
407 return g_numFailed == 0 ? 0 : 1;
int dlt_user_log_file_complete(DltContext *fileContext, const char *filename, int deleteFlag, int timeout)
Transfer the complete file as several dlt logs.
#define DLT_UNREGISTER_APP()
int testFile2Run2()
Test the file transfer with the condition that the transferred file is bigger as the file transfer bu...
void printTestResultNegativeExpected(const char *function, int result)
Prints the test result.
int main(void)
Main program dlt-test-filestransfer starts here.
int testFile2Run1()
Test the file transfer with the condition that the transferred file is bigger as the file transfer bu...
DLT_DECLARE_CONTEXT(mainContext)
Declare some context for the main program. It's a must have to do this, when you want to log with dlt...
int dlt_user_log_file_packagesCount(DltContext *fileContext, const char *filename)
This method gives information about the number of packages the file have.
int testFile3Run2()
Test the file transfer with the condition that the transferred file does not exist using single packa...
#define DLT_REGISTER_APP(APPID, DESCRIPTION)
DltReturnValue dlt_user_check_buffer(int *total_size, int *used_size)
#define DLT_REGISTER_CONTEXT(CONTEXT, CONTEXTID, DESCRIPTION)
int dlt_user_log_file_header(DltContext *fileContext, const char *filename)
Transfer the head of the file as a dlt logs.
int testFile3Run3()
Logs some information about the file.
#define DLT_UNREGISTER_CONTEXT(CONTEXT)
int dlt_user_log_file_end(DltContext *fileContext, const char *filename, int deleteFlag)
Transfer the end of the file as a dlt logs.
int dlt_user_log_file_data(DltContext *fileContext, const char *filename, int packageToTransfer, int timeout)
Transfer the content data of a file.
int dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename)
Logs specific file inforamtions to dlt.
int testFile1Run2()
Test the file transfer with the condition that the transferred file is smaller as the file transfer b...
#define DLT_LOG(CONTEXT, LOGLEVEL, ARGS...)
int testFile3Run1()
Test the file transfer with the condition that the transferred file does not exist using dlt_user_log...
int testFile1Run1()
Test the file transfer with the condition that the transferred file is smaller as the file transfer b...