eina-suite: do not print that many errors
authorMarcel Hollerbach <mail@marcel-hollerbach.de>
Thu, 6 Feb 2020 09:49:19 +0000 (10:49 +0100)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 17 Feb 2020 21:36:01 +0000 (06:36 +0900)
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

src/tests/eina/eina_test_file.c
src/tests/eina/eina_test_inarray.c
src/tests/eina/eina_test_safepointer.c
src/tests/eina/eina_test_vpath.c

index 365b2f8..36817eb 100644 (file)
@@ -297,7 +297,7 @@ EFL_END_TEST
 
 EFL_START_TEST(eina_file_map_new_test)
 {
-   const char *eina_map_test_string = "Hello. I'm the eina map test string."; 
+   const char *eina_map_test_string = "Hello. I'm the eina map test string.";
    const char *test_file_name_part = "/example.txt";
    const char *test_file2_name_part = "/example_big.txt";
    char *test_file_path, *test_file2_path;
@@ -311,7 +311,7 @@ EFL_START_TEST(eina_file_map_new_test)
    int test_full_filename_size;
    int test_full_filename2_size;
    Eina_File *e_file, *e_file2;
-   void *file_map, *file2_map;  
+   void *file_map, *file2_map;
    int fd, correct_file_open_check, correct_map_check, map_offset, map_length, file_length, file2_length;
    int test_file_name_part_size = strlen(test_file_name_part);
    int test_file2_name_part_size = strlen(test_file2_name_part);
@@ -322,7 +322,7 @@ EFL_START_TEST(eina_file_map_new_test)
    Eina_Tmpstr *test_dirname = get_eina_test_file_tmp_dir();
    fail_if(test_dirname == NULL);
    test_dirname_size = strlen((char *)test_dirname);
-   
+
    // memory allocation
    test_full_filename_size = test_file_name_part_size + test_dirname_size + 1;
    test_file_path = (char *)malloc(test_full_filename_size);
@@ -355,9 +355,9 @@ EFL_START_TEST(eina_file_map_new_test)
    // generating file 2 full name
    strcpy(test_file2_path, (char *)test_dirname);
    strcat(test_file2_path, test_file2_name_part);
-   
+
    fd = open(test_file_path, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
-   fail_if(fd == 0);   
+   fail_if(fd == 0);
    fail_if(write(fd, eina_map_test_string, strlen(eina_map_test_string)) != (ssize_t) strlen(eina_map_test_string));
    close(fd);
 
@@ -369,7 +369,7 @@ EFL_START_TEST(eina_file_map_new_test)
    e_file = eina_file_open(test_file_path, EINA_FALSE);
    fail_if(!e_file);
    file_length = eina_file_size_get(e_file);
-   correct_file_open_check = file_length - test_string_length; 
+   correct_file_open_check = file_length - test_string_length;
    // check size of eina_map_test_string == size of file
    fail_if(correct_file_open_check != 0);
 
@@ -378,38 +378,38 @@ EFL_START_TEST(eina_file_map_new_test)
    e_file2 = eina_file_open(test_file2_path, EINA_FALSE);
    fail_if(!e_file);
    file2_length = eina_file_size_get(e_file2);
-   correct_file_open_check = file2_length - (big_buffer_size - file_min_offset); 
+   correct_file_open_check = file2_length - (big_buffer_size - file_min_offset);
    // check size of big_buffer == size of file
-   fail_if(correct_file_open_check != 0); 
+   fail_if(correct_file_open_check != 0);
 
    // test : offset > file -> length  => return NULL
    map_offset = test_string_length + file_min_offset;
    map_length = file_min_offset;
-   file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length); 
+   file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length);
    fail_if(file_map);
 
    // test : offset + length > file -> length => return NULL
    map_offset = file_min_offset;
    map_length = test_string_length;
-   file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length); 
+   file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length);
    fail_if(file_map);
    fail_if(eina_file_map_faulted(e_file, file_map));
 
    // test : offset = 0 AND length = file->length - use eina_file_map_all
    map_offset = 0;
    map_length = test_string_length;
-   file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length); 
+   file_map = eina_file_map_new(e_file, EINA_FILE_WILLNEED, map_offset, map_length);
    fail_if(!file_map);
-   correct_map_check= strcmp((char*) file_map, eina_map_test_string); 
+   correct_map_check= strcmp((char*) file_map, eina_map_test_string);
    fail_if(correct_map_check != 0);
 
    // test : offset = memory_page_size AND length = file->length - memory_page_size => correct partly map
    map_offset = memory_page_size;
    map_length = big_buffer_size - memory_page_size - file_min_offset;
-   file2_map = eina_file_map_new(e_file2, EINA_FILE_WILLNEED, map_offset, map_length); 
+   file2_map = eina_file_map_new(e_file2, EINA_FILE_WILLNEED, map_offset, map_length);
    fail_if(!file2_map);
-   correct_map_check = strcmp((char*)file2_map, big_buffer + memory_page_size); 
-   fail_if(correct_map_check != 0);  
+   correct_map_check = strcmp((char*)file2_map, big_buffer + memory_page_size);
+   fail_if(correct_map_check != 0);
 
    // test no crash with eina_file_map_populate()
    eina_file_map_populate(e_file, EINA_FILE_POPULATE, file_map, 0, 0);
@@ -744,9 +744,10 @@ EFL_START_TEST(eina_test_file_mktemp)
    errno = 0;
 
    /* test NULL */
+   EXPECT_ERROR_START;
    fd = eina_file_mkstemp(NULL, NULL);
    fail_if(fd >= 0);
-
+   EXPECT_ERROR_END;
    fd = eina_file_mkstemp(patterns[0], NULL);
    fail_if((fd < 0) || errno);
 
index 74581f2..cf671c9 100644 (file)
@@ -439,8 +439,10 @@ EFL_START_TEST(eina_inarray_test_search)
    ret = eina_inarray_search(iarr, &temp, cmp);
    fail_if(ret != 3);
 
+   EXPECT_ERROR_START;
    rval = eina_inarray_replace_at(iarr, arr_size+1, &temp);
    fail_if(rval != EINA_FALSE);
+   EXPECT_ERROR_END;
 
    ret = eina_inarray_remove(iarr, &temp);
    fail_if(ret != 3);
index c99a188..3096573 100644 (file)
@@ -167,7 +167,9 @@ EFL_START_TEST(eina_test_safepointer_lowestbit)
 
         eina_safepointer_unregister(ptr);
 
+        EXPECT_ERROR_START;
         ck_assert_ptr_eq(eina_safepointer_get(ptr), NULL);
+        EXPECT_ERROR_END;
      }
 }
 EFL_END_TEST
index 1282cc4..8db218e 100644 (file)
@@ -30,18 +30,42 @@ EFL_END_TEST
 
 EFL_START_TEST(eina_test_vpath_invalid)
 {
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("(:asdfasdfafasdf"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("(:missing_slash:)"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("(:"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("(:home:)"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("(:wrong_meta_key:)/"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("${asdfasdfafasdf"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("${missing_slash}"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("${"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("${home}"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key}/"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("${home:)"), NULL);
+   EXPECT_ERROR_END;
+   EXPECT_ERROR_START;
    ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key:)/"), NULL);
+   EXPECT_ERROR_END;
 }
 EFL_END_TEST