Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/libarchive/dist/test_utils Fix printf formats i...



details:   https://anonhg.NetBSD.org/src/rev/90e146ec37ea
branches:  trunk
changeset: 968599:90e146ec37ea
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 21 18:33:47 2020 +0000

description:
Fix printf formats in tests for the clang build.

diffstat:

 external/bsd/libarchive/dist/cat/test/test_0.c                                                    |   2 +-
 external/bsd/libarchive/dist/cpio/test/test_basic.c                                               |  14 ++++----
 external/bsd/libarchive/dist/cpio/test/test_format_newc.c                                         |  15 ++++++---
 external/bsd/libarchive/dist/libarchive/test/test_compat_zip.c                                    |  10 +++---
 external/bsd/libarchive/dist/libarchive/test/test_fuzz.c                                          |   3 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_extract.c                                  |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_gtar_sparse.c                       |   5 ++-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip.c                               |   8 ++--
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_7075_utf8_paths.c               |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_comment_stored.c                |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_extra_padding.c                 |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.c              |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_jar.c                           |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_mac_metadata.c                  |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_malformed.c                     |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_msdos.c                         |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_nested.c                        |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_nofiletype.c                    |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_padded.c                        |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_sfx.c                           |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_zip64.c                         |   4 +-
 external/bsd/libarchive/dist/libarchive/test/test_read_pax_truncated.c                            |   6 ++--
 external/bsd/libarchive/dist/libarchive/test/test_read_truncated_filter.c                         |   4 +-
 external/bsd/libarchive/dist/libarchive/test/test_sparse_basic.c                                  |   4 +-
 external/bsd/libarchive/dist/libarchive/test/test_write_disk.c                                    |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_write_format_cpio_empty.c                       |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_write_format_shar_empty.c                       |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_write_format_tar.c                              |   2 +-
 external/bsd/libarchive/dist/libarchive/test/test_write_format_tar_sparse.c                       |   4 +-
 external/bsd/libarchive/dist/tar/test/test_basic.c                                                |   2 +-
 external/bsd/libarchive/dist/tar/test/test_copy.c                                                 |   4 +-
 external/bsd/libarchive/dist/tar/test/test_option_C_upper.c                                       |   2 +-
 external/bsd/libarchive/dist/tar/test/test_option_s.c                                             |   6 +--
 external/bsd/libarchive/dist/test_utils/test_common.h                                             |  15 +++++++--
 external/bsd/libarchive/dist/test_utils/test_main.c                                               |  14 ++++----
 36 files changed, 85 insertions(+), 73 deletions(-)

diffs (truncated from 714 to 300 lines):

diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/cat/test/test_0.c
--- a/external/bsd/libarchive/dist/cat/test/test_0.c    Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/cat/test/test_0.c    Tue Jan 21 18:33:47 2020 +0000
@@ -59,7 +59,7 @@
         * we know some option that will succeed.
         */
        if (0 != systemf("%s --version >" DEV_NULL, testprog)) {
-               failure("Unable to successfully run: %s --version\n", testprog, testprog);
+               failure("Unable to successfully run: %s --version\n", testprog);
                assert(0);
        }
 
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/cpio/test/test_basic.c
--- a/external/bsd/libarchive/dist/cpio/test/test_basic.c       Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/cpio/test/test_basic.c       Tue Jan 21 18:33:47 2020 +0000
@@ -33,15 +33,15 @@
         */
 
        /* Regular file with 2 links. */
-       failure(msg);
+       failure("%s", msg);
        assertIsReg("file", 0644);
-       failure(msg);
+       failure("%s", msg);
        assertFileSize("file", 10);
-       failure(msg);
+       failure("%s", msg);
        assertFileNLinks("file", 2);
 
        /* Another name for the same file. */
-       failure(msg);
+       failure("%s", msg);
        assertIsHardlink("linkfile", "file");
 
        /* Symlink */
@@ -49,11 +49,11 @@
                assertIsSymlink("symlink", "file", 0);
 
        /* Another file with 1 link and different permissions. */
-       failure(msg);
+       failure("%s", msg);
        assertIsReg("file2", 0777);
-       failure(msg);
+       failure("%s", msg);
        assertFileSize("file2", 10);
-       failure(msg);
+       failure("%s", msg);
        assertFileNLinks("file2", 1);
 
        /* dir */
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/cpio/test/test_format_newc.c
--- a/external/bsd/libarchive/dist/cpio/test/test_format_newc.c Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/cpio/test/test_format_newc.c Tue Jan 21 18:33:47 2020 +0000
@@ -205,9 +205,11 @@
        gid = from_hex(e + 30, 8); /* gid */
        assertEqualMem(e + 38, "00000003", 8); /* nlink */
        t = from_hex(e + 46, 8); /* mtime */
-       failure("t=0x%08x now=0x%08x=%d", t, now, now);
+       failure("t=%#08jx now=%#08jx=%jd", (intmax_t)t, (intmax_t)now,
+           (intmax_t)now);
        assert(t <= now); /* File wasn't created in future. */
-       failure("t=0x%08x now - 2=0x%08x = %d", t, now - 2, now - 2);
+       failure("t=%#08jx now - 2=%#08jx=%jd", (intmax_t)t, (intmax_t)now - 2,
+           (intmax_t)now - 2);
        assert(t >= now - 2); /* File was created w/in last 2 secs. */
        failure("newc format stores body only with last appearance of a link\n"
            "       first appearance should be empty, so this file size\n"
@@ -243,7 +245,8 @@
                assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
                assertEqualMem(e + 38, "00000001", 8); /* nlink */
                t2 = from_hex(e + 46, 8); /* mtime */
-               failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+               failure("First entry created at t=%#08jx this entry created"
+                   " at t2=%#08jx", (intmax_t)t, (intmax_t)t2);
                assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
                assertEqualMem(e + 54, "00000005", 8); /* File size */
                fs = from_hex(e + 54, 8);
@@ -278,7 +281,8 @@
        assertEqualInt(nlinks("dir"), from_hex(e + 38, 8)); /* nlinks */
 #endif
        t2 = from_hex(e + 46, 8); /* mtime */
-       failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+       failure("First entry created at t=%#08jx this entry created at"
+           "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
        assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
        assertEqualMem(e + 54, "00000000", 8); /* File size */
        fs = from_hex(e + 54, 8);
@@ -311,7 +315,8 @@
        assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
        assertEqualMem(e + 38, "00000003", 8); /* nlink */
        t2 = from_hex(e + 46, 8); /* mtime */
-       failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+       failure("First entry created at t=%#08jx this entry created at"
+           "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
        assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
        assertEqualInt(10, from_hex(e + 54, 8)); /* File size */
        fs = from_hex(e + 54, 8);
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_compat_zip.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_compat_zip.c    Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_compat_zip.c    Tue Jan 21 18:33:47 2020 +0000
@@ -156,7 +156,7 @@
        size_t s;
 
        extract_reference_file(refname);
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
 
        /* SFX files require seek support. */
        assert((a = archive_read_new()) != NULL);
@@ -214,7 +214,7 @@
        size_t s;
 
        extract_reference_file(refname);
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
 
        /* Verify with seek support.
         * Everything works correctly here. */
@@ -370,7 +370,7 @@
        size_t s;
 
        extract_reference_file(refname);
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
 
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
@@ -402,7 +402,7 @@
        int i;
 
        extract_reference_file(refname);
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
 
        for (i = 1; i < 1000; ++i) {
                assert((a = archive_read_new()) != NULL);
@@ -436,7 +436,7 @@
        size_t s;
 
        extract_reference_file(refname);
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
 
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a));
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_fuzz.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_fuzz.c  Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_fuzz.c  Tue Jan 21 18:33:47 2020 +0000
@@ -119,7 +119,8 @@
                        for (i = 0; filesets[n].names[i] != NULL; ++i)
                        {
                                char *newraw;
-                               tmp = slurpfile(&size, filesets[n].names[i]);
+                               tmp = slurpfile(&size, "%s",
+                                               filesets[n].names[i]);
                                newraw = realloc(rawimage, oldsize + size);
                                if (!assert(newraw != NULL))
                                {
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_extract.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_extract.c  Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_extract.c  Tue Jan 21 18:33:47 2020 +0000
@@ -120,7 +120,7 @@
        assertA(0 == archive_read_support_filter_all(a));
        assertA(0 == archive_read_open_memory(a, buff, BUFF_SIZE));
        /* Restore first entry with _EXTRACT_PERM. */
-       failure("Error reading first entry", i);
+       failure("Error reading first entry");
        assertA(0 == archive_read_next_header(a, &ae));
        assertA(0 == archive_read_extract(a, ae, ARCHIVE_EXTRACT_PERM));
        /* Rest of entries get restored with no flags. */
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_format_gtar_sparse.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_format_gtar_sparse.c       Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_format_gtar_sparse.c       Tue Jan 21 18:33:47 2020 +0000
@@ -214,8 +214,9 @@
                                         * Any byte before the expected
                                         * data must be NULL.
                                         */
-                                       failure("%s: pad at offset %d "
-                                           "should be zero", name, actual.o);
+                                       failure("%s: pad at offset %jd "
+                                               "should be zero", name,
+                                               (intmax_t)actual.o);
                                        assertEqualInt(c, 0);
                                } else if (actual.o == expect.o) {
                                        /*
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_format_zip.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip.c       Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip.c       Tue Jan 21 18:33:47 2020 +0000
@@ -194,7 +194,7 @@
        verify_basic(a, 1);
 
        /* Verify with streaming reader. */
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
@@ -264,7 +264,7 @@
        verify_info_zip_ux(a, 1);
 
        /* Verify with streaming reader. */
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
@@ -328,7 +328,7 @@
        verify_extract_length_at_end(a, 1);
 
        /* Verify extraction with streaming reader. */
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
@@ -347,7 +347,7 @@
        struct archive_entry *ae;
 
        extract_reference_file(refname);
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
 
        /* Symlinks can only be extracted with the seeking reader. */
        assert((a = archive_read_new()) != NULL);
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_7075_utf8_paths.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_7075_utf8_paths.c       Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_7075_utf8_paths.c       Tue Jan 21 18:33:47 2020 +0000
@@ -90,7 +90,7 @@
        assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a));
 
        /* Verify with streaming reader. */
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_comment_stored.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_comment_stored.c        Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_comment_stored.c        Tue Jan 21 18:33:47 2020 +0000
@@ -38,7 +38,7 @@
        struct archive_entry *ae;
 
        extract_reference_file(refname);
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
 
        /* Symlinks can only be extracted with the seeking reader. */
        assert((a = archive_read_new()) != NULL);
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_extra_padding.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_extra_padding.c Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_extra_padding.c Tue Jan 21 18:33:47 2020 +0000
@@ -80,7 +80,7 @@
        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
 
        /* Verify with streaming reader. */
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.c      Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_high_compression.c      Tue Jan 21 18:33:47 2020 +0000
@@ -56,7 +56,7 @@
        }
 
        extract_reference_file(refname);
-       p = slurpfile(&archive_size, refname);
+       p = slurpfile(&archive_size, "%s", refname);
 
        assert((a = archive_read_new()) != NULL);
         assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a));
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_jar.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_jar.c   Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_jar.c   Tue Jan 21 18:33:47 2020 +0000
@@ -40,7 +40,7 @@
        char data[16];
 
        extract_reference_file(refname);
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
 
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip_seekable(a));
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_mac_metadata.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_mac_metadata.c  Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_mac_metadata.c  Tue Jan 21 18:33:47 2020 +0000
@@ -76,7 +76,7 @@
        };
 
        extract_reference_file(refname);
-       p = slurpfile(&s, refname);
+       p = slurpfile(&s, "%s", refname);
 
        /* Mac metadata can only be extracted with the seeking reader. */
        assert((a = archive_read_new()) != NULL);
diff -r 1e1c6ac8d770 -r 90e146ec37ea external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_malformed.c
--- a/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_malformed.c     Tue Jan 21 16:46:07 2020 +0000
+++ b/external/bsd/libarchive/dist/libarchive/test/test_read_format_zip_malformed.c     Tue Jan 21 18:33:47 2020 +0000
@@ -46,7 +46,7 @@



Home | Main Index | Thread Index | Old Index