This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 8beab5603a1d7f073b5e8eb05f0504e0bd2cb520
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Fri Aug 25 09:25:08 2023 +0200

    test: Enable skipping tests for specific files
    
    Primarily to enable skipping crc checks for problematic loaders.
---
 test/Makefile.am     |  4 ++--
 test/test.cpp        | 33 +++++++++++++++++++++++++++++++++
 test/test.h          |  2 ++
 test/test_load.cpp   |  5 +++++
 test/test_load_2.cpp |  4 ++++
 test/test_save.cpp   |  6 ++++++
 6 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/test/Makefile.am b/test/Makefile.am
index c56a1f1..59aa884 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -39,13 +39,13 @@ endif
 %.c: $(top_srcdir)/src/lib/%.c
 	ln -s $< $@
 
- TEST_COMMON = test.cpp test.h
+ TEST_COMMON = test.cpp test.h strutils.c
 
 test_misc_SOURCES = $(TEST_COMMON) test_misc.cpp
 test_misc_LDADD = $(LIBS)
 
 test_string_SOURCES = $(TEST_COMMON) test_string.cpp
-nodist_test_string_SOURCES = strutils.c
+#nodist_test_string_SOURCES = strutils.c
 test_string_LDADD = $(LIBS)
 
 test_file_SOURCES = $(TEST_COMMON) test_file.cpp
diff --git a/test/test.cpp b/test/test.cpp
index b532772..efd092b 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -82,3 +82,36 @@ image_get_crc32(Imlib_Image im)
 
     return crc;
 }
+
+/**INDENT-OFF**/
+extern "C" {
+#include "strutils.h"
+}
+/**INDENT-ON**/
+
+bool
+file_skip(const char *file)
+{
+    static char   **skiplist = (char **)(-1);
+    const char     *s;
+
+    if (skiplist == (char **)(-1))
+    {
+        s = getenv("IMLIB2_TEST_FILES_SKIP");
+        skiplist = __imlib_StrSplit(s, ':');
+    }
+
+    if (!skiplist)
+        return false;
+
+    for (int i = 0; skiplist[i]; i++)
+    {
+        if (strstr(file, skiplist[i]))
+        {
+            printf("skip c %s\n", file);
+            return true;
+        }
+    }
+
+    return false;
+}
diff --git a/test/test.h b/test/test.h
index 3c8ca8f..51878ca 100644
--- a/test/test.h
+++ b/test/test.h
@@ -15,4 +15,6 @@ void            pr_info(const char *fmt, ...);
 
 unsigned int    image_get_crc32(Imlib_Image im);
 
+bool            file_skip(const char *file);
+
 #endif                          /* TEST_H */
diff --git a/test/test_load.cpp b/test/test_load.cpp
index 2fcb950..fbefeb9 100644
--- a/test/test_load.cpp
+++ b/test/test_load.cpp
@@ -116,6 +116,11 @@ test_load(void)
 
     for (i = 0; i < N_PFX; i++)
     {
+#if 0
+        if (file_skip(pfxs[i]))
+            continue;
+#endif
+
         // Load files of all types
         snprintf(fileo, sizeof(fileo), "%s/%s.%s", IMG_SRC, "icon-64", pfxs[i]);
         pr_info("Load '%s'", fileo);
diff --git a/test/test_load_2.cpp b/test/test_load_2.cpp
index 7f45863..60e5073 100644
--- a/test/test_load_2.cpp
+++ b/test/test_load_2.cpp
@@ -131,6 +131,10 @@ TEST(LOAD2, load_1)
     for (i = 0; i < NT3_IMGS; i++)
     {
         fn = tii[i].name;
+
+        if (file_skip(fn))
+            continue;
+
         if (*fn != '/')
         {
             snprintf(buf, sizeof(buf), "%s/%s", IMG_SRC, fn);
diff --git a/test/test_save.cpp b/test/test_save.cpp
index f488182..6254c80 100644
--- a/test/test_save.cpp
+++ b/test/test_save.cpp
@@ -118,6 +118,9 @@ test_save_1(const char *file, int prog, int check = 0)
     {
         ext = exts[i].ext;
 
+        if (file_skip(ext))
+            continue;
+
         imlib_context_set_image(im);
         imlib_image_set_format(ext);
         w = imlib_image_get_width();
@@ -362,6 +365,9 @@ test_save_3(const char *file, const char *dest, int err_new, int err_old)
     {
         ext = exts[i].ext;
 
+        if (file_skip(ext))
+            continue;
+
         imlib_context_set_image(im);
         imlib_image_set_format(ext);
         snprintf(fileo, sizeof(fileo), "%s", dest);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to