diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libarchive/test/main.c | 9 | ||||
-rw-r--r-- | lib/libarchive/test/test.h | 1 | ||||
-rw-r--r-- | lib/libarchive/test/test_read_compress_program.c | 12 | ||||
-rw-r--r-- | lib/libarchive/test/test_read_format_cpio_bin_Z.c | 23 | ||||
-rw-r--r-- | lib/libarchive/test/test_read_format_cpio_svr4c_Z.c | 22 | ||||
-rw-r--r-- | lib/libarchive/test/test_read_format_tz.c | 21 |
6 files changed, 59 insertions, 29 deletions
diff --git a/lib/libarchive/test/main.c b/lib/libarchive/test/main.c index 24ea6c7..6322f6f 100644 --- a/lib/libarchive/test/main.c +++ b/lib/libarchive/test/main.c @@ -33,6 +33,9 @@ #include <locale.h> #include <stdarg.h> #include <time.h> +#ifdef _WIN32 +#include <crtdbg.h> +#endif /* * This same file is used pretty much verbatim for all test harnesses. @@ -907,6 +910,10 @@ get_refdir(void) strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); } + /* You should have to add "$(TargetDir)" to + * Properties > Configuration Properties > Debugging > Working Directory, + * if you are running libarchive_test.exe on Visual Studio. + */ printf("Unable to locate known reference file %s\n", KNOWNREF); printf(" Checked following directories:\n%s\n", tried); exit(1); @@ -966,7 +973,7 @@ int main(int argc, char **argv) * Parse options, without using getopt(), which isn't available * on all platforms. */ - ++argv; /* Skip program name */ + ++argv; --argc;/* Skip program name */ while (*argv != NULL) { p = *argv++; if (*p++ != '-') diff --git a/lib/libarchive/test/test.h b/lib/libarchive/test/test.h index 5286f5d..2876909 100644 --- a/lib/libarchive/test/test.h +++ b/lib/libarchive/test/test.h @@ -73,6 +73,7 @@ #endif #ifdef _WIN32 +#define snprintf sprintf_s #define LOCALE_DE "deu" #else #define LOCALE_DE "de_DE.UTF-8" diff --git a/lib/libarchive/test/test_read_compress_program.c b/lib/libarchive/test/test_read_compress_program.c index 617593a..a6626dc 100644 --- a/lib/libarchive/test/test_read_compress_program.c +++ b/lib/libarchive/test/test_read_compress_program.c @@ -42,16 +42,20 @@ DEFINE_TEST(test_read_compress_program) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assertEqualIntA(a, 0, archive_read_support_compression_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_none(a)); r = archive_read_support_compression_program(a, "gunzip"); if (r == ARCHIVE_FATAL) { skipping("archive_read_support_compression_program() unsupported on this platform"); return; } assertEqualIntA(a, ARCHIVE_OK, r); - assert(0 == archive_read_support_format_all(a)); - assertEqualIntA(a, 0, archive_read_open_memory(a, archive, sizeof(archive))); - assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); assert(archive_compression(a) == ARCHIVE_COMPRESSION_PROGRAM); assert(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR); assert(0 == archive_read_close(a)); diff --git a/lib/libarchive/test/test_read_format_cpio_bin_Z.c b/lib/libarchive/test/test_read_format_cpio_bin_Z.c index 9cfadd6..749ff94 100644 --- a/lib/libarchive/test/test_read_format_cpio_bin_Z.c +++ b/lib/libarchive/test/test_read_format_cpio_bin_Z.c @@ -36,17 +36,24 @@ DEFINE_TEST(test_read_format_cpio_bin_Z) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assertA(0 == archive_read_next_header(a, &ae)); - assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS); - assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + failure("archive_compression_name(a)=\"%s\"", + archive_compression_name(a)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + failure("archive_format_name(a)=\"%s\"", + archive_format_name(a)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } diff --git a/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c b/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c index 975aca3..11ac091 100644 --- a/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c +++ b/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c @@ -39,17 +39,23 @@ DEFINE_TEST(test_read_format_cpio_svr4c_Z) struct archive *a; /* printf("Archive address: start=%X, end=%X\n", archive, archive+sizeof(archive)); */ assert((a = archive_read_new()) != NULL); - assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assertA(0 == archive_read_next_header(a, &ae)); - assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS); - assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_SVR4_CRC); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + failure("archive_compression_name(a)=\"%s\"", + archive_compression_name(a)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_CRC); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } diff --git a/lib/libarchive/test/test_read_format_tz.c b/lib/libarchive/test/test_read_format_tz.c index 94a2841..3dd001f 100644 --- a/lib/libarchive/test/test_read_format_tz.c +++ b/lib/libarchive/test/test_read_format_tz.c @@ -39,17 +39,22 @@ DEFINE_TEST(test_read_format_tz) struct archive_entry *ae; struct archive *a; assert((a = archive_read_new()) != NULL); - assertA(0 == archive_read_support_compression_all(a)); - assertA(0 == archive_read_support_format_all(a)); - assertA(0 == archive_read_open_memory(a, archive, sizeof(archive))); - assertA(0 == archive_read_next_header(a, &ae)); - assertA(archive_compression(a) == ARCHIVE_COMPRESSION_COMPRESS); - assertA(archive_format(a) == ARCHIVE_FORMAT_TAR_USTAR); - assert(0 == archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + failure("archive_compression_name(a)=\"%s\"", + archive_compression_name(a)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); #if ARCHIVE_VERSION_NUMBER < 2000000 archive_read_finish(a); #else - assert(0 == archive_read_finish(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); #endif } |