summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-06 10:49:19 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-02-14 09:01:06 +0100
commite84c1b6bf8377aca8d92b6c884c0d7f481c3b75b (patch)
tree4de9cca999454534543e47fce2a7a21a005e8988
parent744b2b5bd18137d1c944d2a44c96f45be0f1a565 (diff)
eina-suite: do not print that many errors
we should expect errors in these conditions, this also safes a lot of space in logs. Reviewed-by: Stefan Schmidt <stefan@datenfreihafen.org> Differential Revision: https://phab.enlightenment.org/D11296
-rw-r--r--src/tests/eina/eina_test_file.c33
-rw-r--r--src/tests/eina/eina_test_inarray.c2
-rw-r--r--src/tests/eina/eina_test_safepointer.c2
-rw-r--r--src/tests/eina/eina_test_vpath.c24
4 files changed, 45 insertions, 16 deletions
diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c
index 365b2f8..36817eb 100644
--- a/src/tests/eina/eina_test_file.c
+++ b/src/tests/eina/eina_test_file.c
@@ -297,7 +297,7 @@ EFL_END_TEST
297 297
298EFL_START_TEST(eina_file_map_new_test) 298EFL_START_TEST(eina_file_map_new_test)
299{ 299{
300 const char *eina_map_test_string = "Hello. I'm the eina map test string."; 300 const char *eina_map_test_string = "Hello. I'm the eina map test string.";
301 const char *test_file_name_part = "/example.txt"; 301 const char *test_file_name_part = "/example.txt";
302 const char *test_file2_name_part = "/example_big.txt"; 302 const char *test_file2_name_part = "/example_big.txt";
303 char *test_file_path, *test_file2_path; 303 char *test_file_path, *test_file2_path;
@@ -311,7 +311,7 @@ EFL_START_TEST(eina_file_map_new_test)
311 int test_full_filename_size; 311 int test_full_filename_size;
312 int test_full_filename2_size; 312 int test_full_filename2_size;
313 Eina_File *e_file, *e_file2; 313 Eina_File *e_file, *e_file2;
314 void *file_map, *file2_map; 314 void *file_map, *file2_map;
315 int fd, correct_file_open_check, correct_map_check, map_offset, map_length, file_length, file2_length; 315 int fd, correct_file_open_check, correct_map_check, map_offset, map_length, file_length, file2_length;
316 int test_file_name_part_size = strlen(test_file_name_part); 316 int test_file_name_part_size = strlen(test_file_name_part);
317 int test_file2_name_part_size = strlen(test_file2_name_part); 317 int test_file2_name_part_size = strlen(test_file2_name_part);
@@ -322,7 +322,7 @@ EFL_START_TEST(eina_file_map_new_test)
322 Eina_Tmpstr *test_dirname = get_eina_test_file_tmp_dir(); 322 Eina_Tmpstr *test_dirname = get_eina_test_file_tmp_dir();
323 fail_if(test_dirname == NULL); 323 fail_if(test_dirname == NULL);
324 test_dirname_size = strlen((char *)test_dirname); 324 test_dirname_size = strlen((char *)test_dirname);
325 325
326 // memory allocation 326 // memory allocation
327 test_full_filename_size = test_file_name_part_size + test_dirname_size + 1; 327 test_full_filename_size = test_file_name_part_size + test_dirname_size + 1;
328 test_file_path = (char *)malloc(test_full_filename_size); 328 test_file_path = (char *)malloc(test_full_filename_size);
@@ -355,9 +355,9 @@ EFL_START_TEST(eina_file_map_new_test)
355 // generating file 2 full name 355 // generating file 2 full name
356 strcpy(test_file2_path, (char *)test_dirname); 356 strcpy(test_file2_path, (char *)test_dirname);
357 strcat(test_file2_path, test_file2_name_part); 357 strcat(test_file2_path, test_file2_name_part);
358 358
359 fd = open(test_file_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR); 359 fd = open(test_file_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
360 fail_if(fd == 0); 360 fail_if(fd == 0);
361 fail_if(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string)); 361 fail_if(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string));
362 close(fd); 362 close(fd);
363 363
@@ -369,7 +369,7 @@ EFL_START_TEST(eina_file_map_new_test)
369 e_file = eina_file_open(test_file_path, EINA_FALSE); 369 e_file = eina_file_open(test_file_path, EINA_FALSE);
370 fail_if(!e_file); 370 fail_if(!e_file);
371 file_length = eina_file_size_get(e_file); 371 file_length = eina_file_size_get(e_file);
372 correct_file_open_check = file_length - test_string_length; 372 correct_file_open_check = file_length - test_string_length;
373 // check size of eina_map_test_string == size of file 373 // check size of eina_map_test_string == size of file
374 fail_if(correct_file_open_check != 0); 374 fail_if(correct_file_open_check != 0);
375 375
@@ -378,38 +378,38 @@ EFL_START_TEST(eina_file_map_new_test)
378 e_file2 = eina_file_open(test_file2_path, EINA_FALSE); 378 e_file2 = eina_file_open(test_file2_path, EINA_FALSE);
379 fail_if(!e_file); 379 fail_if(!e_file);
380 file2_length = eina_file_size_get(e_file2); 380 file2_length = eina_file_size_get(e_file2);
381 correct_file_open_check = file2_length - (big_buffer_size - file_min_offset); 381 correct_file_open_check = file2_length - (big_buffer_size - file_min_offset);
382 // check size of big_buffer == size of file 382 // check size of big_buffer == size of file
383 fail_if(correct_file_open_check != 0); 383 fail_if(correct_file_open_check != 0);
384 384
385 // test : offset > file -> length => return NULL 385 // test : offset > file -> length => return NULL
386 map_offset = test_string_length + file_min_offset; 386 map_offset = test_string_length + file_min_offset;
387 map_length = file_min_offset; 387 map_length = file_min_offset;
388 file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length); 388 file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length);
389 fail_if(file_map); 389 fail_if(file_map);
390 390
391 // test : offset + length > file -> length => return NULL 391 // test : offset + length > file -> length => return NULL
392 map_offset = file_min_offset; 392 map_offset = file_min_offset;
393 map_length = test_string_length; 393 map_length = test_string_length;
394 file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length); 394 file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length);
395 fail_if(file_map); 395 fail_if(file_map);
396 fail_if(eina_file_map_faulted(e_file, file_map)); 396 fail_if(eina_file_map_faulted(e_file, file_map));
397 397
398 // test : offset = 0 AND length = file->length - use eina_file_map_all 398 // test : offset = 0 AND length = file->length - use eina_file_map_all
399 map_offset = 0; 399 map_offset = 0;
400 map_length = test_string_length; 400 map_length = test_string_length;
401 file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length); 401 file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length);
402 fail_if(!file_map); 402 fail_if(!file_map);
403 correct_map_check= strcmp((char*) file_map, eina_map_test_string); 403 correct_map_check= strcmp((char*) file_map, eina_map_test_string);
404 fail_if(correct_map_check != 0); 404 fail_if(correct_map_check != 0);
405 405
406 // test : offset = memory_page_size AND length = file->length - memory_page_size => correct partly map 406 // test : offset = memory_page_size AND length = file->length - memory_page_size => correct partly map
407 map_offset = memory_page_size; 407 map_offset = memory_page_size;
408 map_length = big_buffer_size - memory_page_size - file_min_offset; 408 map_length = big_buffer_size - memory_page_size - file_min_offset;
409 file2_map = eina_file_map_new(e_file2, EINA_FILE_WILLNEED, map_offset, map_length); 409 file2_map = eina_file_map_new(e_file2, EINA_FILE_WILLNEED, map_offset, map_length);
410 fail_if(!file2_map); 410 fail_if(!file2_map);
411 correct_map_check = strcmp((char*)file2_map, big_buffer + memory_page_size); 411 correct_map_check = strcmp((char*)file2_map, big_buffer + memory_page_size);
412 fail_if(correct_map_check != 0); 412 fail_if(correct_map_check != 0);
413 413
414 // test no crash with eina_file_map_populate() 414 // test no crash with eina_file_map_populate()
415 eina_file_map_populate(e_file, EINA_FILE_POPULATE, file_map, 0, 0); 415 eina_file_map_populate(e_file, EINA_FILE_POPULATE, file_map, 0, 0);
@@ -744,9 +744,10 @@ EFL_START_TEST(eina_test_file_mktemp)
744 errno = 0; 744 errno = 0;
745 745
746 /* test NULL */ 746 /* test NULL */
747 EXPECT_ERROR_START;
747 fd = eina_file_mkstemp(NULL, NULL); 748 fd = eina_file_mkstemp(NULL, NULL);
748 fail_if(fd >= 0); 749 fail_if(fd >= 0);
749 750 EXPECT_ERROR_END;
750 fd = eina_file_mkstemp(patterns[0], NULL); 751 fd = eina_file_mkstemp(patterns[0], NULL);
751 fail_if((fd < 0) || errno); 752 fail_if((fd < 0) || errno);
752 753
diff --git a/src/tests/eina/eina_test_inarray.c b/src/tests/eina/eina_test_inarray.c
index 74581f2..cf671c9 100644
--- a/src/tests/eina/eina_test_inarray.c
+++ b/src/tests/eina/eina_test_inarray.c
@@ -439,8 +439,10 @@ EFL_START_TEST(eina_inarray_test_search)
439 ret = eina_inarray_search(iarr, &temp, cmp); 439 ret = eina_inarray_search(iarr, &temp, cmp);
440 fail_if(ret != 3); 440 fail_if(ret != 3);
441 441
442 EXPECT_ERROR_START;
442 rval = eina_inarray_replace_at(iarr, arr_size+1, &temp); 443 rval = eina_inarray_replace_at(iarr, arr_size+1, &temp);
443 fail_if(rval != EINA_FALSE); 444 fail_if(rval != EINA_FALSE);
445 EXPECT_ERROR_END;
444 446
445 ret = eina_inarray_remove(iarr, &temp); 447 ret = eina_inarray_remove(iarr, &temp);
446 fail_if(ret != 3); 448 fail_if(ret != 3);
diff --git a/src/tests/eina/eina_test_safepointer.c b/src/tests/eina/eina_test_safepointer.c
index c99a188..3096573 100644
--- a/src/tests/eina/eina_test_safepointer.c
+++ b/src/tests/eina/eina_test_safepointer.c
@@ -167,7 +167,9 @@ EFL_START_TEST(eina_test_safepointer_lowestbit)
167 167
168 eina_safepointer_unregister(ptr); 168 eina_safepointer_unregister(ptr);
169 169
170 EXPECT_ERROR_START;
170 ck_assert_ptr_eq(eina_safepointer_get(ptr), NULL); 171 ck_assert_ptr_eq(eina_safepointer_get(ptr), NULL);
172 EXPECT_ERROR_END;
171 } 173 }
172} 174}
173EFL_END_TEST 175EFL_END_TEST
diff --git a/src/tests/eina/eina_test_vpath.c b/src/tests/eina/eina_test_vpath.c
index 1282cc4..8db218e 100644
--- a/src/tests/eina/eina_test_vpath.c
+++ b/src/tests/eina/eina_test_vpath.c
@@ -30,18 +30,42 @@ EFL_END_TEST
30 30
31EFL_START_TEST(eina_test_vpath_invalid) 31EFL_START_TEST(eina_test_vpath_invalid)
32{ 32{
33 EXPECT_ERROR_START;
33 ck_assert_ptr_eq(eina_vpath_resolve("(:asdfasdfafasdf"), NULL); 34 ck_assert_ptr_eq(eina_vpath_resolve("(:asdfasdfafasdf"), NULL);
35 EXPECT_ERROR_END;
36 EXPECT_ERROR_START;
34 ck_assert_ptr_eq(eina_vpath_resolve("(:missing_slash:)"), NULL); 37 ck_assert_ptr_eq(eina_vpath_resolve("(:missing_slash:)"), NULL);
38 EXPECT_ERROR_END;
39 EXPECT_ERROR_START;
35 ck_assert_ptr_eq(eina_vpath_resolve("(:"), NULL); 40 ck_assert_ptr_eq(eina_vpath_resolve("(:"), NULL);
41 EXPECT_ERROR_END;
42 EXPECT_ERROR_START;
36 ck_assert_ptr_eq(eina_vpath_resolve("(:home:)"), NULL); 43 ck_assert_ptr_eq(eina_vpath_resolve("(:home:)"), NULL);
44 EXPECT_ERROR_END;
45 EXPECT_ERROR_START;
37 ck_assert_ptr_eq(eina_vpath_resolve("(:wrong_meta_key:)/"), NULL); 46 ck_assert_ptr_eq(eina_vpath_resolve("(:wrong_meta_key:)/"), NULL);
47 EXPECT_ERROR_END;
48 EXPECT_ERROR_START;
38 ck_assert_ptr_eq(eina_vpath_resolve("${asdfasdfafasdf"), NULL); 49 ck_assert_ptr_eq(eina_vpath_resolve("${asdfasdfafasdf"), NULL);
50 EXPECT_ERROR_END;
51 EXPECT_ERROR_START;
39 ck_assert_ptr_eq(eina_vpath_resolve("${missing_slash}"), NULL); 52 ck_assert_ptr_eq(eina_vpath_resolve("${missing_slash}"), NULL);
53 EXPECT_ERROR_END;
54 EXPECT_ERROR_START;
40 ck_assert_ptr_eq(eina_vpath_resolve("${"), NULL); 55 ck_assert_ptr_eq(eina_vpath_resolve("${"), NULL);
56 EXPECT_ERROR_END;
57 EXPECT_ERROR_START;
41 ck_assert_ptr_eq(eina_vpath_resolve("${home}"), NULL); 58 ck_assert_ptr_eq(eina_vpath_resolve("${home}"), NULL);
59 EXPECT_ERROR_END;
60 EXPECT_ERROR_START;
42 ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key}/"), NULL); 61 ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key}/"), NULL);
62 EXPECT_ERROR_END;
63 EXPECT_ERROR_START;
43 ck_assert_ptr_eq(eina_vpath_resolve("${home:)"), NULL); 64 ck_assert_ptr_eq(eina_vpath_resolve("${home:)"), NULL);
65 EXPECT_ERROR_END;
66 EXPECT_ERROR_START;
44 ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key:)/"), NULL); 67 ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key:)/"), NULL);
68 EXPECT_ERROR_END;
45} 69}
46EFL_END_TEST 70EFL_END_TEST
47 71