]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Skip KOI8 conversion test if support is missing
authorTobias Stoeckmann <tobias@stoeckmann.org>
Mon, 2 Jun 2025 19:41:09 +0000 (21:41 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 3 Jun 2025 15:27:48 +0000 (17:27 +0200)
If a unix system has no iconv support, the best effort function will
be unable to convert KOI8 to UTF-8. Skip the test if such support is
missing.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
libarchive/test/test_archive_string_conversion.c

index 12976f3e70ecb45c445b041a6d8c192531f44456..055bddc750688e6293936515e7d9ea990809b6d5 100644 (file)
@@ -991,6 +991,7 @@ DEFINE_TEST(test_archive_string_update_utf8_koi8)
        static const char koi8_string[] = "\xD0\xD2\xC9";
        static const wchar_t wcs_string[] = L"\U0000043f\U00000440\U00000438";
        struct archive_mstring mstr;
+       struct archive *a;
        int r;
 
        memset(&mstr, 0, sizeof(mstr));
@@ -999,6 +1000,15 @@ DEFINE_TEST(test_archive_string_update_utf8_koi8)
                skipping("KOI8-R locale not available on this system.");
                return;
        }
+       a = archive_write_new();
+       assertEqualInt(ARCHIVE_OK, archive_write_set_format_pax(a));
+       if (archive_write_set_options(a, "hdrcharset=UTF-8") != ARCHIVE_OK) {
+               skipping("This system cannot convert character-set"
+                   " from KOI8-R to UTF-8.");
+               archive_write_free(a);
+               return;
+       }
+       archive_write_free(a);
 
        r = archive_mstring_update_utf8(NULL, &mstr, utf8_string);