From owner-svn-src-all@FreeBSD.ORG Thu Mar 5 00:31:49 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 820081065674; Thu, 5 Mar 2009 00:31:49 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F02C8FC1B; Thu, 5 Mar 2009 00:31:49 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n250VnIm057451; Thu, 5 Mar 2009 00:31:49 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n250Vngs057445; Thu, 5 Mar 2009 00:31:49 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200903050031.n250Vngs057445@svn.freebsd.org> From: Tim Kientzle Date: Thu, 5 Mar 2009 00:31:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189381 - head/lib/libarchive/test X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2009 00:31:50 -0000 Author: kientzle Date: Thu Mar 5 00:31:48 2009 New Revision: 189381 URL: http://svn.freebsd.org/changeset/base/189381 Log: Merge r341,r345,r346,347 from libarchive.googlecode.com: Style fixes to test harness and a few extra guards to detect tests that can't succeed on certain platforms. Modified: head/lib/libarchive/test/main.c head/lib/libarchive/test/test.h head/lib/libarchive/test/test_read_compress_program.c head/lib/libarchive/test/test_read_format_cpio_bin_Z.c head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c head/lib/libarchive/test/test_read_format_tz.c Modified: head/lib/libarchive/test/main.c ============================================================================== --- head/lib/libarchive/test/main.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/main.c Thu Mar 5 00:31:48 2009 (r189381) @@ -33,6 +33,9 @@ #include #include #include +#ifdef _WIN32 +#include +#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++ != '-') Modified: head/lib/libarchive/test/test.h ============================================================================== --- head/lib/libarchive/test/test.h Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test.h Thu Mar 5 00:31:48 2009 (r189381) @@ -73,6 +73,7 @@ #endif #ifdef _WIN32 +#define snprintf sprintf_s #define LOCALE_DE "deu" #else #define LOCALE_DE "de_DE.UTF-8" Modified: head/lib/libarchive/test/test_read_compress_program.c ============================================================================== --- head/lib/libarchive/test/test_read_compress_program.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_compress_program.c Thu Mar 5 00:31:48 2009 (r189381) @@ -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)); Modified: head/lib/libarchive/test/test_read_format_cpio_bin_Z.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_bin_Z.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_format_cpio_bin_Z.c Thu Mar 5 00:31:48 2009 (r189381) @@ -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 } Modified: head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c ============================================================================== --- head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c Thu Mar 5 00:31:48 2009 (r189381) @@ -39,17 +39,23 @@ DEFINE_TEST(test_read_format_cpio_svr4c_ 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 } Modified: head/lib/libarchive/test/test_read_format_tz.c ============================================================================== --- head/lib/libarchive/test/test_read_format_tz.c Thu Mar 5 00:15:43 2009 (r189380) +++ head/lib/libarchive/test/test_read_format_tz.c Thu Mar 5 00:31:48 2009 (r189381) @@ -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 }