diff --git a/lib/libarchive/test/Makefile b/lib/libarchive/test/Makefile index dec95fdb151d..4d88151f2fca 100644 --- a/lib/libarchive/test/Makefile +++ b/lib/libarchive/test/Makefile @@ -14,8 +14,10 @@ TESTS= \ test_archive_api_feature.c \ test_bad_fd.c \ test_compat_bzip2.c \ + test_compat_cpio.c \ test_compat_gtar.c \ test_compat_gzip.c \ + test_compat_lzma.c \ test_compat_solaris_tar_acl.c \ test_compat_tar_hardlink.c \ test_compat_xz.c \ @@ -42,6 +44,7 @@ TESTS= \ test_read_format_cpio_bin_be.c \ test_read_format_cpio_bin_bz2.c \ test_read_format_cpio_bin_gz.c \ + test_read_format_cpio_bin_lzma.c \ test_read_format_cpio_bin_xz.c \ test_read_format_cpio_odc.c \ test_read_format_cpio_svr4_gzip.c \ @@ -51,8 +54,15 @@ TESTS= \ test_read_format_gtar_lzma.c \ test_read_format_gtar_sparse.c \ test_read_format_iso_gz.c \ + test_read_format_iso_multi_extent.c \ + test_read_format_isorr_rr_moved.c \ test_read_format_isojoliet_bz2.c \ + test_read_format_isojoliet_long.c \ + test_read_format_isojoliet_rr.c \ test_read_format_isorr_bz2.c \ + test_read_format_isorr_ce.c \ + test_read_format_isorr_new_bz2.c \ + test_read_format_isozisofs_bz2.c \ test_read_format_mtree.c \ test_read_format_pax_bz2.c \ test_read_format_raw.c \ @@ -60,6 +70,7 @@ TESTS= \ test_read_format_tar_empty_filename.c \ test_read_format_tbz.c \ test_read_format_tgz.c \ + test_read_format_tlz.c \ test_read_format_txz.c \ test_read_format_tz.c \ test_read_format_zip.c \ @@ -82,6 +93,7 @@ TESTS= \ test_write_disk_perms.c \ test_write_disk_secure.c \ test_write_disk_sparse.c \ + test_write_disk_symlink.c \ test_write_disk_times.c \ test_write_format_ar.c \ test_write_format_cpio.c \ @@ -94,6 +106,9 @@ TESTS= \ test_write_format_tar.c \ test_write_format_tar_empty.c \ test_write_format_tar_ustar.c \ + test_write_format_zip.c \ + test_write_format_zip_empty.c \ + test_write_format_zip_no_compression.c \ test_write_open_memory.c @@ -108,16 +123,12 @@ NO_MAN=yes PROG=libarchive_test INTERNALPROG=yes # Don't install this; it's just for testing -DPADD=${LIBBZ2} ${LIBZ} +DPADD=${LIBBZ2} ${LIBZ} ${LIBMD} ${LIBCRYPTO} ${LIBBSDXML} CFLAGS+= -DPLATFORM_CONFIG_H=\"config_freebsd.h\" -LDADD= -lz -lbz2 -lmd -lcrypto +LDADD= -lz -lbz2 -lmd -lcrypto -lbsdxml CFLAGS+= -g CFLAGS+= -I${LA_SRCDIR} -I. -# Uncomment to build and test lzma support via liblzmadec -#CFLAGS+= -I/usr/local/include -DHAVE_LIBLZMADEC=1 -DHAVE_LZMADEC_H=1 -#LDADD+= -L/usr/local/lib -llzmadec - # Uncomment to build and test lzma and xz support via liblzma #CFLAGS+= -I/usr/local/include -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1 #LDADD+= -L/usr/local/lib -llzma @@ -125,11 +136,11 @@ CFLAGS+= -I${LA_SRCDIR} -I. # Uncomment to link against dmalloc #LDADD+= -L/usr/local/lib -ldmalloc #CFLAGS+= -I/usr/local/include -DUSE_DMALLOC -WARNS=6 +#WARNS=6 # Build libarchive_test and run it. check test: libarchive_test - ./libarchive_test -v -r ${.CURDIR} + ./libarchive_test -r ${.CURDIR} # list.h is just a list of all tests, as indicated by DEFINE_TEST macro lines list.h: ${TESTS} Makefile diff --git a/lib/libarchive/test/main.c b/lib/libarchive/test/main.c index 0d16c81edd10..5f8cbc311a52 100644 --- a/lib/libarchive/test/main.c +++ b/lib/libarchive/test/main.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2003-2009 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -23,74 +23,142 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* - * Various utility routines useful for test programs. - * Each test program is linked against this file. - */ #include "test.h" - #include #include #include #include -#if defined(_WIN32) && !defined(__CYGWIN__) -#include -#include -#include -#endif /* * This same file is used pretty much verbatim for all test harnesses. * * The next few lines are the only differences. + * TODO: Move this into a separate configuration header, have all test + * suites share one copy of this file. */ +__FBSDID("$FreeBSD$"); +#define KNOWNREF "test_compat_gtar_1.tar.uu" +#define ENVBASE "LIBARCHIVE" /* Prefix for environment variables. */ #undef PROGRAM /* Testing a library, not a program. */ #define LIBRARY "libarchive" -#define ENVBASE "LIBARCHIVE" /* Prefix for environment variables. */ #define EXTRA_DUMP(x) archive_error_string((struct archive *)(x)) #define EXTRA_VERSION archive_version() -#define KNOWNREF "test_compat_gtar_1.tar.uu" -__FBSDID("$FreeBSD$"); /* - * "list.h" is simply created by "grep DEFINE_TEST"; it has - * a line like - * DEFINE_TEST(test_function) - * for each test. - * Include it here with a suitable DEFINE_TEST to declare all of the - * test functions. + * + * Windows support routines + * + * Note: Configuration is a tricky issue. Using HAVE_* feature macros + * in the test harness is dangerous because they cover up + * configuration errors. The classic example of this is omitting a + * configure check. If libarchive and libarchive_test both look for + * the same feature macro, such errors are hard to detect. Platform + * macros (e.g., _WIN32 or __GNUC__) are a little better, but can + * easily lead to very messy code. It's best to limit yourself + * to only the most generic programming techniques in the test harness + * and thus avoid conditionals altogether. Where that's not possible, + * try to minimize conditionals by grouping platform-specific tests in + * one place (e.g., test_acl_freebsd) or by adding new assert() + * functions (e.g., assertMakeHardlink()) to cover up platform + * differences. Platform-specific coding in libarchive_test is often + * a symptom that some capability is missing from libarchive itself. */ -#undef DEFINE_TEST -#define DEFINE_TEST(name) void name(void); -#include "list.h" - -/* Interix doesn't define these in a standard header. */ -#if __INTERIX__ -extern char *optarg; -extern int optind; +#if defined(_WIN32) && !defined(__CYGWIN__) +#include +#include +#ifndef F_OK +#define F_OK (0) +#endif +#ifndef S_ISDIR +#define S_ISDIR(m) ((m) & _S_IFDIR) +#endif +#ifndef S_ISREG +#define S_ISREG(m) ((m) & _S_IFREG) +#endif +#if !defined(__BORLANDC__) +#define access _access +#define chdir _chdir +#endif +#ifndef fileno +#define fileno _fileno +#endif +/*#define fstat _fstat64*/ +#if !defined(__BORLANDC__) +#define getcwd _getcwd +#endif +#define lstat stat +/*#define lstat _stat64*/ +/*#define stat _stat64*/ +#define rmdir _rmdir +#if !defined(__BORLANDC__) +#define strdup _strdup +#define umask _umask +#endif +#define int64_t __int64 #endif -/* Enable core dump on failure. */ -static int dump_on_failure = 0; -/* Default is to remove temp dirs for successful tests. */ -static int keep_temp_files = 0; -/* Default is to print some basic information about each test. */ -static int quiet_flag = 0; -/* Default is to summarize repeated failures. */ -static int verbose = 0; -/* Cumulative count of component failures. */ -static int failures = 0; -/* Cumulative count of skipped component tests. */ -static int skips = 0; -/* Cumulative count of assertions. */ -static int assertions = 0; - -/* Directory where uuencoded reference files can be found. */ -static const char *refdir; - +#if defined(HAVE__CrtSetReportMode) +# include +#endif #if defined(_WIN32) && !defined(__CYGWIN__) +void *GetFunctionKernel32(const char *name) +{ + static HINSTANCE lib; + static int set; + if (!set) { + set = 1; + lib = LoadLibrary("kernel32.dll"); + } + if (lib == NULL) { + fprintf(stderr, "Can't load kernel32.dll?!\n"); + exit(1); + } + return (void *)GetProcAddress(lib, name); +} +static int +my_CreateSymbolicLinkA(const char *linkname, const char *target, int flags) +{ + static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, DWORD); + static int set; + if (!set) { + set = 1; + f = GetFunctionKernel32("CreateSymbolicLinkA"); + } + return f == NULL ? 0 : (*f)(linkname, target, flags); +} + +static int +my_CreateHardLinkA(const char *linkname, const char *target) +{ + static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES); + static int set; + if (!set) { + set = 1; + f = GetFunctionKernel32("CreateHardLinkA"); + } + return f == NULL ? 0 : (*f)(linkname, target, NULL); +} + +int +my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi) +{ + HANDLE h; + int r; + + memset(bhfi, 0, sizeof(*bhfi)); + h = CreateFile(path, FILE_READ_ATTRIBUTES, 0, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (h == INVALID_HANDLE_VALUE) + return (0); + r = GetFileInformationByHandle(h, bhfi); + CloseHandle(h); + return (r); +} +#endif + +#if defined(HAVE__CrtSetReportMode) static void invalid_parameter_handler(const wchar_t * expression, const wchar_t * function, const wchar_t * file, @@ -98,123 +166,181 @@ invalid_parameter_handler(const wchar_t * expression, { /* nop */ } - #endif /* - * My own implementation of the standard assert() macro emits the - * message in the same format as GCC (file:line: message). - * It also includes some additional useful information. - * This makes it a lot easier to skim through test failures in - * Emacs. ;-) * - * It also supports a few special features specifically to simplify - * test harnesses: - * failure(fmt, args) -- Stores a text string that gets - * printed if the following assertion fails, good for - * explaining subtle tests. + * OPTIONS FLAGS + * */ -static char msg[4096]; + +/* Enable core dump on failure. */ +static int dump_on_failure = 0; +/* Default is to remove temp dirs and log data for successful tests. */ +static int keep_temp_files = 0; +/* Default is to just report pass/fail for each test. */ +static int verbosity = 0; +#define VERBOSITY_SUMMARY_ONLY -1 /* -q */ +#define VERBOSITY_PASSFAIL 0 /* Default */ +#define VERBOSITY_LIGHT_REPORT 1 /* -v */ +#define VERBOSITY_FULL 2 /* -vv */ +/* A few places generate even more output for verbosity > VERBOSITY_FULL, + * mostly for debugging the test harness itself. */ +/* Cumulative count of assertion failures. */ +static int failures = 0; +/* Cumulative count of reported skips. */ +static int skips = 0; +/* Cumulative count of assertions checked. */ +static int assertions = 0; + +/* Directory where uuencoded reference files can be found. */ +static const char *refdir; /* - * For each test source file, we remember how many times each - * failure was reported. - */ -static const char *failed_filename = NULL; -static struct line { - int line; - int count; - int critical; -} failed_lines[1000]; - -/* - * Called at the beginning of each assert() function. + * Report log information selectively to console and/or disk log. */ +static int log_console = 0; +static FILE *logfile; static void -count_assertion(const char *file, int line) +vlogprintf(const char *fmt, va_list ap) +{ +#ifdef va_copy + va_list lfap; + va_copy(lfap, ap); +#endif + if (log_console) + vfprintf(stdout, fmt, ap); + if (logfile != NULL) +#ifdef va_copy + vfprintf(logfile, fmt, lfap); + va_end(lfap); +#else + vfprintf(logfile, fmt, ap); +#endif +} + +static void +logprintf(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vlogprintf(fmt, ap); + va_end(ap); +} + +/* Set up a message to display only if next assertion fails. */ +static char msgbuff[4096]; +static const char *msg, *nextmsg; +void +failure(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vsprintf(msgbuff, fmt, ap); + va_end(ap); + nextmsg = msgbuff; +} + +/* + * Copy arguments into file-local variables. + * This was added to permit vararg assert() functions without needing + * variadic wrapper macros. Turns out that the vararg capability is almost + * never used, so almost all of the vararg assertions can be simplified + * by removing the vararg capability and reworking the wrapper macro to + * pass __FILE__, __LINE__ directly into the function instead of using + * this hook. I suspect this machinery is used so rarely that we + * would be better off just removing it entirely. That would simplify + * the code here noticably. + */ +static const char *test_filename; +static int test_line; +static void *test_extra; +void assertion_setup(const char *filename, int line) +{ + test_filename = filename; + test_line = line; +} + +/* Called at the beginning of each assert() function. */ +static void +assertion_count(const char *file, int line) { (void)file; /* UNUSED */ (void)line; /* UNUSED */ ++assertions; + /* Proper handling of "failure()" message. */ + msg = nextmsg; + nextmsg = NULL; /* Uncomment to print file:line after every assertion. * Verbose, but occasionally useful in tracking down crashes. */ /* printf("Checked %s:%d\n", file, line); */ } /* - * Count this failure; return the number of previous failures. + * For each test source file, we remember how many times each + * assertion was reported. Cleared before each new test, + * used by test_summarize(). */ -static int -previous_failures(const char *filename, int line, int critical) -{ - unsigned int i; +static struct line { int count; + int skip; +} failed_lines[10000]; - if (failed_filename == NULL || strcmp(failed_filename, filename) != 0) - memset(failed_lines, 0, sizeof(failed_lines)); - failed_filename = filename; - - for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) { - if (failed_lines[i].line == line) { - count = failed_lines[i].count; - failed_lines[i].count++; - return (count); - } - if (failed_lines[i].line == 0) { - failed_lines[i].line = line; - failed_lines[i].count = 1; - failed_lines[i].critical = critical; - return (0); - } - } - return (0); -} - -/* - * Copy arguments into file-local variables. - */ -static const char *test_filename; -static int test_line; -static void *test_extra; -void test_setup(const char *filename, int line) -{ - test_filename = filename; - test_line = line; -} - -/* - * Inform user that we're skipping a test. - */ -void -test_skipping(const char *fmt, ...) +/* Count this failure, setup up log destination and handle initial report. */ +static void +failure_start(const char *filename, int line, const char *fmt, ...) { va_list ap; - if (previous_failures(test_filename, test_line, 0)) - return; + /* Record another failure for this line. */ + ++failures; + /* test_filename = filename; */ + failed_lines[line].count++; - va_start(ap, fmt); - fprintf(stderr, " *** SKIPPING: "); - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); - va_end(ap); - ++skips; -} - -/* Common handling of failed tests. */ -static void -report_failure(void *extra) -{ - if (msg[0] != '\0') { - fprintf(stderr, " Description: %s\n", msg); - msg[0] = '\0'; + /* Determine whether to log header to console. */ + switch (verbosity) { + case VERBOSITY_LIGHT_REPORT: + log_console = (failed_lines[line].count < 2); + break; + default: + log_console = (verbosity >= VERBOSITY_FULL); } + /* Log file:line header for this failure */ + va_start(ap, fmt); +#if _MSC_VER + logprintf("%s(%d): ", filename, line); +#else + logprintf("%s:%d: ", filename, line); +#endif + vlogprintf(fmt, ap); + va_end(ap); + logprintf("\n"); + + if (msg != NULL && msg[0] != '\0') { + logprintf(" Description: %s\n", msg); + msg = NULL; + } + + /* Determine whether to log details to console. */ + if (verbosity == VERBOSITY_LIGHT_REPORT) + log_console = 0; +} + +/* Complete reporting of failed tests. */ +/* + * The 'extra' hook here is used by libarchive to include libarchive + * error messages with assertion failures. It could also be used + * to add strerror() output, for example. Just define the EXTRA_DUMP() + * macro appropriately. + */ +static void +failure_finish(void *extra) +{ + (void)extra; /* UNUSED (maybe) */ #ifdef EXTRA_DUMP if (extra != NULL) - fprintf(stderr, " detail: %s\n", EXTRA_DUMP(extra)); -#else - (void)extra; /* UNUSED */ + logprintf(" detail: %s\n", EXTRA_DUMP(extra)); #endif if (dump_on_failure) { @@ -225,203 +351,154 @@ report_failure(void *extra) } } -/* - * Summarize repeated failures in the just-completed test file. - * The reports above suppress multiple failures from the same source - * line; this reports on any tests that did fail multiple times. - */ -static int -summarize_comparator(const void *a0, const void *b0) -{ - const struct line *a = a0, *b = b0; - if (a->line == 0 && b->line == 0) - return (0); - if (a->line == 0) - return (1); - if (b->line == 0) - return (-1); - return (a->line - b->line); -} - -static void -summarize(void) -{ - unsigned int i; - - qsort(failed_lines, sizeof(failed_lines)/sizeof(failed_lines[0]), - sizeof(failed_lines[0]), summarize_comparator); - for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) { - if (failed_lines[i].line == 0) - break; - if (failed_lines[i].count > 1 && failed_lines[i].critical) - fprintf(stderr, "%s:%d: Failed %d times\n", - failed_filename, failed_lines[i].line, - failed_lines[i].count); - } - /* Clear the failure history for the next file. */ - memset(failed_lines, 0, sizeof(failed_lines)); -} - -/* Set up a message to display only after a test fails. */ +/* Inform user that we're skipping some checks. */ void -failure(const char *fmt, ...) +test_skipping(const char *fmt, ...) { + char buff[1024]; va_list ap; + va_start(ap, fmt); - vsprintf(msg, fmt, ap); + vsprintf(buff, fmt, ap); va_end(ap); + /* failure_start() isn't quite right, but is awfully convenient. */ + failure_start(test_filename, test_line, "SKIPPING: %s", buff); + --failures; /* Undo failures++ in failure_start() */ + /* Don't failure_finish() here. */ + /* Mark as skip, so doesn't count as failed test. */ + failed_lines[test_line].skip = 1; + ++skips; } +/* + * + * ASSERTIONS + * + */ + /* Generic assert() just displays the failed condition. */ int -test_assert(const char *file, int line, int value, const char *condition, void *extra) +assertion_assert(const char *file, int line, int value, + const char *condition, void *extra) { - count_assertion(file, line); - if (value) { - msg[0] = '\0'; - return (value); + assertion_count(file, line); + if (!value) { + failure_start(file, line, "Assertion failed: %s", condition); + failure_finish(extra); } - failures ++; - if (!verbose && previous_failures(file, line, 1)) - return (value); - fprintf(stderr, "%s:%d: Assertion failed\n", file, line); - fprintf(stderr, " Condition: %s\n", condition); - report_failure(extra); return (value); } -/* assertEqualInt() displays the values of the two integers. */ +/* chdir() and report any errors */ int -test_assert_equal_int(const char *file, int line, - int v1, const char *e1, int v2, const char *e2, void *extra) +assertion_chdir(const char *file, int line, const char *pathname) { - count_assertion(file, line); - if (v1 == v2) { - msg[0] = '\0'; + assertion_count(file, line); + if (chdir(pathname) == 0) return (1); - } - failures ++; - if (!verbose && previous_failures(file, line, 1)) - return (0); - fprintf(stderr, "%s:%d: Assertion failed: Ints not equal\n", - file, line); - fprintf(stderr, " %s=%d\n", e1, v1); - fprintf(stderr, " %s=%d\n", e2, v2); - report_failure(extra); + failure_start(file, line, "chdir(\"%s\")", pathname); + failure_finish(NULL); + return (0); + +} + +/* Verify two integers are equal. */ +int +assertion_equal_int(const char *file, int line, + long long v1, const char *e1, long long v2, const char *e2, void *extra) +{ + assertion_count(file, line); + if (v1 == v2) + return (1); + failure_start(file, line, "%s != %s", e1, e2); + logprintf(" %s=%lld (0x%llx, 0%llo)\n", e1, v1, v1, v1); + logprintf(" %s=%lld (0x%llx, 0%llo)\n", e2, v2, v2, v2); + failure_finish(extra); return (0); } -static void strdump(const char *p) +static void strdump(const char *e, const char *p) { + const char *q = p; + + logprintf(" %s = ", e); if (p == NULL) { - fprintf(stderr, "(null)"); + logprintf("NULL"); return; } - fprintf(stderr, "\""); + logprintf("\""); while (*p != '\0') { unsigned int c = 0xff & *p++; switch (c) { - case '\a': fprintf(stderr, "\a"); break; - case '\b': fprintf(stderr, "\b"); break; - case '\n': fprintf(stderr, "\n"); break; - case '\r': fprintf(stderr, "\r"); break; + case '\a': printf("\a"); break; + case '\b': printf("\b"); break; + case '\n': printf("\n"); break; + case '\r': printf("\r"); break; default: if (c >= 32 && c < 127) - fprintf(stderr, "%c", c); + logprintf("%c", c); else - fprintf(stderr, "\\x%02X", c); + logprintf("\\x%02X", c); } } - fprintf(stderr, "\""); + logprintf("\""); + logprintf(" (length %d)\n", q == NULL ? -1 : (int)strlen(q)); } -/* assertEqualString() displays the values of the two strings. */ +/* Verify two strings are equal, dump them if not. */ int -test_assert_equal_string(const char *file, int line, +assertion_equal_string(const char *file, int line, const char *v1, const char *e1, const char *v2, const char *e2, void *extra) { - count_assertion(file, line); - if (v1 == NULL || v2 == NULL) { - if (v1 == v2) { - msg[0] = '\0'; - return (1); - } - } else if (strcmp(v1, v2) == 0) { - msg[0] = '\0'; + assertion_count(file, line); + if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0)) return (1); - } - failures ++; - if (!verbose && previous_failures(file, line, 1)) - return (0); - fprintf(stderr, "%s:%d: Assertion failed: Strings not equal\n", - file, line); - fprintf(stderr, " %s = ", e1); - strdump(v1); - fprintf(stderr, " (length %d)\n", v1 == NULL ? 0 : (int)strlen(v1)); - fprintf(stderr, " %s = ", e2); - strdump(v2); - fprintf(stderr, " (length %d)\n", v2 == NULL ? 0 : (int)strlen(v2)); - report_failure(extra); + failure_start(file, line, "%s != %s", e1, e2); + strdump(e1, v1); + strdump(e2, v2); + failure_finish(extra); return (0); } -static void wcsdump(const wchar_t *w) +static void +wcsdump(const char *e, const wchar_t *w) { + logprintf(" %s = ", e); if (w == NULL) { - fprintf(stderr, "(null)"); + logprintf("(null)"); return; } - fprintf(stderr, "\""); + logprintf("\""); while (*w != L'\0') { unsigned int c = *w++; if (c >= 32 && c < 127) - fprintf(stderr, "%c", c); + logprintf("%c", c); else if (c < 256) - fprintf(stderr, "\\x%02X", c); + logprintf("\\x%02X", c); else if (c < 0x10000) - fprintf(stderr, "\\u%04X", c); + logprintf("\\u%04X", c); else - fprintf(stderr, "\\U%08X", c); + logprintf("\\U%08X", c); } - fprintf(stderr, "\""); + logprintf("\"\n"); } -/* assertEqualWString() displays the values of the two strings. */ +/* Verify that two wide strings are equal, dump them if not. */ int -test_assert_equal_wstring(const char *file, int line, +assertion_equal_wstring(const char *file, int line, const wchar_t *v1, const char *e1, const wchar_t *v2, const char *e2, void *extra) { - count_assertion(file, line); - if (v1 == NULL) { - if (v2 == NULL) { - msg[0] = '\0'; - return (1); - } - } else if (v2 == NULL) { - if (v1 == NULL) { - msg[0] = '\0'; - return (1); - } - } else if (wcscmp(v1, v2) == 0) { - msg[0] = '\0'; + assertion_count(file, line); + if (v1 == v2 || wcscmp(v1, v2) == 0) return (1); - } - failures ++; - if (!verbose && previous_failures(file, line, 1)) - return (0); - fprintf(stderr, "%s:%d: Assertion failed: Unicode strings not equal\n", - file, line); - fprintf(stderr, " %s = ", e1); - wcsdump(v1); - fprintf(stderr, "\n"); - fprintf(stderr, " %s = ", e2); - wcsdump(v2); - fprintf(stderr, "\n"); - report_failure(extra); + failure_start(file, line, "%s != %s", e1, e2); + wcsdump(e1, v1); + wcsdump(e2, v2); + failure_finish(extra); return (0); } @@ -436,35 +513,40 @@ hexdump(const char *p, const char *ref, size_t l, size_t offset) size_t i, j; char sep; + if (p == NULL) { + logprintf("(null)\n"); + return; + } for(i=0; i < l; i+=16) { - fprintf(stderr, "%04x", (unsigned)(i + offset)); + logprintf("%04x", (unsigned)(i + offset)); sep = ' '; for (j = 0; j < 16 && i + j < l; j++) { if (ref != NULL && p[i + j] != ref[i + j]) sep = '_'; - fprintf(stderr, "%c%02x", sep, 0xff & (int)p[i+j]); + logprintf("%c%02x", sep, 0xff & (int)p[i+j]); if (ref != NULL && p[i + j] == ref[i + j]) sep = ' '; } for (; j < 16; j++) { - fprintf(stderr, "%c ", sep); + logprintf("%c ", sep); sep = ' '; } - fprintf(stderr, "%c", sep); + logprintf("%c", sep); for (j=0; j < 16 && i + j < l; j++) { int c = p[i + j]; if (c >= ' ' && c <= 126) - fprintf(stderr, "%c", c); + logprintf("%c", c); else - fprintf(stderr, "."); + logprintf("."); } - fprintf(stderr, "\n"); + logprintf("\n"); } } -/* assertEqualMem() displays the values of the two memory blocks. */ +/* Verify that two blocks of memory are the same, display the first + * block of differences if they're not. */ int -test_assert_equal_mem(const char *file, int line, +assertion_equal_mem(const char *file, int line, const void *_v1, const char *e1, const void *_v2, const char *e2, size_t l, const char *ld, void *extra) @@ -473,202 +555,908 @@ test_assert_equal_mem(const char *file, int line, const char *v2 = (const char *)_v2; size_t offset; - count_assertion(file, line); - if (v1 == NULL || v2 == NULL) { - if (v1 == v2) { - msg[0] = '\0'; - return (1); - } - } else if (memcmp(v1, v2, l) == 0) { - msg[0] = '\0'; + assertion_count(file, line); + if (v1 == v2 || (v1 != NULL && v2 != NULL && memcmp(v1, v2, l) == 0)) return (1); - } - failures ++; - if (!verbose && previous_failures(file, line, 1)) - return (0); - fprintf(stderr, "%s:%d: Assertion failed: memory not equal\n", - file, line); - fprintf(stderr, " size %s = %d\n", ld, (int)l); + + failure_start(file, line, "%s != %s", e1, e2); + logprintf(" size %s = %d\n", ld, (int)l); /* Dump 48 bytes (3 lines) so that the first difference is * in the second line. */ offset = 0; while (l > 64 && memcmp(v1, v2, 32) == 0) { - /* The first two lines agree, so step forward one line. */ + /* Two lines agree, so step forward one line. */ v1 += 16; v2 += 16; l -= 16; offset += 16; } - fprintf(stderr, " Dump of %s\n", e1); + logprintf(" Dump of %s\n", e1); hexdump(v1, v2, l < 64 ? l : 64, offset); - fprintf(stderr, " Dump of %s\n", e2); + logprintf(" Dump of %s\n", e2); hexdump(v2, v1, l < 64 ? l : 64, offset); - fprintf(stderr, "\n"); - report_failure(extra); + logprintf("\n"); + failure_finish(extra); return (0); } +/* Verify that the named file exists and is empty. */ int -test_assert_empty_file(const char *f1fmt, ...) +assertion_empty_file(const char *f1fmt, ...) { char buff[1024]; char f1[1024]; struct stat st; va_list ap; ssize_t s; - int fd; - + FILE *f; + assertion_count(test_filename, test_line); va_start(ap, f1fmt); vsprintf(f1, f1fmt, ap); va_end(ap); if (stat(f1, &st) != 0) { - fprintf(stderr, "%s:%d: Could not stat: %s\n", test_filename, test_line, f1); - report_failure(NULL); + failure_start(test_filename, test_line, "Stat failed: %s", f1); + failure_finish(NULL); return (0); } if (st.st_size == 0) return (1); - failures ++; - if (!verbose && previous_failures(test_filename, test_line, 1)) - return (0); - - fprintf(stderr, "%s:%d: File not empty: %s\n", test_filename, test_line, f1); - fprintf(stderr, " File size: %d\n", (int)st.st_size); - fprintf(stderr, " Contents:\n"); - fd = open(f1, O_RDONLY); - if (fd < 0) { - fprintf(stderr, " Unable to open %s\n", f1); + failure_start(test_filename, test_line, "File should be empty: %s", f1); + logprintf(" File size: %d\n", (int)st.st_size); + logprintf(" Contents:\n"); + f = fopen(f1, "rb"); + if (f == NULL) { + logprintf(" Unable to open %s\n", f1); } else { - s = sizeof(buff) < st.st_size ? sizeof(buff) : st.st_size; - s = read(fd, buff, s); + s = ((off_t)sizeof(buff) < st.st_size) ? + (ssize_t)sizeof(buff) : (ssize_t)st.st_size; + s = fread(buff, 1, s, f); hexdump(buff, NULL, s, 0); + fclose(f); } - report_failure(NULL); + failure_finish(NULL); return (0); } -/* assertEqualFile() asserts that two files have the same contents. */ +/* Verify that the named file exists and is not empty. */ +int +assertion_non_empty_file(const char *f1fmt, ...) +{ + char f1[1024]; + struct stat st; + va_list ap; + + assertion_count(test_filename, test_line); + va_start(ap, f1fmt); + vsprintf(f1, f1fmt, ap); + va_end(ap); + + if (stat(f1, &st) != 0) { + failure_start(test_filename, test_line, "Stat failed: %s", f1); + failure_finish(NULL); + return (0); + } + if (st.st_size == 0) { + failure_start(test_filename, test_line, "File empty: %s", f1); + failure_finish(NULL); + return (0); + } + return (1); +} + +/* Verify that two files have the same contents. */ /* TODO: hexdump the first bytes that actually differ. */ int -test_assert_equal_file(const char *f1, const char *f2pattern, ...) +assertion_equal_file(const char *fn1, const char *f2pattern, ...) { - char f2[1024]; + char fn2[1024]; va_list ap; char buff1[1024]; char buff2[1024]; - int fd1, fd2; + FILE *f1, *f2; int n1, n2; + assertion_count(test_filename, test_line); va_start(ap, f2pattern); - vsprintf(f2, f2pattern, ap); + vsprintf(fn2, f2pattern, ap); va_end(ap); - fd1 = open(f1, O_RDONLY); - fd2 = open(f2, O_RDONLY); + f1 = fopen(fn1, "rb"); + f2 = fopen(fn2, "rb"); for (;;) { - n1 = read(fd1, buff1, sizeof(buff1)); - n2 = read(fd2, buff2, sizeof(buff2)); + n1 = fread(buff1, 1, sizeof(buff1), f1); + n2 = fread(buff2, 1, sizeof(buff2), f2); if (n1 != n2) break; - if (n1 == 0 && n2 == 0) + if (n1 == 0 && n2 == 0) { + fclose(f1); + fclose(f2); return (1); + } if (memcmp(buff1, buff2, n1) != 0) break; } - failures ++; - if (!verbose && previous_failures(test_filename, test_line, 1)) - return (0); - fprintf(stderr, "%s:%d: Files are not identical\n", - test_filename, test_line); - fprintf(stderr, " file1=\"%s\"\n", f1); - fprintf(stderr, " file2=\"%s\"\n", f2); - report_failure(test_extra); + fclose(f1); + fclose(f2); + failure_start(test_filename, test_line, "Files not identical"); + logprintf(" file1=\"%s\"\n", fn1); + logprintf(" file2=\"%s\"\n", fn2); + failure_finish(test_extra); return (0); } +/* Verify that the named file does exist. */ int -test_assert_file_exists(const char *fpattern, ...) +assertion_file_exists(const char *fpattern, ...) { char f[1024]; va_list ap; + assertion_count(test_filename, test_line); va_start(ap, fpattern); vsprintf(f, fpattern, ap); va_end(ap); +#if defined(_WIN32) && !defined(__CYGWIN__) + if (!_access(f, 0)) + return (1); +#else if (!access(f, F_OK)) return (1); - if (!previous_failures(test_filename, test_line, 1)) { - fprintf(stderr, "%s:%d: File doesn't exist\n", - test_filename, test_line); - fprintf(stderr, " file=\"%s\"\n", f); - report_failure(test_extra); - } +#endif + failure_start(test_filename, test_line, "File should exist: %s", f); + failure_finish(test_extra); return (0); } +/* Verify that the named file doesn't exist. */ int -test_assert_file_not_exists(const char *fpattern, ...) +assertion_file_not_exists(const char *fpattern, ...) { char f[1024]; va_list ap; + assertion_count(test_filename, test_line); va_start(ap, fpattern); vsprintf(f, fpattern, ap); va_end(ap); +#if defined(_WIN32) && !defined(__CYGWIN__) + if (_access(f, 0)) + return (1); +#else if (access(f, F_OK)) return (1); - if (!previous_failures(test_filename, test_line, 1)) { - fprintf(stderr, "%s:%d: File exists and shouldn't\n", - test_filename, test_line); - fprintf(stderr, " file=\"%s\"\n", f); - report_failure(test_extra); - } +#endif + failure_start(test_filename, test_line, "File should not exist: %s", f); + failure_finish(test_extra); return (0); } -/* assertFileContents() asserts the contents of a file. */ +/* Compare the contents of a file to a block of memory. */ int -test_assert_file_contents(const void *buff, int s, const char *fpattern, ...) +assertion_file_contents(const void *buff, int s, const char *fpattern, ...) { - char f[1024]; + char fn[1024]; va_list ap; char *contents; - int fd; + FILE *f; int n; + assertion_count(test_filename, test_line); va_start(ap, fpattern); - vsprintf(f, fpattern, ap); + vsprintf(fn, fpattern, ap); va_end(ap); - fd = open(f, O_RDONLY); + f = fopen(fn, "rb"); + if (f == NULL) { + failure_start(test_filename, test_line, + "File should exist: %s", fn); + failure_finish(test_extra); + return (0); + } contents = malloc(s * 2); - n = read(fd, contents, s * 2); + n = fread(contents, 1, s * 2, f); + fclose(f); if (n == s && memcmp(buff, contents, s) == 0) { free(contents); return (1); } - failures ++; - if (!previous_failures(test_filename, test_line, 1)) { - fprintf(stderr, "%s:%d: File contents don't match\n", - test_filename, test_line); - fprintf(stderr, " file=\"%s\"\n", f); - if (n > 0) - hexdump(contents, buff, n, 0); - else { - fprintf(stderr, " File empty, contents should be:\n"); - hexdump(buff, NULL, s, 0); - } - report_failure(test_extra); + failure_start(test_filename, test_line, "File contents don't match"); + logprintf(" file=\"%s\"\n", fn); + if (n > 0) + hexdump(contents, buff, n > 512 ? 512 : n, 0); + else { + logprintf(" File empty, contents should be:\n"); + hexdump(buff, NULL, s > 512 ? 512 : n, 0); } + failure_finish(test_extra); free(contents); return (0); } +/* Check the contents of a text file, being tolerant of line endings. */ +int +assertion_text_file_contents(const char *buff, const char *fn) +{ + char *contents; + const char *btxt, *ftxt; + FILE *f; + int n, s; + + assertion_count(test_filename, test_line); + f = fopen(fn, "r"); + s = strlen(buff); + contents = malloc(s * 2 + 128); + n = fread(contents, 1, s * 2 + 128 - 1, f); + if (n >= 0) + contents[n] = '\0'; + fclose(f); + /* Compare texts. */ + btxt = buff; + ftxt = (const char *)contents; + while (*btxt != '\0' && *ftxt != '\0') { + if (*btxt == *ftxt) { + ++btxt; + ++ftxt; + continue; + } + if (btxt[0] == '\n' && ftxt[0] == '\r' && ftxt[1] == '\n') { + /* Pass over different new line characters. */ + ++btxt; + ftxt += 2; + continue; + } + break; + } + if (*btxt == '\0' && *ftxt == '\0') { + free(contents); + return (1); + } + failure_start(test_filename, test_line, "Contents don't match"); + logprintf(" file=\"%s\"\n", fn); + if (n > 0) + hexdump(contents, buff, n, 0); + else { + logprintf(" File empty, contents should be:\n"); + hexdump(buff, NULL, s, 0); + } + failure_finish(test_extra); + free(contents); + return (0); +} + +/* Test that two paths point to the same file. */ +/* As a side-effect, asserts that both files exist. */ +static int +is_hardlink(const char *file, int line, + const char *path1, const char *path2) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + BY_HANDLE_FILE_INFORMATION bhfi1, bhfi2; + int r; + + assertion_count(file, line); + r = my_GetFileInformationByName(path1, &bhfi1); + if (r == 0) { + failure_start(file, line, "File %s can't be inspected?", path1); + failure_finish(NULL); + return (0); + } + r = my_GetFileInformationByName(path2, &bhfi2); + if (r == 0) { + failure_start(file, line, "File %s can't be inspected?", path2); + failure_finish(NULL); + return (0); + } + return (bhfi1.dwVolumeSerialNumber == bhfi2.dwVolumeSerialNumber + && bhfi1.nFileIndexHigh == bhfi2.nFileIndexHigh + && bhfi1.nFileIndexLow == bhfi2.nFileIndexLow); +#else + struct stat st1, st2; + int r; + + assertion_count(file, line); + r = lstat(path1, &st1); + if (r != 0) { + failure_start(file, line, "File should exist: %s", path1); + failure_finish(NULL); + return (0); + } + r = lstat(path2, &st2); + if (r != 0) { + failure_start(file, line, "File should exist: %s", path2); + failure_finish(NULL); + return (0); + } + return (st1.st_ino == st2.st_ino && st1.st_dev == st2.st_dev); +#endif +} + +int +assertion_is_hardlink(const char *file, int line, + const char *path1, const char *path2) +{ + if (is_hardlink(file, line, path1, path2)) + return (1); + failure_start(file, line, + "Files %s and %s are not hardlinked", path1, path2); + failure_finish(NULL); + return (0); +} + +int +assertion_is_not_hardlink(const char *file, int line, + const char *path1, const char *path2) +{ + if (!is_hardlink(file, line, path1, path2)) + return (1); + failure_start(file, line, + "Files %s and %s should not be hardlinked", path1, path2); + failure_finish(NULL); + return (0); +} + +/* Verify a/b/mtime of 'pathname'. */ +/* If 'recent', verify that it's within last 10 seconds. */ +static int +assertion_file_time(const char *file, int line, + const char *pathname, long t, long nsec, char type, int recent) +{ + long long filet, filet_nsec; + int r; + +#if defined(_WIN32) && !defined(__CYGWIN__) +#define EPOC_TIME (116444736000000000ULL) + FILETIME ftime, fbirthtime, fatime, fmtime; + ULARGE_INTEGER wintm; + HANDLE h; + ftime.dwLowDateTime = 0; + ftime.dwHighDateTime = 0; + + assertion_count(file, line); + h = CreateFile(pathname, FILE_READ_ATTRIBUTES, 0, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (h == INVALID_HANDLE_VALUE) { + failure_start(file, line, "Can't access %s\n", pathname); + failure_finish(NULL); + return (0); + } + r = GetFileTime(h, &fbirthtime, &fatime, &fmtime); + switch (type) { + case 'a': ftime = fatime; break; + case 'b': ftime = fbirthtime; break; + case 'm': ftime = fmtime; break; + } + CloseHandle(h); + if (r == 0) { + failure_start(file, line, "Can't GetFileTime %s\n", pathname); + failure_finish(NULL); + return (0); + } + wintm.LowPart = ftime.dwLowDateTime; + wintm.HighPart = ftime.dwHighDateTime; + filet = (wintm.QuadPart - EPOC_TIME) / 10000000; + filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100; + nsec = (nsec / 100) * 100; /* Round the request */ +#else + struct stat st; + + assertion_count(file, line); + r = lstat(pathname, &st); + if (r != 0) { + failure_start(file, line, "Can't stat %s\n", pathname); + failure_finish(NULL); + return (0); + } + switch (type) { + case 'a': filet = st.st_atime; break; + case 'm': filet = st.st_mtime; break; + case 'b': filet = 0; break; + default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); + exit(1); + } +#if defined(__FreeBSD__) + switch (type) { + case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; + case 'b': filet = st.st_birthtime; + filet_nsec = st.st_birthtimespec.tv_nsec; break; + case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; + default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); + exit(1); + } + /* FreeBSD generally only stores to microsecond res, so round. */ + filet_nsec = (filet_nsec / 1000) * 1000; + nsec = (nsec / 1000) * 1000; +#else + filet_nsec = nsec = 0; /* Generic POSIX only has whole seconds. */ + if (type == 'b') return (1); /* Generic POSIX doesn't have birthtime */ +#if defined(__HAIKU__) + if (type == 'a') return (1); /* Haiku doesn't have atime. */ +#endif +#endif +#endif + if (recent) { + /* Check that requested time is up-to-date. */ + time_t now = time(NULL); + if (filet < now - 10 || filet > now + 1) { + failure_start(file, line, + "File %s has %ctime %ld, %ld seconds ago\n", + pathname, type, filet, now - filet); + failure_finish(NULL); + return (0); + } + } else if (filet != t || filet_nsec != nsec) { + failure_start(file, line, + "File %s has %ctime %ld.%09ld, expected %ld.%09ld", + pathname, type, filet, filet_nsec, t, nsec); + failure_finish(NULL); + return (0); + } + return (1); +} + +/* Verify atime of 'pathname'. */ +int +assertion_file_atime(const char *file, int line, + const char *pathname, long t, long nsec) +{ + return assertion_file_time(file, line, pathname, t, nsec, 'a', 0); +} + +/* Verify atime of 'pathname' is up-to-date. */ +int +assertion_file_atime_recent(const char *file, int line, const char *pathname) +{ + return assertion_file_time(file, line, pathname, 0, 0, 'a', 1); +} + +/* Verify birthtime of 'pathname'. */ +int +assertion_file_birthtime(const char *file, int line, + const char *pathname, long t, long nsec) +{ + return assertion_file_time(file, line, pathname, t, nsec, 'b', 0); +} + +/* Verify birthtime of 'pathname' is up-to-date. */ +int +assertion_file_birthtime_recent(const char *file, int line, + const char *pathname) +{ + return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); +} + +/* Verify mtime of 'pathname'. */ +int +assertion_file_mtime(const char *file, int line, + const char *pathname, long t, long nsec) +{ + return assertion_file_time(file, line, pathname, t, nsec, 'm', 0); +} + +/* Verify mtime of 'pathname' is up-to-date. */ +int +assertion_file_mtime_recent(const char *file, int line, const char *pathname) +{ + return assertion_file_time(file, line, pathname, 0, 0, 'm', 1); +} + +/* Verify number of links to 'pathname'. */ +int +assertion_file_nlinks(const char *file, int line, + const char *pathname, int nlinks) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + BY_HANDLE_FILE_INFORMATION bhfi; + int r; + + assertion_count(file, line); + r = my_GetFileInformationByName(pathname, &bhfi); + if (r != 0 && bhfi.nNumberOfLinks == (DWORD)nlinks) + return (1); + failure_start(file, line, "File %s has %d links, expected %d", + pathname, bhfi.nNumberOfLinks, nlinks); + failure_finish(NULL); + return (0); +#else + struct stat st; + int r; + + assertion_count(file, line); + r = lstat(pathname, &st); + if (r == 0 && st.st_nlink == nlinks) + return (1); + failure_start(file, line, "File %s has %d links, expected %d", + pathname, st.st_nlink, nlinks); + failure_finish(NULL); + return (0); +#endif +} + +/* Verify size of 'pathname'. */ +int +assertion_file_size(const char *file, int line, const char *pathname, long size) +{ + int64_t filesize; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + { + BY_HANDLE_FILE_INFORMATION bhfi; + r = !my_GetFileInformationByName(pathname, &bhfi); + filesize = ((int64_t)bhfi.nFileSizeHigh << 32) + bhfi.nFileSizeLow; + } +#else + { + struct stat st; + r = lstat(pathname, &st); + filesize = st.st_size; + } +#endif + if (r == 0 && filesize == size) + return (1); + failure_start(file, line, "File %s has size %ld, expected %ld", + pathname, (long)filesize, (long)size); + failure_finish(NULL); + return (0); +} + +/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */ +int +assertion_is_dir(const char *file, int line, const char *pathname, int mode) +{ + struct stat st; + int r; + +#if defined(_WIN32) && !defined(__CYGWIN__) + (void)mode; /* UNUSED */ +#endif + assertion_count(file, line); + r = lstat(pathname, &st); + if (r != 0) { + failure_start(file, line, "Dir should exist: %s", pathname); + failure_finish(NULL); + return (0); + } + if (!S_ISDIR(st.st_mode)) { + failure_start(file, line, "%s is not a dir", pathname); + failure_finish(NULL); + return (0); + } +#if !defined(_WIN32) || defined(__CYGWIN__) + /* Windows doesn't handle permissions the same way as POSIX, + * so just ignore the mode tests. */ + /* TODO: Can we do better here? */ + if (mode >= 0 && mode != (st.st_mode & 07777)) { + failure_start(file, line, "Dir %s has wrong mode", pathname); + logprintf(" Expected: 0%3o\n", mode); + logprintf(" Found: 0%3o\n", st.st_mode & 07777); + failure_finish(NULL); + return (0); + } +#endif + return (1); +} + +/* Verify that 'pathname' is a regular file. If 'mode' is >= 0, + * verify that too. */ +int +assertion_is_reg(const char *file, int line, const char *pathname, int mode) +{ + struct stat st; + int r; + +#if defined(_WIN32) && !defined(__CYGWIN__) + (void)mode; /* UNUSED */ +#endif + assertion_count(file, line); + r = lstat(pathname, &st); + if (r != 0 || !S_ISREG(st.st_mode)) { + failure_start(file, line, "File should exist: %s", pathname); + failure_finish(NULL); + return (0); + } +#if !defined(_WIN32) || defined(__CYGWIN__) + /* Windows doesn't handle permissions the same way as POSIX, + * so just ignore the mode tests. */ + /* TODO: Can we do better here? */ + if (mode >= 0 && mode != (st.st_mode & 07777)) { + failure_start(file, line, "File %s has wrong mode", pathname); + logprintf(" Expected: 0%3o\n", mode); + logprintf(" Found: 0%3o\n", st.st_mode & 07777); + failure_finish(NULL); + return (0); + } +#endif + return (1); +} + +/* Check whether 'pathname' is a symbolic link. If 'contents' is + * non-NULL, verify that the symlink has those contents. */ +static int +is_symlink(const char *file, int line, + const char *pathname, const char *contents) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + (void)pathname; /* UNUSED */ + (void)contents; /* UNUSED */ + assertion_count(file, line); + /* Windows sort-of has real symlinks, but they're only usable + * by privileged users and are crippled even then, so there's + * really not much point in bothering with this. */ + return (0); +#else + char buff[300]; + struct stat st; + ssize_t linklen; + int r; + + assertion_count(file, line); + r = lstat(pathname, &st); + if (r != 0) { + failure_start(file, line, + "Symlink should exist: %s", pathname); + failure_finish(NULL); + return (0); + } + if (!S_ISLNK(st.st_mode)) + return (0); + if (contents == NULL) + return (1); + linklen = readlink(pathname, buff, sizeof(buff)); + if (linklen < 0) { + failure_start(file, line, "Can't read symlink %s", pathname); + failure_finish(NULL); + return (0); + } + buff[linklen] = '\0'; + if (strcmp(buff, contents) != 0) + return (0); + return (1); +#endif +} + +/* Assert that path is a symlink that (optionally) contains contents. */ +int +assertion_is_symlink(const char *file, int line, + const char *path, const char *contents) +{ + if (is_symlink(file, line, path, contents)) + return (1); + if (contents) + failure_start(file, line, "File %s is not a symlink to %s", + path, contents); + else + failure_start(file, line, "File %s is not a symlink", path); + failure_finish(NULL); + return (0); +} + + +/* Create a directory and report any errors. */ +int +assertion_make_dir(const char *file, int line, const char *dirname, int mode) +{ + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + (void)mode; /* UNUSED */ + if (0 == _mkdir(dirname)) + return (1); +#else + if (0 == mkdir(dirname, mode)) + return (1); +#endif + failure_start(file, line, "Could not create directory %s", dirname); + failure_finish(NULL); + return(0); +} + +/* Create a file with the specified contents and report any failures. */ +int +assertion_make_file(const char *file, int line, + const char *path, int mode, const char *contents) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + /* TODO: Rework this to set file mode as well. */ + FILE *f; + (void)mode; /* UNUSED */ + assertion_count(file, line); + f = fopen(path, "wb"); + if (f == NULL) { + failure_start(file, line, "Could not create file %s", path); + failure_finish(NULL); + return (0); + } + if (contents != NULL) { + if (strlen(contents) + != fwrite(contents, 1, strlen(contents), f)) { + fclose(f); + failure_start(file, line, + "Could not write file %s", path); + failure_finish(NULL); + return (0); + } + } + fclose(f); + return (1); +#else + int fd; + assertion_count(file, line); + fd = open(path, O_CREAT | O_WRONLY, mode >= 0 ? mode : 0644); + if (fd < 0) { + failure_start(file, line, "Could not create %s", path); + failure_finish(NULL); + return (0); + } + if (contents != NULL) { + if ((ssize_t)strlen(contents) + != write(fd, contents, strlen(contents))) { + close(fd); + failure_start(file, line, "Could not write to %s", path); + failure_finish(NULL); + return (0); + } + } + close(fd); + return (1); +#endif +} + +/* Create a hardlink and report any failures. */ +int +assertion_make_hardlink(const char *file, int line, + const char *newpath, const char *linkto) +{ + int succeeded; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + succeeded = my_CreateHardLinkA(newpath, linkto); +#elif HAVE_LINK + succeeded = !link(linkto, newpath); +#else + succeeded = 0; +#endif + if (succeeded) + return (1); + failure_start(file, line, "Could not create hardlink"); + logprintf(" New link: %s\n", newpath); + logprintf(" Old name: %s\n", linkto); + failure_finish(NULL); + return(0); +} + +/* Create a symlink and report any failures. */ +int +assertion_make_symlink(const char *file, int line, + const char *newpath, const char *linkto) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + int targetIsDir = 0; /* TODO: Fix this */ + assertion_count(file, line); + if (my_CreateSymbolicLinkA(newpath, linkto, targetIsDir)) + return (1); +#elif HAVE_SYMLINK + assertion_count(file, line); + if (0 == symlink(linkto, newpath)) + return (1); +#endif + failure_start(file, line, "Could not create symlink"); + logprintf(" New link: %s\n", newpath); + logprintf(" Old name: %s\n", linkto); + failure_finish(NULL); + return(0); +} + +/* Set umask, report failures. */ +int +assertion_umask(const char *file, int line, int mask) +{ + assertion_count(file, line); + (void)file; /* UNUSED */ + (void)line; /* UNUSED */ + umask(mask); + return (1); +} + +/* + * + * UTILITIES for use by tests. + * + */ + +/* + * Check whether platform supports symlinks. This is intended + * for tests to use in deciding whether to bother testing symlink + * support; if the platform doesn't support symlinks, there's no point + * in checking whether the program being tested can create them. + * + * Note that the first time this test is called, we actually go out to + * disk to create and verify a symlink. This is necessary because + * symlink support is actually a property of a particular filesystem + * and can thus vary between directories on a single system. After + * the first call, this returns the cached result from memory, so it's + * safe to call it as often as you wish. + */ +int +canSymlink(void) +{ + /* Remember the test result */ + static int value = 0, tested = 0; + if (tested) + return (value); + + ++tested; + assertion_make_file(__FILE__, __LINE__, "canSymlink.0", 0644, "a"); + /* Note: Cygwin has its own symlink() emulation that does not + * use the Win32 CreateSymbolicLink() function. */ +#if defined(_WIN32) && !defined(__CYGWIN__) + value = my_CreateSymbolicLinkA("canSymlink.1", "canSymlink.0", 0) + && is_symlink(__FILE__, __LINE__, "canSymlink.1", "canSymlink.0"); +#elif HAVE_SYMLINK + value = (0 == symlink("canSymlink.0", "canSymlink.1")) + && is_symlink(__FILE__, __LINE__, "canSymlink.1","canSymlink.0"); +#endif + return (value); +} + +/* + * Can this platform run the gzip program? + */ +/* Platform-dependent options for hiding the output of a subcommand. */ +#if defined(_WIN32) && !defined(__CYGWIN__) +static const char *redirectArgs = ">NUL 2>NUL"; /* Win32 cmd.exe */ +#else +static const char *redirectArgs = ">/dev/null 2>/dev/null"; /* POSIX 'sh' */ +#endif +int +canGzip(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("gzip -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the gunzip program? + */ +int +canGunzip(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("gunzip -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Sleep as needed; useful for verifying disk timestamp changes by + * ensuring that the wall-clock time has actually changed before we + * go back to re-read something from disk. + */ +void +sleepUntilAfter(time_t t) +{ + while (t >= time(NULL)) +#if defined(_WIN32) && !defined(__CYGWIN__) + Sleep(500); +#else + sleep(1); +#endif +} + /* * Call standard system() call, but build up the command line using * sprintf() conventions. @@ -682,6 +1470,8 @@ systemf(const char *fmt, ...) va_start(ap, fmt); vsprintf(buff, fmt, ap); + if (verbosity > VERBOSITY_FULL) + logprintf("Cmd: %s\n", buff); r = system(buff); va_end(ap); return (r); @@ -700,176 +1490,48 @@ slurpfile(size_t * sizep, const char *fmt, ...) va_list ap; char *p; ssize_t bytes_read; - int fd; + FILE *f; int r; va_start(ap, fmt); vsprintf(filename, fmt, ap); va_end(ap); - fd = open(filename, O_RDONLY); - if (fd < 0) { + f = fopen(filename, "rb"); + if (f == NULL) { /* Note: No error; non-existent file is okay here. */ return (NULL); } - r = fstat(fd, &st); + r = fstat(fileno(f), &st); if (r != 0) { - fprintf(stderr, "Can't stat file %s\n", filename); - close(fd); + logprintf("Can't stat file %s\n", filename); + fclose(f); return (NULL); } - p = malloc(st.st_size + 1); + p = malloc((size_t)st.st_size + 1); if (p == NULL) { - fprintf(stderr, "Can't allocate %ld bytes of memory to read file %s\n", (long int)st.st_size, filename); - close(fd); + logprintf("Can't allocate %ld bytes of memory to read file %s\n", + (long int)st.st_size, filename); + fclose(f); return (NULL); } - bytes_read = read(fd, p, st.st_size); + bytes_read = fread(p, 1, (size_t)st.st_size, f); if (bytes_read < st.st_size) { - fprintf(stderr, "Can't read file %s\n", filename); - close(fd); + logprintf("Can't read file %s\n", filename); + fclose(f); free(p); return (NULL); } p[st.st_size] = '\0'; if (sizep != NULL) *sizep = (size_t)st.st_size; - close(fd); + fclose(f); return (p); } -/* - * "list.h" is automatically generated; it just has a lot of lines like: - * DEFINE_TEST(function_name) - * It's used above to declare all of the test functions. - * We reuse it here to define a list of all tests (functions and names). - */ -#undef DEFINE_TEST -#define DEFINE_TEST(n) { n, #n }, -struct { void (*func)(void); const char *name; } tests[] = { - #include "list.h" -}; - -/* - * This is well-intentioned, but sometimes the standard libraries - * leave open file descriptors and expect to be able to come back to - * them (e.g., for username lookups or logging). Closing these - * descriptors out from under those libraries creates havoc. - * - * Maybe there's some reasonably portable way to tell if a descriptor - * is open without using close()? - */ -#if 0 -static void -close_descriptors(int warn) -{ - int i; - int left_open = 0; - - for (i = 3; i < 100; ++i) { - if (close(i) == 0) - ++left_open; - } - if (warn && left_open > 0) { - fprintf(stderr, " ** %d descriptors unclosed\n", left_open); - failures += left_open; - report_failure(NULL); - } -} -#endif - -/* - * Each test is run in a private work dir. Those work dirs - * do have consistent and predictable names, in case a group - * of tests need to collaborate. However, there is no provision - * for requiring that tests run in a certain order. - */ -static int test_run(int i, const char *tmpdir) -{ - int failures_before = failures; - - if (!quiet_flag) { - printf("%d: %s\n", i, tests[i].name); - fflush(stdout); - } - - /* - * Always explicitly chdir() in case the last test moved us to - * a strange place. - */ - if (chdir(tmpdir)) { - fprintf(stderr, - "ERROR: Couldn't chdir to temp dir %s\n", - tmpdir); - exit(1); - } - /* Create a temp directory for this specific test. */ - if (mkdir(tests[i].name, 0755)) { - fprintf(stderr, - "ERROR: Couldn't create temp dir ``%s''\n", - tests[i].name); - exit(1); - } - /* Chdir() to that work directory. */ - if (chdir(tests[i].name)) { - fprintf(stderr, - "ERROR: Couldn't chdir to temp dir ``%s''\n", - tests[i].name); - exit(1); - } - /* Explicitly reset the locale before each test. */ - setlocale(LC_ALL, "C"); - /* Make sure there are no stray descriptors going into the test. */ - /* TODO: Find a better way to identify file descriptor leaks. */ - //close_descriptors(0); - /* Run the actual test. */ - (*tests[i].func)(); - /* Close stray descriptors, record as errors against this test. */ - //close_descriptors(1); - /* Summarize the results of this test. */ - summarize(); - /* If there were no failures, we can remove the work dir. */ - if (failures == failures_before) { - if (!keep_temp_files && chdir(tmpdir) == 0) { -#if !defined(_WIN32) || defined(__CYGWIN__) - systemf("rm -rf %s", tests[i].name); -#else - systemf("rmdir /S /Q %s", tests[i].name); -#endif - } - } - /* Return appropriate status. */ - return (failures == failures_before ? 0 : 1); -} - -static void usage(const char *program) -{ - static const int limit = sizeof(tests) / sizeof(tests[0]); - int i; - - printf("Usage: %s [options] ...\n", program); - printf("Default is to run all tests.\n"); - printf("Otherwise, specify the numbers of the tests you wish to run.\n"); - printf("Options:\n"); - printf(" -d Dump core after any failure, for debugging.\n"); - printf(" -k Keep all temp files.\n"); - printf(" Default: temp files for successful tests deleted.\n"); -#ifdef PROGRAM - printf(" -p Path to executable to be tested.\n"); - printf(" Default: path taken from " ENVBASE " environment variable.\n"); -#endif - printf(" -q Quiet.\n"); - printf(" -r Path to dir containing reference files.\n"); - printf(" Default: Current directory.\n"); - printf(" -v Verbose.\n"); - printf("Available tests:\n"); - for (i = 0; i < limit; i++) - printf(" %d: %s\n", i, tests[i].name); - exit(1); -} - +/* Read a uuencoded file from the reference directory, decode, and + * write the result into the current directory. */ #define UUDECODE(c) (((c) - 0x20) & 0x3f) - void extract_reference_file(const char *name) { @@ -893,7 +1555,7 @@ extract_reference_file(const char *name) } /* Now, decode the rest and write it. */ /* Not a lot of error checking here; the input better be right. */ - out = fopen(name, "w"); + out = fopen(name, "wb"); while (fgets(buff, sizeof(buff), in) != NULL) { char *p = buff; int bytes; @@ -927,48 +1589,211 @@ extract_reference_file(const char *name) fclose(in); } +/* + * + * TEST management + * + */ -/* Since gzip is by far the most popular external compression program - * available, we try to use it in the read_program and write_program - * tests. But if it's not available, then we can't use it. This - * function just tries to run gzip/gunzip to see if they're available. - * If not, some of the external compression program tests will be - * skipped. */ -const char * -external_gzip_program(int un) +/* + * "list.h" is simply created by "grep DEFINE_TEST test_*.c"; it has + * a line like + * DEFINE_TEST(test_function) + * for each test. + */ + +/* Use "list.h" to declare all of the test functions. */ +#undef DEFINE_TEST +#define DEFINE_TEST(name) void name(void); +#include "list.h" + +/* Use "list.h" to create a list of all tests (functions and names). */ +#undef DEFINE_TEST +#define DEFINE_TEST(n) { n, #n, 0 }, +struct { void (*func)(void); const char *name; int failures; } tests[] = { + #include "list.h" +}; + +/* + * Summarize repeated failures in the just-completed test. + */ +static void +test_summarize(const char *filename, int failed) { - static int tested = 0; - static const char *compress_prog = NULL; - static const char *decompress_prog = NULL; - /* Args vary depending on the command interpreter we're using. */ -#if defined(_WIN32) && !defined(__CYGWIN__) - static const char *args = "-V >NUL 2>NUL"; /* Win32 cmd.exe */ -#else - static const char *args = "-V >/dev/null 2>/dev/null"; /* POSIX 'sh' */ -#endif + unsigned int i; - if (!tested) { - if (systemf("gunzip %s", args) == 0) - decompress_prog = "gunzip"; - if (systemf("gzip %s", args) == 0) - compress_prog = "gzip"; - tested = 1; + switch (verbosity) { + case VERBOSITY_SUMMARY_ONLY: + printf(failed ? "E" : "."); + fflush(stdout); + break; + case VERBOSITY_PASSFAIL: + printf(failed ? "FAIL\n" : "ok\n"); + break; } - return (un ? decompress_prog : compress_prog); + + log_console = (verbosity == VERBOSITY_LIGHT_REPORT); + + for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) { + if (failed_lines[i].count > 1 && !failed_lines[i].skip) + logprintf("%s:%d: Summary: Failed %d times\n", + filename, i, failed_lines[i].count); + } + /* Clear the failure history for the next file. */ + memset(failed_lines, 0, sizeof(failed_lines)); +} + +/* + * Actually run a single test, with appropriate setup and cleanup. + */ +static int +test_run(int i, const char *tmpdir) +{ + char logfilename[64]; + int failures_before = failures; + int oldumask; + + switch (verbosity) { + case VERBOSITY_SUMMARY_ONLY: /* No per-test reports at all */ + break; + case VERBOSITY_PASSFAIL: /* rest of line will include ok/FAIL marker */ + printf("%3d: %-50s", i, tests[i].name); + fflush(stdout); + break; + default: /* Title of test, details will follow */ + printf("%3d: %s\n", i, tests[i].name); + } + + /* Chdir to the top-level work directory. */ + if (!assertChdir(tmpdir)) { + fprintf(stderr, + "ERROR: Can't chdir to top work dir %s\n", tmpdir); + exit(1); + } + /* Create a log file for this test. */ + sprintf(logfilename, "%s.log", tests[i].name); + logfile = fopen(logfilename, "w"); + fprintf(logfile, "%s\n\n", tests[i].name); + /* Chdir() to a work dir for this specific test. */ + if (!assertMakeDir(tests[i].name, 0755) + || !assertChdir(tests[i].name)) { + fprintf(stderr, + "ERROR: Can't chdir to work dir %s/%s\n", + tmpdir, tests[i].name); + exit(1); + } + /* Explicitly reset the locale before each test. */ + setlocale(LC_ALL, "C"); + /* Record the umask before we run the test. */ + umask(oldumask = umask(0)); + /* + * Run the actual test. + */ + (*tests[i].func)(); + /* + * Clean up and report afterwards. + */ + /* Restore umask */ + umask(oldumask); + /* Reset locale. */ + setlocale(LC_ALL, "C"); + /* Reset directory. */ + if (!assertChdir(tmpdir)) { + fprintf(stderr, "ERROR: Couldn't chdir to temp dir %s\n", + tmpdir); + exit(1); + } + /* Report per-test summaries. */ + tests[i].failures = failures - failures_before; + test_summarize(test_filename, tests[i].failures); + /* Close the per-test log file. */ + fclose(logfile); + logfile = NULL; + /* If there were no failures, we can remove the work dir and logfile. */ + if (tests[i].failures == 0) { + if (!keep_temp_files && assertChdir(tmpdir)) { +#if defined(_WIN32) && !defined(__CYGWIN__) + /* Make sure not to leave empty directories. + * Sometimes a processing of closing files used by tests + * is not done, then rmdir will be failed and it will + * leave a empty test directory. So we should wait a few + * seconds and retry rmdir. */ + int r, t; + for (t = 0; t < 10; t++) { + if (t > 0) + Sleep(1000); + r = systemf("rmdir /S /Q %s", tests[i].name); + if (r == 0) + break; + } + systemf("del %s", logfilename); +#else + systemf("rm -rf %s", tests[i].name); + systemf("rm %s", logfilename); +#endif + } + } + /* Return appropriate status. */ + return (tests[i].failures); +} + +/* + * + * + * MAIN and support routines. + * + * + */ + +static void +usage(const char *program) +{ + static const int limit = sizeof(tests) / sizeof(tests[0]); + int i; + + printf("Usage: %s [options] ...\n", program); + printf("Default is to run all tests.\n"); + printf("Otherwise, specify the numbers of the tests you wish to run.\n"); + printf("Options:\n"); + printf(" -d Dump core after any failure, for debugging.\n"); + printf(" -k Keep all temp files.\n"); + printf(" Default: temp files for successful tests deleted.\n"); +#ifdef PROGRAM + printf(" -p Path to executable to be tested.\n"); + printf(" Default: path taken from " ENVBASE " environment variable.\n"); +#endif + printf(" -q Quiet.\n"); + printf(" -r Path to dir containing reference files.\n"); + printf(" Default: Current directory.\n"); + printf(" -v Verbose.\n"); + printf("Available tests:\n"); + for (i = 0; i < limit; i++) + printf(" %d: %s\n", i, tests[i].name); + exit(1); } static char * -get_refdir(void) +get_refdir(const char *d) { char tried[512] = { '\0' }; char buff[128]; char *pwd, *p; + /* If a dir was specified, try that */ + if (d != NULL) { + pwd = NULL; + snprintf(buff, sizeof(buff), "%s", d); + p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); + if (p != NULL) goto success; + strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); + strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + goto failure; + } + /* Get the current dir. */ pwd = getcwd(NULL, 0); while (pwd[strlen(pwd) - 1] == '\n') pwd[strlen(pwd) - 1] = '\0'; - printf("PWD: %s\n", pwd); /* Look for a known file. */ snprintf(buff, sizeof(buff), "%s", pwd); @@ -983,7 +1808,11 @@ get_refdir(void) strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); +#if defined(LIBRARY) snprintf(buff, sizeof(buff), "%s/%s/test", pwd, LIBRARY); +#else + snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM); +#endif p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); if (p != NULL) goto success; strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); @@ -1003,11 +1832,12 @@ get_refdir(void) strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); } +failure: + printf("Unable to locate known reference file %s\n", KNOWNREF); + printf(" Checked following directories:\n%s\n", tried); #if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG) DebugBreak(); #endif - printf("Unable to locate known reference file %s\n", KNOWNREF); - printf(" Checked following directories:\n%s\n", tried); exit(1); success: @@ -1016,31 +1846,42 @@ get_refdir(void) return strdup(buff); } -int main(int argc, char **argv) +int +main(int argc, char **argv) { static const int limit = sizeof(tests) / sizeof(tests[0]); int i, tests_run = 0, tests_failed = 0, option; time_t now; char *refdir_alloc = NULL; - const char *progname = LIBRARY "_test"; + const char *progname; const char *tmp, *option_arg, *p; char tmpdir[256]; char tmpdir_timestamp[256]; (void)argc; /* UNUSED */ -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(HAVE__CrtSetReportMode) /* To stop to run the default invalid parameter handler. */ _set_invalid_parameter_handler(invalid_parameter_handler); - /* for open() to a binary mode. */ - _set_fmode(_O_BINARY); /* Disable annoying assertion message box. */ _CrtSetReportMode(_CRT_ASSERT, 0); #endif + /* + * Name of this program, used to build root of our temp directory + * tree. + */ + progname = p = argv[0]; + while (*p != '\0') { + /* Support \ or / dir separators for Windows compat. */ + if (*p == '/' || *p == '\\') + progname = p + 1; + ++p; + } + #ifdef PROGRAM /* Get the target program from environment, if available. */ - testprog = getenv(ENVBASE); + testprogfile = getenv(ENVBASE); #endif if (getenv("TMPDIR") != NULL) @@ -1098,19 +1939,19 @@ int main(int argc, char **argv) break; case 'p': #ifdef PROGRAM - testprog = option_arg; + testprogfile = option_arg; #else usage(progname); #endif break; case 'q': - quiet_flag++; + verbosity--; break; case 'r': refdir = option_arg; break; case 'v': - verbose = 1; + verbosity++; break; default: usage(progname); @@ -1122,8 +1963,26 @@ int main(int argc, char **argv) * Sanity-check that our options make sense. */ #ifdef PROGRAM - if (testprog == NULL) + if (testprogfile == NULL) usage(progname); + { + char *testprg; +#if defined(_WIN32) && !defined(__CYGWIN__) + /* Command.com sometimes rejects '/' separators. */ + testprg = strdup(testprogfile); + for (i = 0; testprg[i] != '\0'; i++) { + if (testprg[i] == '/') + testprg[i] = '\\'; + } + testprogfile = testprg; +#endif + /* Quote the name that gets put into shell command lines. */ + testprg = malloc(strlen(testprogfile) + 3); + strcpy(testprg, "\""); + strcat(testprg, testprogfile); + strcat(testprg, "\""); + testprog = testprg; + } #endif /* @@ -1132,19 +1991,20 @@ int main(int argc, char **argv) * to make it easier to track the results of multiple tests. */ now = time(NULL); - for (i = 0; i < 1000; i++) { + for (i = 0; ; i++) { strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp), "%Y-%m-%dT%H.%M.%S", localtime(&now)); sprintf(tmpdir, "%s/%s.%s-%03d", tmp, progname, tmpdir_timestamp, i); - if (mkdir(tmpdir,0755) == 0) + if (assertMakeDir(tmpdir,0755)) break; - if (errno == EEXIST) - continue; - fprintf(stderr, "ERROR: Unable to create temp directory %s\n", - tmpdir); - exit(1); + if (i >= 999) { + fprintf(stderr, + "ERROR: Unable to create temp directory %s\n", + tmpdir); + exit(1); + } } /* @@ -1152,14 +2012,16 @@ int main(int argc, char **argv) * reference files, try to find the reference files in * the "usual places." */ - if (refdir == NULL) - refdir = refdir_alloc = get_refdir(); + refdir = refdir_alloc = get_refdir(refdir); /* * Banner with basic information. */ - if (!quiet_flag) { - printf("Running tests in: %s\n", tmpdir); + printf("\n"); + printf("If tests fail or crash, details will be in:\n"); + printf(" %s\n", tmpdir); + printf("\n"); + if (verbosity > VERBOSITY_SUMMARY_ONLY) { printf("Reference files will be read from: %s\n", refdir); #ifdef PROGRAM printf("Running tests on: %s\n", testprog); @@ -1167,6 +2029,9 @@ int main(int argc, char **argv) printf("Exercising: "); fflush(stdout); printf("%s\n", EXTRA_VERSION); + } else { + printf("Running "); + fflush(stdout); } /* @@ -1212,20 +2077,38 @@ int main(int argc, char **argv) /* * Report summary statistics. */ - if (!quiet_flag) { + if (verbosity > VERBOSITY_SUMMARY_ONLY) { printf("\n"); - printf("%d of %d tests reported failures\n", - tests_failed, tests_run); - printf(" Total of %d assertions checked.\n", assertions); - printf(" Total of %d assertions failed.\n", failures); - printf(" Total of %d reported skips.\n", skips); + printf("Totals:\n"); + printf(" Tests run: %8d\n", tests_run); + printf(" Tests failed: %8d\n", tests_failed); + printf(" Assertions checked:%8d\n", assertions); + printf(" Assertions failed: %8d\n", failures); + printf(" Skips reported: %8d\n", skips); + } + if (failures) { + printf("\n"); + printf("Failing tests:\n"); + for (i = 0; i < limit; ++i) { + if (tests[i].failures) + printf(" %d: %s (%d failures)\n", i, + tests[i].name, tests[i].failures); + } + printf("\n"); + printf("Details for failing tests: %s\n", tmpdir); + printf("\n"); + } else { + if (verbosity == VERBOSITY_SUMMARY_ONLY) + printf("\n"); + printf("%d tests passed, no failures\n", tests_run); } free(refdir_alloc); /* If the final tmpdir is empty, we can remove it. */ /* This should be the usual case when all tests succeed. */ + assertChdir(".."); rmdir(tmpdir); - return (tests_failed); + return (tests_failed ? 1 : 0); } diff --git a/lib/libarchive/test/test.h b/lib/libarchive/test/test.h index 94c66e8d3bca..6ea7b571f3f5 100644 --- a/lib/libarchive/test/test.h +++ b/lib/libarchive/test/test.h @@ -45,43 +45,85 @@ #error Oops: No config.h and no pre-built configuration in test.h. #endif -#if !defined(_WIN32) || defined(__CYGWIN__) -#include -#else -#include -#endif -#include -#include -#include -#include -#include +#include /* Windows requires this before sys/stat.h */ #include -#if !defined(_WIN32) || defined(__CYGWIN__) -#include -#endif -#include #ifdef USE_DMALLOC #include #endif +#if HAVE_DIRENT_H +#include +#endif +#ifdef HAVE_DIRECT_H +#include +#define dirent direct +#endif +#include +#include +#ifdef HAVE_IO_H +#include +#endif +#ifdef HAVE_STDINT_H +#include +#endif +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#ifdef HAVE_WINDOWS_H +#include +#endif -/* No non-FreeBSD platform will have __FBSDID, so just define it here. */ -#ifdef __FreeBSD__ -#include /* For __FBSDID */ -#else -/* Some non-FreeBSD platforms such as newlib-derived ones like - * cygwin, have __FBSDID, so this definition must be guarded. +/* + * System-specific tweaks. We really want to minimize these + * as much as possible, since they make it harder to understand + * the mainline code. */ -#ifndef __FBSDID -#define __FBSDID(a) /* null */ + +/* Windows (including Visual Studio and MinGW but not Cygwin) */ +#if defined(_WIN32) && !defined(__CYGWIN__) +#if !defined(__BORLANDC__) +#define strdup _strdup #endif +#define LOCALE_UTF8 NULL +#else +#define LOCALE_UTF8 "de_DE.UTF-8" #endif -#if defined(_WIN32) && !defined(__CYGWIN__) +/* Visual Studio */ +#ifdef _MSC_VER #define snprintf sprintf_s -#define LOCALE_DE "deu" -#else -#define LOCALE_DE "de_DE.UTF-8" +#endif + +#if defined(__BORLANDC__) +#pragma warn -8068 /* Constant out of range in comparison. */ +#endif + +/* Cygwin */ +#if defined(__CYGWIN__) +/* Cygwin-1.7.x is lazy about populating nlinks, so don't + * expect it to be accurate. */ +# define NLINKS_INACCURATE_FOR_DIRS +#endif + +/* Haiku OS */ +#if defined(__HAIKU__) +/* Haiku has typedefs in stdint.h (needed for int64_t) */ +#include +#endif + +/* Get a real definition for __FBSDID if we can */ +#if HAVE_SYS_CDEFS_H +#include +#endif + +/* If not, define it so as to avoid dangling semicolons. */ +#ifndef __FBSDID +#define __FBSDID(a) struct _undefined_hack #endif #ifndef O_BINARY @@ -95,38 +137,81 @@ #define DEFINE_TEST(name) void name(void); void name(void) /* An implementation of the standard assert() macro */ -#define assert(e) test_assert(__FILE__, __LINE__, (e), #e, NULL) - +#define assert(e) assertion_assert(__FILE__, __LINE__, (e), #e, NULL) +/* chdir() and error if it fails */ +#define assertChdir(path) \ + assertion_chdir(__FILE__, __LINE__, path) /* Assert two integers are the same. Reports value of each one if not. */ -#define assertEqualInt(v1,v2) \ - test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL) - +#define assertEqualInt(v1,v2) \ + assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL) /* Assert two strings are the same. Reports value of each one if not. */ #define assertEqualString(v1,v2) \ - test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL) + assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL) /* As above, but v1 and v2 are wchar_t * */ #define assertEqualWString(v1,v2) \ - test_assert_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL) + assertion_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL) /* As above, but raw blocks of bytes. */ #define assertEqualMem(v1, v2, l) \ - test_assert_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL) + assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL) /* Assert two files are the same; allow printf-style expansion of second name. * See below for comments about variable arguments here... */ #define assertEqualFile \ - test_setup(__FILE__, __LINE__);test_assert_equal_file + assertion_setup(__FILE__, __LINE__);assertion_equal_file /* Assert that a file is empty; supports printf-style arguments. */ #define assertEmptyFile \ - test_setup(__FILE__, __LINE__);test_assert_empty_file + assertion_setup(__FILE__, __LINE__);assertion_empty_file +/* Assert that a file is not empty; supports printf-style arguments. */ +#define assertNonEmptyFile \ + assertion_setup(__FILE__, __LINE__);assertion_non_empty_file +#define assertFileAtime(pathname, sec, nsec) \ + assertion_file_atime(__FILE__, __LINE__, pathname, sec, nsec) +#define assertFileAtimeRecent(pathname) \ + assertion_file_atime_recent(__FILE__, __LINE__, pathname) +#define assertFileBirthtime(pathname, sec, nsec) \ + assertion_file_birthtime(__FILE__, __LINE__, pathname, sec, nsec) +#define assertFileBirthtimeRecent(pathname) \ + assertion_file_birthtime_recent(__FILE__, __LINE__, pathname) /* Assert that a file exists; supports printf-style arguments. */ #define assertFileExists \ - test_setup(__FILE__, __LINE__);test_assert_file_exists + assertion_setup(__FILE__, __LINE__);assertion_file_exists /* Assert that a file exists; supports printf-style arguments. */ #define assertFileNotExists \ - test_setup(__FILE__, __LINE__);test_assert_file_not_exists + assertion_setup(__FILE__, __LINE__);assertion_file_not_exists /* Assert that file contents match a string; supports printf-style arguments. */ #define assertFileContents \ - test_setup(__FILE__, __LINE__);test_assert_file_contents + assertion_setup(__FILE__, __LINE__);assertion_file_contents +#define assertFileMtime(pathname, sec, nsec) \ + assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) +#define assertFileMtimeRecent(pathname) \ + assertion_file_mtime_recent(__FILE__, __LINE__, pathname) +#define assertFileNLinks(pathname, nlinks) \ + assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) +#define assertFileSize(pathname, size) \ + assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertTextFileContents \ + assertion_setup(__FILE__, __LINE__);assertion_text_file_contents +#define assertIsDir(pathname, mode) \ + assertion_is_dir(__FILE__, __LINE__, pathname, mode) +#define assertIsHardlink(path1, path2) \ + assertion_is_hardlink(__FILE__, __LINE__, path1, path2) +#define assertIsNotHardlink(path1, path2) \ + assertion_is_not_hardlink(__FILE__, __LINE__, path1, path2) +#define assertIsReg(pathname, mode) \ + assertion_is_reg(__FILE__, __LINE__, pathname, mode) +#define assertIsSymlink(pathname, contents) \ + assertion_is_symlink(__FILE__, __LINE__, pathname, contents) +/* Create a directory, report error if it fails. */ +#define assertMakeDir(dirname, mode) \ + assertion_make_dir(__FILE__, __LINE__, dirname, mode) +#define assertMakeFile(path, mode, contents) \ + assertion_make_file(__FILE__, __LINE__, path, mode, contents) +#define assertMakeHardlink(newfile, oldfile) \ + assertion_make_hardlink(__FILE__, __LINE__, newfile, oldfile) +#define assertMakeSymlink(newfile, linkto) \ + assertion_make_symlink(__FILE__, __LINE__, newfile, linkto) +#define assertUmask(mask) \ + assertion_umask(__FILE__, __LINE__, mask) /* * This would be simple with C99 variadic macros, but I don't want to @@ -135,26 +220,60 @@ * but effective. */ #define skipping \ - test_setup(__FILE__, __LINE__);test_skipping + assertion_setup(__FILE__, __LINE__);test_skipping /* Function declarations. These are defined in test_utility.c. */ void failure(const char *fmt, ...); -void test_setup(const char *, int); +int assertion_assert(const char *, int, int, const char *, void *); +int assertion_chdir(const char *, int, const char *); +int assertion_empty_file(const char *, ...); +int assertion_equal_file(const char *, const char *, ...); +int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *); +int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *); +int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *); +int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); +int assertion_file_atime(const char *, int, const char *, long, long); +int assertion_file_atime_recent(const char *, int, const char *); +int assertion_file_birthtime(const char *, int, const char *, long, long); +int assertion_file_birthtime_recent(const char *, int, const char *); +int assertion_file_contents(const void *, int, const char *, ...); +int assertion_file_exists(const char *, ...); +int assertion_file_mtime(const char *, int, const char *, long, long); +int assertion_file_mtime_recent(const char *, int, const char *); +int assertion_file_nlinks(const char *, int, const char *, int); +int assertion_file_not_exists(const char *, ...); +int assertion_file_size(const char *, int, const char *, long); +int assertion_is_dir(const char *, int, const char *, int); +int assertion_is_hardlink(const char *, int, const char *, const char *); +int assertion_is_not_hardlink(const char *, int, const char *, const char *); +int assertion_is_reg(const char *, int, const char *, int); +int assertion_is_symlink(const char *, int, const char *, const char *); +int assertion_make_dir(const char *, int, const char *, int); +int assertion_make_file(const char *, int, const char *, int, const char *); +int assertion_make_hardlink(const char *, int, const char *newpath, const char *); +int assertion_make_symlink(const char *, int, const char *newpath, const char *); +int assertion_non_empty_file(const char *, ...); +int assertion_text_file_contents(const char *buff, const char *f); +int assertion_umask(const char *, int, int); +void assertion_setup(const char *, int); + void test_skipping(const char *fmt, ...); -int test_assert(const char *, int, int, const char *, void *); -int test_assert_empty_file(const char *, ...); -int test_assert_equal_file(const char *, const char *, ...); -int test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *); -int test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *); -int test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); -int test_assert_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *); -int test_assert_file_contents(const void *, int, const char *, ...); -int test_assert_file_exists(const char *, ...); -int test_assert_file_not_exists(const char *, ...); /* Like sprintf, then system() */ int systemf(const char * fmt, ...); +/* Delay until time() returns a value after this. */ +void sleepUntilAfter(time_t); + +/* Return true if this platform can create symlinks. */ +int canSymlink(void); + +/* Return true if this platform can run the "gzip" program. */ +int canGzip(void); + +/* Return true if this platform can run the "gunzip" program. */ +int canGunzip(void); + /* Suck file into string allocated via malloc(). Call free() when done. */ /* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */ char *slurpfile(size_t *, const char *fmt, ...); @@ -162,9 +281,6 @@ char *slurpfile(size_t *, const char *fmt, ...); /* Extracts named reference file to the current directory. */ void extract_reference_file(const char *); -/* Get external gzip program name */ -const char *external_gzip_program(int un); - /* * Special interfaces for libarchive test harness. */ @@ -177,20 +293,9 @@ int read_open_memory(struct archive *, void *, size_t, size_t); /* "2" version exercises a slightly different set of libarchive APIs. */ int read_open_memory2(struct archive *, void *, size_t, size_t); -/* - * ARCHIVE_VERSION_STAMP first appeared in 1.9 and libarchive 2.2.4. - * We can approximate it for earlier versions, though. - * This is used to disable tests of features not present in the current - * version. - */ -#ifndef ARCHIVE_VERSION_STAMP -#define ARCHIVE_VERSION_STAMP \ - (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000) -#endif - /* Versions of above that accept an archive argument for additional info. */ -#define assertA(e) test_assert(__FILE__, __LINE__, (e), #e, (a)) +#define assertA(e) assertion_assert(__FILE__, __LINE__, (e), #e, (a)) #define assertEqualIntA(a,v1,v2) \ - test_assert_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) + assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) #define assertEqualStringA(a,v1,v2) \ - test_assert_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) + assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a)) diff --git a/lib/libarchive/test/test_acl_pax.c b/lib/libarchive/test/test_acl_pax.c index 5898a6626d73..f6b065d2a689 100644 --- a/lib/libarchive/test/test_acl_pax.c +++ b/lib/libarchive/test/test_acl_pax.c @@ -406,7 +406,7 @@ DEFINE_TEST(test_acl_pax) struct archive *a; struct archive_entry *ae; size_t used; - int fd; + FILE *f; /* Write an archive to memory. */ assert(NULL != (a = archive_write_new())); @@ -453,14 +453,14 @@ DEFINE_TEST(test_acl_pax) #endif /* Write out the data we generated to a file for manual inspection. */ - assert(-1 < (fd = open("testout", O_WRONLY | O_CREAT | O_TRUNC, 0775))); - assert(used == (size_t)write(fd, buff, (unsigned int)used)); - close(fd); + assert(NULL != (f = fopen("testout", "wb"))); + assertEqualInt(used, (size_t)fwrite(buff, 1, (unsigned int)used, f)); + fclose(f); /* Write out the reference data to a file for manual inspection. */ - assert(-1 < (fd = open("reference", O_WRONLY | O_CREAT | O_TRUNC, 0775))); - assert(sizeof(reference) == write(fd, reference, sizeof(reference))); - close(fd); + assert(NULL != (f = fopen("reference", "wb"))); + assert(sizeof(reference) == fwrite(reference, 1, sizeof(reference), f)); + fclose(f); /* Assert that the generated data matches the built-in reference data.*/ failure("Generated pax archive does not match reference; check 'testout' and 'reference' files."); diff --git a/lib/libarchive/test/test_compat_bzip2.c b/lib/libarchive/test/test_compat_bzip2.c index cbd113b0153a..96eacad79cc4 100644 --- a/lib/libarchive/test/test_compat_bzip2.c +++ b/lib/libarchive/test/test_compat_bzip2.c @@ -47,7 +47,10 @@ compat_bzip2(const char *name) int i; assert((a = archive_read_new()) != NULL); - assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); + if (ARCHIVE_OK != archive_read_support_compression_bzip2(a)) { + skipping("Unsupported bzip2"); + return; + } assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); extract_reference_file(name); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 2)); diff --git a/lib/libarchive/test/test_compat_cpio.c b/lib/libarchive/test/test_compat_cpio.c new file mode 100644 index 000000000000..b0ead3901e14 --- /dev/null +++ b/lib/libarchive/test/test_compat_cpio.c @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2003-2009 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * Verify our ability to read various sample files. + * It should be easy to add any new sample files sent in by users + * to this collection of tests. + */ + +/* Copy this function for each test file and adjust it accordingly. */ + +/* + * test_compat_cpio_1.cpio checks heuristics for avoiding false + * hardlinks. foo1 and foo2 are files that have nlinks=1 and so + * should not be marked as hardlinks even though they have identical + * ino values. bar1 and bar2 have nlinks=2 so should be marked + * as hardlinks. + */ +static void +test_compat_cpio_1(void) +{ + char name[] = "test_compat_cpio_1.cpio"; + struct archive_entry *ae; + struct archive *a; + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 17)); + + /* Read first entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("foo1", archive_entry_pathname(ae)); + assertEqualString(NULL, archive_entry_hardlink(ae)); + assertEqualInt(1260250228, archive_entry_mtime(ae)); + assertEqualInt(1000, archive_entry_uid(ae)); + assertEqualInt(1000, archive_entry_gid(ae)); + assertEqualInt(0100644, archive_entry_mode(ae)); + + /* Read second entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("foo2", archive_entry_pathname(ae)); + assertEqualString(NULL, archive_entry_hardlink(ae)); + assertEqualInt(1260250228, archive_entry_mtime(ae)); + assertEqualInt(1000, archive_entry_uid(ae)); + assertEqualInt(1000, archive_entry_gid(ae)); + assertEqualInt(0100644, archive_entry_mode(ae)); + + /* Read third entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("bar1", archive_entry_pathname(ae)); + assertEqualString(NULL, archive_entry_hardlink(ae)); + assertEqualInt(1260250228, archive_entry_mtime(ae)); + assertEqualInt(1000, archive_entry_uid(ae)); + assertEqualInt(1000, archive_entry_gid(ae)); + assertEqualInt(0100644, archive_entry_mode(ae)); + + /* Read fourth entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("bar2", archive_entry_pathname(ae)); + assertEqualString("bar1", archive_entry_hardlink(ae)); + assertEqualInt(1260250228, archive_entry_mtime(ae)); + assertEqualInt(1000, archive_entry_uid(ae)); + assertEqualInt(1000, archive_entry_gid(ae)); + assertEqualInt(0100644, archive_entry_mode(ae)); + + /* Verify that the format detection worked. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_NOCRC); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); +} + + +DEFINE_TEST(test_compat_cpio) +{ + test_compat_cpio_1(); +} + + diff --git a/lib/libarchive/test/test_compat_cpio_1.cpio.uu b/lib/libarchive/test/test_compat_cpio_1.cpio.uu new file mode 100644 index 000000000000..3f0ee524c9fc --- /dev/null +++ b/lib/libarchive/test/test_compat_cpio_1.cpio.uu @@ -0,0 +1,19 @@ +$FreeBSD$ + +begin 644 test_compat_cpio_1.cpio +M,# $dir/f1 +echo "f2" > $dir/f2 +echo "f3" > $dir/f3 +mkdir $dir/d1 +echo "f1" > $dir/d1/f1 +echo "f2" > $dir/d1/f2 +echo "f3" > $dir/d1/f3 +(cd $dir; tar cf ../$name.tar f1 f2 f3 d1/f1 d1/f2 d1/f3) +rm -r $dir +} +mktarfile +$zcmd $name.tar +mv $name.tar.$zsuffix $name.$ztar_suffix +echo "This is unrelated junk data at the end of the file" >> $name.$ztar_suffix +uuencode $name.$ztar_suffix $name.$ztar_suffix > $name.$ztar_suffix.uu +rm -f $name.$ztar_suffix +# +# Use option -e +# +name=test_compat_lzma_2 +dir="$name`date +%Y%m%d%H%M%S`.$USER" +mktarfile +$zcmd -e $name.tar +mv $name.tar.$zsuffix $name.$ztar_suffix +uuencode $name.$ztar_suffix $name.$ztar_suffix > $name.$ztar_suffix.uu +rm -f $name.$ztar_suffix +# +# Use lzma command of LZMA SDK with option -d12. +# +name=test_compat_lzma_3 +zcmd=lzmasdk # Change this path to use lzma of LZMA SDK. +dir="$name`date +%Y%m%d%H%M%S`.$USER" +mktarfile +$zcmd e -d12 $name.tar $name.$ztar_suffix +rm -f $name.tar +uuencode $name.$ztar_suffix $name.$ztar_suffix > $name.$ztar_suffix.uu +rm -f $name.$ztar_suffix + +exit 0 +*/ + +/* + * Verify our ability to read sample files compatibly with unlzma. + * + * In particular: + * * unlzma will read multiple lzma streams, concatenating the output + * * unlzma will read lzma streams which is made by lzma with option -e, + * concatenating the output + * + * Verify our ability to read sample files compatibly with lzma of + * LZMA SDK. + * * lzma will read lzma streams which is made by lzma with option -d12, + * concatenating the output + */ + +/* + * All of the sample files have the same contents; they're just + * compressed in different ways. + */ +static void +compat_lzma(const char *name) +{ + const char *n[7] = { "f1", "f2", "f3", "d1/f1", "d1/f2", "d1/f3", NULL }; + struct archive_entry *ae; + struct archive *a; + int i, r; + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); + r = archive_read_support_compression_lzma(a); + if (r == ARCHIVE_WARN) { + skipping("lzma reading not fully supported on this platform"); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + return; + } + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 2)); + + /* Read entries, match up names with list above. */ + for (i = 0; i < 6; ++i) { + failure("Could not read file %d (%s) from %s", i, n[i], name); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString(n[i], archive_entry_pathname(ae)); + } + + /* Verify the end-of-archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify that the format detection worked. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_LZMA); + assertEqualString(archive_compression_name(a), "lzma"); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); +} + + +DEFINE_TEST(test_compat_lzma) +{ + /* This sample has been added junk datas to its tail. */ + compat_lzma("test_compat_lzma_1.tlz"); + /* This sample has been made by lzma with option -e, + * the first byte of which is 0x5e. + * Not supported in libarchive 2.7.* and earlier */ + compat_lzma("test_compat_lzma_2.tlz"); + /* This sample has been made by lzma of LZMA SDK with + * option -d12, second byte and third byte of which is + * not zero. + * Not supported in libarchive 2.7.* and earlier */ + compat_lzma("test_compat_lzma_3.tlz"); +} diff --git a/lib/libarchive/test/test_compat_lzma_1.tlz.uu b/lib/libarchive/test/test_compat_lzma_1.tlz.uu new file mode 100644 index 000000000000..3b6321114220 --- /dev/null +++ b/lib/libarchive/test/test_compat_lzma_1.tlz.uu @@ -0,0 +1,10 @@ +$FreeBSD$ + +begin 644 test_compat_lzma_1.tlz +M70``@`#__________P`S##P;IXPT!HUK`DO\DC[V2OB%Z^'=ZT59ANYMTD(/ +M^W;\8!%O7<+P&=#(9W<_!$Z.7/Y<&\(8+E0^,_-\Z"D^P'N0J^4-UH"WMJ<& +MV-P6=Y[-FY$IFNZ="RF24TO.B7EP[F]BGMJSP[]OZ_P9/#J'T=;7E&&A@J<[ +MA^C'Q*/Y&I)2^T930'MJTK-98U0D9R*-X2^5__6H:+A4:&ES(&ES('5N`W2"/3R1F1:P:&Q9A +MGH2JJI9$C?8.=WTE:O<1WA@X>DK-Y#SW;I2!P;NYG^2"-(D9/E(D_0XK_H,\ +95*/V"T#E9ZO][@'R,6E&^A([.##_\M#YU@`` +` +end diff --git a/lib/libarchive/test/test_compat_lzma_3.tlz.uu b/lib/libarchive/test/test_compat_lzma_3.tlz.uu new file mode 100644 index 000000000000..b8d61b70afd3 --- /dev/null +++ b/lib/libarchive/test/test_compat_lzma_3.tlz.uu @@ -0,0 +1,9 @@ +$FreeBSD$ + +begin 644 test_compat_lzma_3.tlz +M70`0````'``````````S##P;IXPT!HUK`DO\DC[V2OB%Z^'=ZT59ANYMTD(1 +M$Y^=;\4%U_CXKQ*F$OFZKEQUG)1U8="](V<2K"U1\Z6%H(UNQ[Y3.=D'>_G- +MCO71X+M*7WH7$D1&E9Y$XHW,(`[X";GGTO+,'&1?F%<@`.$-OV;8P1?*M$A" +:MA+1XONREMK,1('455L=X1>WC#1YW"('I@`` +` +end diff --git a/lib/libarchive/test/test_compat_solaris_tar_acl.c b/lib/libarchive/test/test_compat_solaris_tar_acl.c index ec3955ecd7fe..af4f9d3825df 100644 --- a/lib/libarchive/test/test_compat_solaris_tar_acl.c +++ b/lib/libarchive/test/test_compat_solaris_tar_acl.c @@ -50,9 +50,9 @@ DEFINE_TEST(test_compat_solaris_tar_acl) /* Archive has 1 entry with some ACLs set on it. */ assertA(0 == archive_read_next_header(a, &ae)); - failure("Basic ACLs should set mode to 0640, not %04o", + failure("Basic ACLs should set mode to 0644, not %04o", archive_entry_mode(ae)&0777); - assertEqualInt((archive_entry_mode(ae) & 0777), 0640); + assertEqualInt((archive_entry_mode(ae) & 0777), 0644); assertEqualInt(7, archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); assertEqualInt(ARCHIVE_OK, archive_entry_acl_next(ae, @@ -77,7 +77,7 @@ DEFINE_TEST(test_compat_solaris_tar_acl) ARCHIVE_ENTRY_ACL_TYPE_ACCESS, &type, &permset, &tag, &qual, &name)); assertEqualInt(ARCHIVE_ENTRY_ACL_TYPE_ACCESS, type); - assertEqualInt(000, permset); + assertEqualInt(004, permset); assertEqualInt(ARCHIVE_ENTRY_ACL_OTHER, tag); assertEqualInt(-1, qual); assert(name == NULL); diff --git a/lib/libarchive/test/test_entry.c b/lib/libarchive/test/test_entry.c index b79e822cc723..bd946c44a9e7 100644 --- a/lib/libarchive/test/test_entry.c +++ b/lib/libarchive/test/test_entry.c @@ -51,12 +51,39 @@ DEFINE_TEST(test_entry) const char *xname; /* For xattr tests. */ const void *xval; /* For xattr tests. */ size_t xsize; /* For xattr tests. */ - int c; wchar_t wc; long l; assert((e = archive_entry_new()) != NULL); + /* + * Verify that the AE_IF* defines match S_IF* defines + * on this platform. See comments in archive_entry.h. + */ +#ifdef S_IFREG + assertEqualInt(S_IFREG, AE_IFREG); +#endif +#ifdef S_IFLNK + assertEqualInt(S_IFLNK, AE_IFLNK); +#endif +#ifdef S_IFSOCK + assertEqualInt(S_IFSOCK, AE_IFSOCK); +#endif +#ifdef S_IFCHR + assertEqualInt(S_IFCHR, AE_IFCHR); +#endif +/* Work around MinGW, which defines S_IFBLK wrong. */ +/* sourceforge.net/tracker/?func=detail&atid=102435&aid=1942809&group_id=2435 */ +#if defined(S_IFBLK) && !defined(_WIN32) + assertEqualInt(S_IFBLK, AE_IFBLK); +#endif +#ifdef S_IFDIR + assertEqualInt(S_IFDIR, AE_IFDIR); +#endif +#ifdef S_IFIFO + assertEqualInt(S_IFIFO, AE_IFIFO); +#endif + /* * Basic set/read tests for all fields. * We should be able to set any field and read @@ -414,7 +441,7 @@ DEFINE_TEST(test_entry) skipping("ACL preserved by archive_entry_clone()"); #else /* Verify ACL was copied. */ - assertEqualInt(4, c = archive_entry_acl_reset(e2, + assertEqualInt(4, archive_entry_acl_reset(e2, ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); /* First three are standard permission bits. */ assertEqualInt(0, archive_entry_acl_next(e2, @@ -455,7 +482,7 @@ DEFINE_TEST(test_entry) skipping("xattr data preserved by archive_entry_clone"); #else /* Verify xattr was copied. */ - assertEqualInt(1, c = archive_entry_xattr_reset(e2)); + assertEqualInt(1, archive_entry_xattr_reset(e2)); assertEqualInt(0, archive_entry_xattr_next(e2, &xname, &xval, &xsize)); assertEqualString(xname, "xattr1"); assertEqualString(xval, "xattrvalue"); @@ -539,7 +566,7 @@ DEFINE_TEST(test_entry) skipping("ACL held by clone of archive_entry"); #else /* Verify ACL was unchanged. */ - assertEqualInt(4, c = archive_entry_acl_reset(e2, + assertEqualInt(4, archive_entry_acl_reset(e2, ARCHIVE_ENTRY_ACL_TYPE_ACCESS)); /* First three are standard permission bits. */ assertEqualInt(0, archive_entry_acl_next(e2, @@ -807,7 +834,7 @@ DEFINE_TEST(test_entry) /* * Exercise the character-conversion logic, if we can. */ - if (NULL == setlocale(LC_ALL, LOCALE_DE)) { + if (NULL == LOCALE_UTF8 || NULL == setlocale(LC_ALL, LOCALE_UTF8)) { skipping("Can't exercise charset-conversion logic without" " a suitable locale."); } else { diff --git a/lib/libarchive/test/test_entry_strmode.c b/lib/libarchive/test/test_entry_strmode.c index 5ede8b6f2172..70c0e7556968 100644 --- a/lib/libarchive/test/test_entry_strmode.c +++ b/lib/libarchive/test/test_entry_strmode.c @@ -31,11 +31,11 @@ DEFINE_TEST(test_entry_strmode) assert((entry = archive_entry_new()) != NULL); - archive_entry_set_mode(entry, S_IFREG | 0642); + archive_entry_set_mode(entry, AE_IFREG | 0642); assertEqualString(archive_entry_strmode(entry), "-rw-r---w- "); /* Regular file + hardlink still shows as regular file. */ - archive_entry_set_mode(entry, S_IFREG | 0644); + archive_entry_set_mode(entry, AE_IFREG | 0644); archive_entry_set_hardlink(entry, "link"); assertEqualString(archive_entry_strmode(entry), "-rw-r--r-- "); @@ -44,22 +44,22 @@ DEFINE_TEST(test_entry_strmode) assertEqualString(archive_entry_strmode(entry), "hrw-r----- "); archive_entry_set_hardlink(entry, NULL); - archive_entry_set_mode(entry, S_IFDIR | 0777); + archive_entry_set_mode(entry, AE_IFDIR | 0777); assertEqualString(archive_entry_strmode(entry), "drwxrwxrwx "); - archive_entry_set_mode(entry, S_IFBLK | 03642); + archive_entry_set_mode(entry, AE_IFBLK | 03642); assertEqualString(archive_entry_strmode(entry), "brw-r-S-wT "); - archive_entry_set_mode(entry, S_IFCHR | 05777); + archive_entry_set_mode(entry, AE_IFCHR | 05777); assertEqualString(archive_entry_strmode(entry), "crwsrwxrwt "); - archive_entry_set_mode(entry, S_IFSOCK | 0222); + archive_entry_set_mode(entry, AE_IFSOCK | 0222); assertEqualString(archive_entry_strmode(entry), "s-w--w--w- "); - archive_entry_set_mode(entry, S_IFIFO | 0444); + archive_entry_set_mode(entry, AE_IFIFO | 0444); assertEqualString(archive_entry_strmode(entry), "pr--r--r-- "); - archive_entry_set_mode(entry, S_IFLNK | 04000); + archive_entry_set_mode(entry, AE_IFLNK | 04000); assertEqualString(archive_entry_strmode(entry), "l--S------ "); archive_entry_acl_add_entry(entry, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, diff --git a/lib/libarchive/test/test_extattr_freebsd.c b/lib/libarchive/test/test_extattr_freebsd.c index 19881c2ece59..de3ae2a586d1 100644 --- a/lib/libarchive/test/test_extattr_freebsd.c +++ b/lib/libarchive/test/test_extattr_freebsd.c @@ -85,7 +85,7 @@ DEFINE_TEST(test_extattr_freebsd) n = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, "testattr", "1234", 4); if (n != 4) { - skipping("Restoring xattr to an unwritable file (broken in some versions of FreeBSD"); + skipping("Restoring xattr to an unwritable file seems to be broken on this platform"); extattr_privilege_bug = 1; } close(fd); @@ -114,17 +114,15 @@ DEFINE_TEST(test_extattr_freebsd) archive_entry_set_size(ae, 0); archive_entry_set_mode(ae, 0); archive_entry_xattr_add_entry(ae, "user.bar", "123456", 6); - if (extattr_privilege_bug) - /* If the bug is here, write_header will return warning. */ - assertEqualIntA(a, ARCHIVE_WARN, - archive_write_header(a, ae)); - else - assertEqualIntA(a, ARCHIVE_OK, - archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); archive_entry_free(ae); /* Close the archive. */ - assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + if (extattr_privilege_bug) + /* If the bug is here, write_close will return warning. */ + assertEqualIntA(a, ARCHIVE_WARN, archive_write_close(a)); + else + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); /* Verify the data on disk. */ diff --git a/lib/libarchive/test/test_fuzz.c b/lib/libarchive/test/test_fuzz.c index 9c5a05615903..7e3f28d0bb32 100644 --- a/lib/libarchive/test/test_fuzz.c +++ b/lib/libarchive/test/test_fuzz.c @@ -44,86 +44,87 @@ __FBSDID("$FreeBSD$"); * post-failure diagnostics. */ -/* Because this works for any archive, I can just re-use the archives - * developed for other tests. I've not included all of the compressed - * archives here, though; I don't want to spend all of my test time - * testing zlib and bzlib. */ -static const char * -files[] = { - "test_fuzz_1.iso", - "test_compat_bzip2_1.tbz", - "test_compat_gtar_1.tar", - "test_compat_tar_hardlink_1.tar", - "test_compat_zip_1.zip", - "test_read_format_gtar_sparse_1_17_posix10_modified.tar", - "test_read_format_tar_empty_filename.tar", - "test_read_format_zip.zip", - NULL +/* Because this works for any archive, we can just re-use the archives + * developed for other tests. */ +static struct { + int uncompress; /* If 1, decompress the file before fuzzing. */ + const char *name; +} files[] = { + {0, "test_fuzz_1.iso.Z"}, /* Exercise compress decompressor. */ + {1, "test_fuzz_1.iso.Z"}, + {0, "test_compat_bzip2_1.tbz"}, /* Exercise bzip2 decompressor. */ + {1, "test_compat_bzip2_1.tbz"}, + {0, "test_compat_gtar_1.tar"}, + {0, "test_compat_gzip_1.tgz"}, /* Exercise gzip decompressor. */ + {0, "test_compat_gzip_2.tgz"}, /* Exercise gzip decompressor. */ + {0, "test_compat_tar_hardlink_1.tar"}, + {0, "test_compat_xz_1.txz"}, /* Exercise xz decompressor. */ + {0, "test_compat_zip_1.zip"}, + {0, "test_read_format_ar.ar"}, + {0, "test_read_format_cpio_bin_be.cpio"}, + {0, "test_read_format_gtar_sparse_1_17_posix10_modified.tar"}, + {0, "test_read_format_mtree.mtree"}, + {0, "test_read_format_tar_empty_filename.tar"}, + {0, "test_read_format_zip.zip"}, + {1, NULL} }; -#define UnsupportedCompress(r, a) \ - (r != ARCHIVE_OK && \ - (strcmp(archive_error_string(a), \ - "Unrecognized archive format") == 0 && \ - archive_compression(a) == ARCHIVE_COMPRESSION_NONE)) - DEFINE_TEST(test_fuzz) { - const char **filep; const void *blk; size_t blk_size; off_t blk_offset; + int n; - for (filep = files; *filep != NULL; ++filep) { + for (n = 0; files[n].name != NULL; ++n) { + const size_t buffsize = 30000000; + const char *filename = files[n].name; struct archive_entry *ae; struct archive *a; char *rawimage, *image; size_t size; - int i, r; + int i; - extract_reference_file(*filep); - rawimage = slurpfile(&size, *filep); - assert(rawimage != NULL); - image = malloc(size); - assert(image != NULL); - srand(time(NULL)); - - assert((a = archive_read_new()) != NULL); - assert(0 == archive_read_support_compression_all(a)); - assert(0 == archive_read_support_format_all(a)); - assert(0 == archive_read_open_memory(a, rawimage, size)); - r = archive_read_next_header(a, &ae); - if (UnsupportedCompress(r, a)) { - skipping("Skipping GZIP/BZIP2 compression check: " - "This version of libarchive was compiled " - "without gzip/bzip2 support"); - assert(0 == archive_read_close(a)); - assert(0 == archive_read_finish(a)); - continue; - } - assert(0 == r); - if (r == ARCHIVE_OK) { - char buff[20]; - - r = archive_read_data(a, buff, 19); - if (r < ARCHIVE_OK && strcmp(archive_error_string(a), - "libarchive compiled without deflate support (no libz)") == 0) { - skipping("Skipping ZIP compression check: %s", - archive_error_string(a)); - assert(0 == archive_read_close(a)); - assert(0 == archive_read_finish(a)); + extract_reference_file(filename); + if (files[n].uncompress) { + int r; + /* Use format_raw to decompress the data. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_raw(a)); + r = archive_read_open_filename(a, filename, 16384); + if (r != ARCHIVE_OK) { + archive_read_finish(a); + skipping("Cannot uncompress %s", filename); continue; } - while (0 == archive_read_data_block(a, &blk, - &blk_size, &blk_offset)) + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + rawimage = malloc(buffsize); + size = archive_read_data(a, rawimage, buffsize); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, + archive_read_finish(a)); + assert(size > 0); + failure("Internal buffer is not big enough for " + "uncompressed test file: %s", filename); + if (!assert(size < buffsize)) + continue; + } else { + rawimage = slurpfile(&size, filename); + if (!assert(rawimage != NULL)) continue; - } - assert(0 == archive_read_close(a)); - assert(0 == archive_read_finish(a)); + image = malloc(size); + assert(image != NULL); + srand((unsigned)time(NULL)); for (i = 0; i < 100; ++i) { - int j, fd, numbytes; + FILE *f; + int j, numbytes; /* Fuzz < 1% of the bytes in the archive. */ memcpy(image, rawimage, size); @@ -133,11 +134,10 @@ DEFINE_TEST(test_fuzz) /* Save the messed-up image to a file. * If we crash, that file will be useful. */ - fd = open("after.test.failure.send.this.file." - "to.libarchive.maintainers.with.system.details", - O_WRONLY | O_CREAT | O_TRUNC, 0744); - write(fd, image, (off_t)size); - close(fd); + f = fopen("after.test.failure.send.this.file." + "to.libarchive.maintainers.with.system.details", "wb"); + fwrite(image, 1, (size_t)size, f); + fclose(f); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, diff --git a/lib/libarchive/test/test_fuzz_1.iso.Z.uu b/lib/libarchive/test/test_fuzz_1.iso.Z.uu new file mode 100644 index 000000000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4*`KS`%]-*!@A%@*N5*_]1`=5`M5`_51'51;50? +MU4AU4JU4+]5,=5/M5#_54'54+55/U51U56U57]58=5:M56_57'57[55_U6!U +M6"U6C]5D=5EM5I_5:'5:K5:OU6QU6^U6O]5P=5PM5\_5='5=;5??U7AU7JU7 +M[]5\=5_M5__5@'5@+5@/UH1U86U8']:(=6*M6"_6C'5C[5@_UI!U9"U93]:4 +M=65M65_6F'5FK5EOUIQU9^U9?]:@=6@M6H_6I'5I;5J?UJAU:JU:K]:L=6OM +M6K_6L'5L+5O/UK1U;6U;W]:X=6ZM6^_6O'5O[5O_UL!U<"U<#]?$=7%M7!_7 +MR'5RK5POU\QU<^U6U>G]?H=7JM7J_7['5[[5Z_U_!U?"U?S]?T=7UM7]_7^'5^K5_O +MU_QU?^U?_]<`=H`M8`_8!':!;6`?V`AV@JU@+]@,=H/M8#_8$':$+6%/V!1V +MA6UA7]@8=H:M86_8'':'[6%_V"!VB"UBC]@D=HEM8I_8*':*K6*OV"QVB^UB +4O]@P=HPM8\_8-':-;6/?V#BVW0$` +` +end diff --git a/lib/libarchive/test/test_open_fd.c b/lib/libarchive/test/test_open_fd.c index 0aec1d5e9fcf..7551dd01a168 100644 --- a/lib/libarchive/test/test_open_fd.c +++ b/lib/libarchive/test/test_open_fd.c @@ -25,6 +25,13 @@ #include "test.h" __FBSDID("$FreeBSD$"); +#if defined(_WIN32) && !defined(__CYGWIN__) +#define open _open +#if !defined(__BORLANDC__) +#define lseek _lseek +#endif +#define close _close +#endif DEFINE_TEST(test_open_fd) { @@ -33,7 +40,11 @@ DEFINE_TEST(test_open_fd) struct archive *a; int fd; - fd = open("test.tar", O_RDWR | O_CREAT, 0777); +#if defined(__BORLANDC__) + fd = open("test.tar", O_RDWR | O_CREAT | O_BINARY); +#else + fd = open("test.tar", O_RDWR | O_CREAT | O_BINARY, 0777); +#endif assert(fd >= 0); if (fd < 0) return; diff --git a/lib/libarchive/test/test_open_file.c b/lib/libarchive/test/test_open_file.c index e931163de21a..7e6c5719a260 100644 --- a/lib/libarchive/test/test_open_file.c +++ b/lib/libarchive/test/test_open_file.c @@ -32,7 +32,7 @@ DEFINE_TEST(test_open_file) struct archive *a; FILE *f; - f = fopen("test.tar", "w"); + f = fopen("test.tar", "wb"); assert(f != NULL); if (f == NULL) return; @@ -73,7 +73,7 @@ DEFINE_TEST(test_open_file) /* * Now, read the data back. */ - f = fopen("test.tar", "r"); + f = fopen("test.tar", "rb"); assert(f != NULL); if (f == NULL) return; diff --git a/lib/libarchive/test/test_pax_filename_encoding.c b/lib/libarchive/test/test_pax_filename_encoding.c index 45f984839caf..5affe9f3915f 100644 --- a/lib/libarchive/test/test_pax_filename_encoding.c +++ b/lib/libarchive/test/test_pax_filename_encoding.c @@ -107,9 +107,10 @@ test_pax_filename_encoding_2(void) * de_DE.UTF-8 seems to be commonly supported. */ /* If it doesn't exist, just warn and return. */ - if (NULL == setlocale(LC_ALL, LOCALE_DE)) { + if (LOCALE_UTF8 == NULL + || NULL == setlocale(LC_ALL, LOCALE_UTF8)) { skipping("invalid encoding tests require a suitable locale;" - " %s not available on this system", LOCALE_DE); + " %s not available on this system", LOCALE_UTF8); return; } @@ -151,11 +152,7 @@ test_pax_filename_encoding_2(void) archive_entry_free(entry); assertEqualInt(0, archive_write_close(a)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_write_finish(a); -#else assertEqualInt(0, archive_write_finish(a)); -#endif /* * Now read the entries back. @@ -181,11 +178,7 @@ test_pax_filename_encoding_2(void) assertEqualString(longname, archive_entry_pathname(entry)); assertEqualInt(0, archive_read_close(a)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_read_finish(a); -#else assertEqualInt(0, archive_read_finish(a)); -#endif } /* @@ -227,6 +220,15 @@ test_pax_filename_encoding_3(void) return; } + /* Skip test if archive_entry_update_pathname_utf8() is broken. */ + /* In particular, this is currently broken on Win32 because + * setlocale() does not set the default encoding for CP_ACP. */ + entry = archive_entry_new(); + if (archive_entry_update_pathname_utf8(entry, badname_utf8)) { + skipping("Cannot test conversion failures."); + return; + } + assert((a = archive_write_new()) != NULL); assertEqualIntA(a, 0, archive_write_set_format_pax(a)); assertEqualIntA(a, 0, archive_write_set_compression_none(a)); @@ -274,11 +276,7 @@ test_pax_filename_encoding_3(void) archive_entry_free(entry); assertEqualInt(0, archive_write_close(a)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_write_finish(a); -#else assertEqualInt(0, archive_write_finish(a)); -#endif /* * Now read the entries back. @@ -322,11 +320,7 @@ test_pax_filename_encoding_3(void) assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &entry)); assertEqualInt(0, archive_read_close(a)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_read_finish(a); -#else assertEqualInt(0, archive_read_finish(a)); -#endif } DEFINE_TEST(test_pax_filename_encoding) diff --git a/lib/libarchive/test/test_read_compress_program.c b/lib/libarchive/test/test_read_compress_program.c index 042c6159c486..12e6afc2cc12 100644 --- a/lib/libarchive/test/test_read_compress_program.c +++ b/lib/libarchive/test/test_read_compress_program.c @@ -37,7 +37,6 @@ DEFINE_TEST(test_read_compress_program) int r; struct archive_entry *ae; struct archive *a; - const char *extprog; /* * First, test handling when a non-existent compression @@ -53,26 +52,23 @@ DEFINE_TEST(test_read_compress_program) assertEqualIntA(a, ARCHIVE_OK, r); 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_FATAL, - archive_read_next_header(a, &ae)); - assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a)); + archive_read_open_memory(a, archive, sizeof(archive))); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); /* * If we have "gzip -d", try using that. */ - if ((extprog = external_gzip_program(1)) == NULL) { - skipping("There is no gzip uncompression " - "program in this platform"); + if (!canGunzip()) { + skipping("Can't run gunzip program on this platform"); return; } assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_none(a)); assertEqualIntA(a, ARCHIVE_OK, - archive_read_support_compression_program(a, extprog)); + archive_read_support_compression_program(a, "gunzip")); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, diff --git a/lib/libarchive/test/test_read_data_large.c b/lib/libarchive/test/test_read_data_large.c index 76b9e1283783..ecacf65e7e9e 100644 --- a/lib/libarchive/test/test_read_data_large.c +++ b/lib/libarchive/test/test_read_data_large.c @@ -33,6 +33,11 @@ __FBSDID("$FreeBSD$"); * had a bug relating to this, fixed in Nov 2006). */ +#if defined(_WIN32) && !defined(__CYGWIN__) +#define open _open +#define close _close +#endif + char buff1[11000000]; char buff2[10000000]; char buff3[10000000]; @@ -43,6 +48,7 @@ DEFINE_TEST(test_read_data_large) struct archive *a; char tmpfilename[] = "largefile"; int tmpfilefd; + FILE *f; unsigned int i; size_t used; @@ -96,7 +102,11 @@ DEFINE_TEST(test_read_data_large) assertA(0 == archive_read_support_compression_all(a)); assertA(0 == archive_read_open_memory(a, buff1, sizeof(buff1))); assertA(0 == archive_read_next_header(a, &ae)); - tmpfilefd = open(tmpfilename, O_WRONLY | O_CREAT, 0777); +#if defined(__BORLANDC__) + tmpfilefd = open(tmpfilename, O_WRONLY | O_CREAT | O_BINARY); +#else + tmpfilefd = open(tmpfilename, O_WRONLY | O_CREAT | O_BINARY, 0777); +#endif assert(tmpfilefd != 0); assertEqualIntA(a, 0, archive_read_data_into_fd(a, tmpfilefd)); assert(0 == archive_read_close(a)); @@ -107,11 +117,9 @@ DEFINE_TEST(test_read_data_large) #endif close(tmpfilefd); - tmpfilefd = open(tmpfilename, O_RDONLY); - assert(tmpfilefd != 0); - assertEqualIntA(NULL, sizeof(buff3), read(tmpfilefd, buff3, sizeof(buff3))); - close(tmpfilefd); + f = fopen(tmpfilename, "rb"); + assert(f != NULL); + assertEqualInt(sizeof(buff3), fread(buff3, 1, sizeof(buff3), f)); + fclose(f); assert(0 == memcmp(buff2, buff3, sizeof(buff3))); - - unlink(tmpfilename); } diff --git a/lib/libarchive/test/test_read_disk.c b/lib/libarchive/test/test_read_disk.c index cd87c5ba39cd..5666656d5389 100644 --- a/lib/libarchive/test/test_read_disk.c +++ b/lib/libarchive/test/test_read_disk.c @@ -111,8 +111,10 @@ DEFINE_TEST(test_read_disk) if (archive_read_disk_set_standard_lookup(a) != ARCHIVE_OK) { skipping("standard uname/gname lookup"); } else { -#if defined(__CYGWIN__) - skipping("standard uname/gname lookup; typically no user with uid=0 on cygwin platform"); +#if defined(__CYGWIN__) || defined(__HAIKU__) + /* Some platforms don't have predictable names for + * uid=0, so we skip this part of the test. */ + skipping("standard uname/gname lookup"); i = 0; p = zero_groups[0]; /* avoid unused warnings */ #else diff --git a/lib/libarchive/test/test_read_disk_entry_from_file.c b/lib/libarchive/test/test_read_disk_entry_from_file.c index 8b3b6d79c560..652b5e4a590b 100644 --- a/lib/libarchive/test/test_read_disk_entry_from_file.c +++ b/lib/libarchive/test/test_read_disk_entry_from_file.c @@ -45,7 +45,7 @@ DEFINE_TEST(test_read_disk_entry_from_file) { struct archive *a; struct archive_entry *entry; - int fd; + FILE *f; assert((a = archive_read_disk_new()) != NULL); @@ -57,10 +57,10 @@ DEFINE_TEST(test_read_disk_entry_from_file) assertEqualString(archive_read_disk_gname(a, 0), "FOOGROUP"); /* Create a file on disk. */ - fd = open("foo", O_WRONLY | O_CREAT, 0777); - assert(fd >= 0); - assertEqualInt(4, write(fd, "1234", 4)); - close(fd); + f = fopen("foo", "wb"); + assert(f != NULL); + assertEqualInt(4, fwrite("1234", 1, 4, f)); + fclose(f); /* Use archive_read_disk_entry_from_file to get information about it. */ entry = archive_entry_new(); diff --git a/lib/libarchive/test/test_read_extract.c b/lib/libarchive/test/test_read_extract.c index 887ddfde6852..10bd014ac1ed 100644 --- a/lib/libarchive/test/test_read_extract.c +++ b/lib/libarchive/test/test_read_extract.c @@ -32,22 +32,15 @@ DEFINE_TEST(test_read_extract) { struct archive_entry *ae; struct archive *a; -#if !defined(_WIN32) || defined(__CYGWIN__) - struct stat st; -#endif size_t used; - int i; + int i, numEntries = 0; char *buff, *file_buff; -#if !defined(_WIN32) || defined(__CYGWIN__) - int fd; - ssize_t bytes_read; -#endif buff = malloc(BUFF_SIZE); file_buff = malloc(FILE_BUFF_SIZE); /* Force the umask to something predictable. */ - umask(022); + assertUmask(022); /* Create a new archive in memory containing various types of entries. */ assert((a = archive_write_new()) != NULL); @@ -55,12 +48,14 @@ DEFINE_TEST(test_read_extract) assertA(0 == archive_write_set_compression_none(a)); assertA(0 == archive_write_open_memory(a, buff, BUFF_SIZE, &used)); /* A directory to be restored with EXTRACT_PERM. */ + ++numEntries; assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir_0775"); archive_entry_set_mode(ae, S_IFDIR | 0775); assertA(0 == archive_write_header(a, ae)); archive_entry_free(ae); /* A regular file. */ + ++numEntries; assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "file"); archive_entry_set_mode(ae, S_IFREG | 0755); @@ -71,49 +66,53 @@ DEFINE_TEST(test_read_extract) assertA(FILE_BUFF_SIZE == archive_write_data(a, file_buff, FILE_BUFF_SIZE)); archive_entry_free(ae); /* A directory that should obey umask when restored. */ + ++numEntries; assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir"); archive_entry_set_mode(ae, S_IFDIR | 0777); assertA(0 == archive_write_header(a, ae)); archive_entry_free(ae); /* A file in the directory. */ + ++numEntries; assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir/file"); archive_entry_set_mode(ae, S_IFREG | 0700); assertA(0 == archive_write_header(a, ae)); archive_entry_free(ae); /* A file in a dir that is not already in the archive. */ + ++numEntries; assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir2/file"); archive_entry_set_mode(ae, S_IFREG | 0000); assertA(0 == archive_write_header(a, ae)); archive_entry_free(ae); /* A dir with a trailing /. */ + ++numEntries; assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir3/."); archive_entry_set_mode(ae, S_IFDIR | 0710); assertA(0 == archive_write_header(a, ae)); archive_entry_free(ae); /* Multiple dirs with a single entry. */ + ++numEntries; assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir4/a/../b/../c/"); archive_entry_set_mode(ae, S_IFDIR | 0711); assertA(0 == archive_write_header(a, ae)); archive_entry_free(ae); /* A symlink. */ - assert((ae = archive_entry_new()) != NULL); - archive_entry_copy_pathname(ae, "symlink"); - archive_entry_set_mode(ae, S_IFLNK | 0755); - archive_entry_set_symlink(ae, "file"); - assertA(0 == archive_write_header(a, ae)); - archive_entry_free(ae); + if (canSymlink()) { + ++numEntries; + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "symlink"); + archive_entry_set_mode(ae, AE_IFLNK | 0755); + archive_entry_set_symlink(ae, "file"); + assertA(0 == archive_write_header(a, ae)); + archive_entry_free(ae); + } /* Close out the archive. */ assertA(0 == archive_write_close(a)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_write_finish(a); -#else assertA(0 == archive_write_finish(a)); -#endif /* Extract the entries to disk. */ assert((a = archive_read_new()) != NULL); @@ -125,75 +124,44 @@ DEFINE_TEST(test_read_extract) 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. */ - for (i = 0; i < 7; i++) { - failure("Error reading entry %d", i+1); + for (i = 1; i < numEntries; i++) { + failure("Error reading entry %d", i); assertA(0 == archive_read_next_header(a, &ae)); + failure("Failed to extract entry %d: %s", i, + archive_entry_pathname(ae)); assertA(0 == archive_read_extract(a, ae, 0)); } assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae)); assert(0 == archive_read_close(a)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_read_finish(a); -#else assert(0 == archive_read_finish(a)); -#endif -#if !defined(_WIN32) || defined(__CYGWIN__) /* Test the entries on disk. */ /* This first entry was extracted with ARCHIVE_EXTRACT_PERM, * so the permissions should have been restored exactly, * including resetting the gid bit on those platforms * where gid is inherited by subdirs. */ - assert(0 == stat("dir_0775", &st)); failure("This was 0775 in archive, and should be 0775 on disk"); - assertEqualInt(st.st_mode, S_IFDIR | 0775); + assertIsDir("dir_0775", 0775); /* Everything else was extracted without ARCHIVE_EXTRACT_PERM, * so there may be some sloppiness about gid bits on directories. */ - assert(0 == stat("file", &st)); - failure("st.st_mode=%o should be %o", st.st_mode, S_IFREG | 0755); - assertEqualInt(st.st_mode, S_IFREG | 0755); - failure("The file extracted to disk is the wrong size."); - assert(st.st_size == FILE_BUFF_SIZE); - fd = open("file", O_RDONLY); - failure("The file on disk could not be opened."); - assert(fd != 0); - bytes_read = read(fd, buff, FILE_BUFF_SIZE); - close(fd); - failure("The file contents read from disk are the wrong size"); - assert(bytes_read == FILE_BUFF_SIZE); - failure("The file contents on disk do not match the file contents that were put into the archive."); - assert(memcmp(buff, file_buff, FILE_BUFF_SIZE) == 0); - assert(0 == stat("dir", &st)); - failure("This was 0777 in archive, but umask should make it 0755"); + assertIsReg("file", 0755); + assertFileSize("file", FILE_BUFF_SIZE); + assertFileContents(file_buff, FILE_BUFF_SIZE, "file"); /* If EXTRACT_PERM wasn't used, be careful to ignore sgid bit * when checking dir modes, as some systems inherit sgid bit * from the parent dir. */ - assertEqualInt(0755, st.st_mode & 0777); - assert(0 == stat("dir/file", &st)); - assert(st.st_mode == (S_IFREG | 0700)); - assert(0 == stat("dir2", &st)); - assertEqualInt(0755, st.st_mode & 0777); - assert(0 == stat("dir2/file", &st)); - assert(st.st_mode == (S_IFREG | 0000)); - assert(0 == stat("dir3", &st)); - assertEqualInt(0710, st.st_mode & 0777); - assert(0 == stat("dir4", &st)); - assertEqualInt(0755, st.st_mode & 0777); - assert(0 == stat("dir4/a", &st)); - assertEqualInt(0755, st.st_mode & 0777); - assert(0 == stat("dir4/b", &st)); - assertEqualInt(0755, st.st_mode & 0777); - assert(0 == stat("dir4/c", &st)); - assertEqualInt(0711, st.st_mode & 0777); - assert(0 == lstat("symlink", &st)); - assert(S_ISLNK(st.st_mode)); -#if HAVE_LCHMOD - /* Systems that lack lchmod() can't set symlink perms, so skip this. */ - assert((st.st_mode & 07777) == 0755); -#endif - assert(0 == stat("symlink", &st)); - assert(st.st_mode == (S_IFREG | 0755)); -#endif + failure("This was 0777 in archive, but umask should make it 0755"); + assertIsDir("dir", 0755); + assertIsReg("dir/file", 0700); + assertIsDir("dir2", 0755); + assertIsReg("dir2/file", 0000); + assertIsDir("dir3", 0710); + assertIsDir("dir4", 0755); + assertIsDir("dir4/a", 0755); + assertIsDir("dir4/b", 0755); + assertIsDir("dir4/c", 0711); + if (canSymlink()) + assertIsSymlink("symlink", "file"); free(buff); free(file_buff); diff --git a/lib/libarchive/test/test_read_format_ar.ar.uu b/lib/libarchive/test/test_read_format_ar.ar.uu new file mode 100644 index 000000000000..70507cc1da9d --- /dev/null +++ b/lib/libarchive/test/test_read_format_ar.ar.uu @@ -0,0 +1,12 @@ +$FreeBSD$ + +begin 755 test_read_format_ar.ar +M(3QA7ET='1S= 1009000 -/* - * This "archive" is created by "GNU ar". Here we try to verify - * our GNU format handling functionality. - */ -static unsigned char archive[] = { -'!','<','a','r','c','h','>',10,'/','/',' ',' ',' ',' ',' ',' ',' ', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', -' ',' ',' ',' ',' ','4','0',' ',' ',' ',' ',' ',' ',' ',' ','`',10, -'y','y','y','t','t','t','s','s','s','a','a','a','f','f','f','.','o', -'/',10,'h','h','h','h','j','j','j','j','k','k','k','k','l','l','l', -'l','.','o','/',10,10,'/','0',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', -' ',' ',' ',' ','1','1','7','5','4','6','5','6','5','2',' ',' ','1', -'0','0','1',' ',' ','0',' ',' ',' ',' ',' ','1','0','0','6','4','4', -' ',' ','8',' ',' ',' ',' ',' ',' ',' ',' ',' ','`',10,'5','5','6', -'6','7','7','8','8','g','g','h','h','.','o','/',' ',' ',' ',' ',' ', -' ',' ',' ',' ','1','1','7','5','4','6','5','6','6','8',' ',' ','1', -'0','0','1',' ',' ','0',' ',' ',' ',' ',' ','1','0','0','6','4','4', -' ',' ','4',' ',' ',' ',' ',' ',' ',' ',' ',' ','`',10,'3','3','3', -'3','/','1','9',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', -'1','1','7','5','4','6','5','7','1','3',' ',' ','1','0','0','1',' ', -' ','0',' ',' ',' ',' ',' ','1','0','0','6','4','4',' ',' ','9',' ', -' ',' ',' ',' ',' ',' ',' ',' ','`',10,'9','8','7','6','5','4','3', -'2','1',10}; - -char buff[64]; -#endif DEFINE_TEST(test_read_format_ar) { -#if ARCHIVE_VERSION_NUMBER < 1009000 - skipping("test_read_support_format_ar()"); -#else + char buff[64]; + const char reffile[] = "test_read_format_ar.ar"; struct archive_entry *ae; struct archive *a; + + extract_reference_file(reffile); 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_open_file(a, reffile, 7)); /* Filename table. */ assertA(0 == archive_read_next_header(a, &ae)); @@ -110,10 +83,5 @@ DEFINE_TEST(test_read_format_ar) /* Test EOF */ assertA(1 == archive_read_next_header(a, &ae)); assert(0 == archive_read_close(a)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_read_finish(a); -#else assert(0 == archive_read_finish(a)); -#endif -#endif } diff --git a/lib/libarchive/test/test_read_format_cpio_bin_bz2.c b/lib/libarchive/test/test_read_format_cpio_bin_bz2.c index 90270c8f53bd..f7c4efb0a08d 100644 --- a/lib/libarchive/test/test_read_format_cpio_bin_bz2.c +++ b/lib/libarchive/test/test_read_format_cpio_bin_bz2.c @@ -36,10 +36,15 @@ DEFINE_TEST(test_read_format_cpio_bin_bz2) { struct archive_entry *ae; struct archive *a; + int r; assert((a = archive_read_new()) != NULL); - assertEqualIntA(a, ARCHIVE_OK, - archive_read_support_compression_all(a)); + r = archive_read_support_compression_bzip2(a); + if (r != ARCHIVE_OK) { + skipping("bzip2 support unavailable"); + archive_read_close(a); + return; + } assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); diff --git a/lib/libarchive/test/test_read_format_cpio_bin_lzma.c b/lib/libarchive/test/test_read_format_cpio_bin_lzma.c new file mode 100644 index 000000000000..26c044043839 --- /dev/null +++ b/lib/libarchive/test/test_read_format_cpio_bin_lzma.c @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2009 Michihiro NAKAJIMA + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +static unsigned char archive[] = { + 93, 0, 0,128, 0,255,255,255,255,255,255,255,255, 0, 99,156, + 62,160, 67,124,230, 93,220,235,118, 29, 75, 27,226,158, 67,149, +151, 96, 22, 54,198,209, 63,104,209,148,249,238, 71,187,201,243, +162, 1, 42, 47, 43,178, 35, 90, 6,156,208, 74,107, 91,229,126, + 5, 85,255,136,255, 64, 0 +}; + +DEFINE_TEST(test_read_format_cpio_bin_lzma) +{ + struct archive_entry *ae; + struct archive *a; + int r; + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); + r = archive_read_support_compression_lzma(a); + if (r == ARCHIVE_WARN) { + skipping("lzma reading not fully supported on this platform"); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + return; + } + 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)); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_LZMA); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); +} + diff --git a/lib/libarchive/test/test_read_format_iso.iso.Z.uu b/lib/libarchive/test/test_read_format_iso.iso.Z.uu new file mode 100644 index 000000000000..2f5cbd792041 --- /dev/null +++ b/lib/libarchive/test/test_read_format_iso.iso.Z.uu @@ -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(BGK_[Z[+?O_OOPQR___/37;__]^.>O__[\]^___P`,H``'2,`"&O"`]`,` +` +end diff --git a/lib/libarchive/test/test_read_format_iso_gz.c b/lib/libarchive/test/test_read_format_iso_gz.c index 73c841588c54..22893790c307 100644 --- a/lib/libarchive/test/test_read_format_iso_gz.c +++ b/lib/libarchive/test/test_read_format_iso_gz.c @@ -29,20 +29,13 @@ DEFINE_TEST(test_read_format_iso_gz) { struct archive_entry *ae; struct archive *a; - int r; - const char *name = "test_read_format_iso_gz.iso.gz"; + const char *name = "test_read_format_iso.iso.Z"; extract_reference_file(name); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); - r = archive_read_support_compression_gzip(a); - if (r == ARCHIVE_WARN) { - skipping("gzip reading not fully supported on this platform"); - assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); - return; - } assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, @@ -50,7 +43,7 @@ DEFINE_TEST(test_read_format_iso_gz) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualInt(archive_compression(a), - ARCHIVE_COMPRESSION_GZIP); + ARCHIVE_COMPRESSION_COMPRESS); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); diff --git a/lib/libarchive/test/test_read_format_iso_joliet.iso.Z.uu b/lib/libarchive/test/test_read_format_iso_joliet.iso.Z.uu new file mode 100644 index 000000000000..b6ac2520083d --- /dev/null +++ b/lib/libarchive/test/test_read_format_iso_joliet.iso.Z.uu @@ -0,0 +1,66 @@ +$FreeBSD$ + +begin 644 test_read_format_iso_joliet.iso.Z +M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$FR +MI,F3*%.J7,FRIO8,.*'4NVK-FS:-.J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I7S_K6N_[UL(^][&=/^]K;_O:XS[WN=\_[WOO^ +M]\`/OO"'3_SB&__XR$^^\I?/_.8[__G0C[[TIT_]ZEO_^MC/OO:WS_WN>__[ +MX`^_^,=/_O*;__SH3[_ZU\_^]KO__?"/O_SG3__ZV__^^,^__O?/__[[__\` +M&(`".(`$6(`&>(`(F(`*N(`,V(`.^(`0&($2.($46($6>($8F($:N($ +M^($@&((B.((D6((F>((HF((JN((LV((N^((P&(,R.(,T6(,V>(,XF(,ZN(,\ +MV(,^^(-`&(1".(1$6(1&>(1(F(1*N(1,V(1.^(10&(52.(546(56>(58F(5: +MN(5^(5@&(9B.(9D6(9F>(9HF(9JN(9LV(9N^(9P&(=R.(=T6(=V>(=X +MF(=ZN(=\V(=^^(>`&(B".(B$6(B&>(B(F(B*N(B,V(B.^(B0&(F2.(F46(F6 +M>(F8F(F:N(F^(F@&(JB.(JD6(JF>(JHF(JJN(JLV(JN^(JP&(NR.(NT +M6(NV>(NXF(NZN(N\V(N^^(O`&(S".(S$6(S&>(S(F(S*N(S,V(S.^(S0&(W2 +M.(W46(W6>(W8F(W:N(W^(W@&([B.([D6([F>([HF([JN([LV([N^([P +(&(_R.(_T:!4` +` +end diff --git a/lib/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu b/lib/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu new file mode 100644 index 000000000000..9babf696e12c --- /dev/null +++ b/lib/libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu @@ -0,0 +1,71 @@ +$FreeBSD$ + +begin 644 test_read_format_iso_joliet_long.iso.Z +M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$FR +MI,F3*%.J7,FRIO8,.*'4NVK-FS:-.J7//JW/'D"-+GDRYLN7+F#-KWLRY +ML^?/H$.+'DVZM.G3J%.K7LVZM>O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\ +MN/'CR),K7\Z\N?/GT*-+GTZ]N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R.9=T69=V>9=XF9=ZN9=\V9=^^9>`&9B".9B$69B& +4>9B(F9B*N9B,V9B.^9B0&9F2J90` +` +end diff --git a/lib/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu b/lib/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu new file mode 100644 index 000000000000..fdccb0cf7143 --- /dev/null +++ b/lib/libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu @@ -0,0 +1,68 @@ +$FreeBSD$ + +begin 644 test_read_format_iso_joliet_rockridge.iso.Z +M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$FR +MI,F3*%.J7,FRIO8,.*'4NVK-FS:-.J7//JW/'D"-+GDRYLN7+F#-KWLRY +ML^?/H$.+'DVZM.G3J%.K7LVZM>O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\ +MN/'CR),K7\Z\N?/GT*-+GTZ]NO7KV+-KW\Z]N_?OX,.+'T^^O/GSZ-.K7\^^ +MO?OW\./+GT^_OOW[^//KW\^_O_^_`0Q!!`PPQ!```$;(44890DQ!!`@01BCA +MA!1***`43S11X88<1G@0+@6!Z-&!``1`XH$((`"`!0590$%"+`HD`@`<%%2C +MB@*I:$0``B10(@D"!'3B@1T6:>212":IY)),-NGDDU!&*>645%9I991-+)'$ +M%$\8,04(6SX!0@XVV`##"TAX"8(123!1Q!193$%%$1H*446;1!0A!0@F@'!A +M$4,\(<6#`K8@Q0M$6$&H%$4$086@(*`P1`H@Q)!##C.`4(0+63Q1A1-'$!&$ +MFY%.6NFE-X"@A`M0-"H%ETZ\L.H40R#1)A-)@'KEKKSN*@.!.<1`(`XQU""# +M##340"`)O\(0[+#%'IOLL@16:^VU!`+0[+,P$&LLLLK"0`*1O99K[KGHIJON +MNNRVZ^Z[\"[YW[R+"2`@@08&9`0`<@!0AK\`"`'`%``0`0`(!R>,\,(*)SQ$ +MP0!(`<`3`#31,,,87YRP02(.A$L)+Q3!T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$6>9$8F9$:N9$^9$@&9(B.9(D69(F>9(HF9(JN9(L +.V9(N^9(P&9,R.9,T^8(` +` +end diff --git a/lib/libarchive/test/test_read_format_iso_multi_extent.c b/lib/libarchive/test/test_read_format_iso_multi_extent.c new file mode 100644 index 000000000000..9697a4b5de6e --- /dev/null +++ b/lib/libarchive/test/test_read_format_iso_multi_extent.c @@ -0,0 +1,94 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2009 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_iso_multi_extent) +{ + const char *refname = "test_read_format_iso_multi_extent.iso.Z"; + struct archive_entry *ae; + struct archive *a; + const void *p; + size_t size; + off_t offset; + int i; + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualInt(0, archive_read_support_compression_all(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + assertEqualInt(ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Retrieve each of the 2 files on the ISO image and + * verify that each one is what we expect. */ + for (i = 0; i < 2; ++i) { + assertEqualInt(0, archive_read_next_header(a, &ae)); + + if (strcmp(".", archive_entry_pathname(ae)) == 0) { + /* '.' root directory. */ + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt((int)size, 0); + } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { + /* A regular file. */ + assertEqualString("file", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(262280, archive_entry_size(ae)); + assertEqualInt(0, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(0, offset); + assertEqualMem(p, "head--head--head", 16); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else { + failure("Saw a file that shouldn't have been there"); + assertEqualString(archive_entry_pathname(ae), ""); + } + } + + /* End of archive. */ + assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); + + /* Close the archive. */ + assertEqualInt(0, archive_read_close(a)); + assertEqualInt(0, archive_read_finish(a)); +} + + diff --git a/lib/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu b/lib/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu new file mode 100644 index 000000000000..3ce33dc2001e --- /dev/null +++ b/lib/libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu @@ -0,0 +1,67 @@ +$FreeBSD$ + +begin 644 test_read_format_iso_multi_extent.iso.Z +M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$FR +MI,F3*%.J7,FRIO8,.*'4NVK-FS:-.J7//JW/'D"-+GDRYLN7+F#-KWLRY +ML^?/H$.+'DVZM.G3J%.K7LVZM>O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\ +MN/'CR),K7\Z\N?/GT*-+GTZ]NO7KV+-KW\Z]N_?OX,.+'T^^O/GSZ-.K7\^^ +MO?OW\./+GT^_OOW[^//KW\^_O_^_`0Q!!`PPQ!```$;(44890DQ!!`@01BCA +MA!1***`43S11X88<1GB0#0<*%(`-'X48@(D`((````H4I``%"5DPD`@`<%"0 +MC2L*M*(1`0B0```!D"!`0"8>V.&12":IY)),-NGDDU!&*>645%9IY9583LE$ +M$D($(<402"1A11$@)#'%$R#D8(,-,(!@1!),%#%%%E-0482&5TB1A)U29.GG +MGX`&*FB2,A"80PP%WD!@#&PJ"@,)A<)P:**+-DH@"01FJNFF!`(0Z:0Q.,HH +M#(Z28.2@J*:JZJJLMNKJJ[#&*FN5_]6ZF``"+AJB$0#(`4`9OP(@!`!3`$`$ +M`"`@JVRRS"ZK[!#&`B`%`$\`T(2SS6:+K;(&@3C0B"6\4`1'11*9XHHM$J0` +M!@EI,",`'104;XX![=CCCT$."221(6KK[[;_!@SPP`(73/#!!B>,\,(*-\SP +MPPY'#/'$$E=,\<466\P$`$D("T`0T@(`+1(<`V`%`.,FVW&QU2:;`P`D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(B".(B$6(B&>(B(F(B*N(B,V(B.^(B0&(F2.(F46(F6 +M>(F8F(F:N(F^(F@&(JB.(JD6(JF>(JHF(JJN(JLV(JN^(JP&(NR.(NT +M6(NV>(NXF(NZN(N\V(N^^(O`&(S".(S$6(S&>(S(F(S*N(S,V(S.^(S0&(W2 +M.(W46(W6>(W8F(W:N(W^(W@&([B.([D6([F>([HF([JN([LV([N^([P +M&(_R.(_T6(_V>(_XF(_ZN(_\V(_^^(\`&9`".9`$69`&>9`(F9`*N9`,V9`. +0^9`0&9$2.9$469$6>9%O"``` +` +end diff --git a/lib/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu b/lib/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu new file mode 100644 index 000000000000..218631ca2c30 --- /dev/null +++ b/lib/libarchive/test/test_read_format_iso_rockridge.iso.Z.uu @@ -0,0 +1,206 @@ +$FreeBSD$ + +begin 644 test_read_format_iso_rockridge.iso.Z +M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$FR +MI,F3*%.J7,FRIO8,.*'4NVK-FS:-.J7//JW/'D"-+GDRYLN7+F#-KWLRY +ML^?/H$.+'DVZM.G3J%.K7LVZM>O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\ +MN/'CR),K7\Z\N?/GT*-+GTZ]NO7KV+-KW\Z]N_?OX,.+'T^^O/GSZ-.K7\^^ +MO?OW\./+GT^_OOW[^//KW\^_O_^_`0Q!!`PPQ!```$;(44890DQ!!`@01BCA +MA!1***`43S11X88<1GA0#Q@,A$$/'QT(0``F'H@``@!84)`%$R14P4`B`'!! +M03>R*!"+1@0@0`(GDB!`0"D>V.&12":IY)),-NGDDU!&*>645%9IY9583MG$ +M$DE,\8014X#0Y1,@Y&"##3"\@`28(!B1!!-%3)'%%%04H:$05;Q)1!%2@&`" +M"!<6,<034CPH8`M2O$"$%89*44005!`*`@I#I`!"##GD,`,(1;B0Q1-5.'$$ +M$4'`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/OO:WS_WN>__[ +MX`^_^,=/_O*;__SH3[_ZU\_^]KO__?"/O_SG3__ZV__^^,^__O?/__[[__\` +M&(`".(`$6(`&>(`(F(`*N(`,V(`.^(`0&($2.($46($6>($8F($:N($ +M^($@&((B.((D6((F>((HF((JN((LV((N^((P&(,R.(,T6(,V>(,XF(,ZN(,\ +MV(,^^(-`&(1".(1$6(1&>(1(F(1*N(1,V(1.^(10&(52.(546(56>(58F(5: +MN(5^(5@&(9B.(9D6(9F>(9HF(9JN(9LV(9N^(9P&(=R.(=T6(=V>(=X +MF(=ZN(=\V(=^^(>`&(B".(B$6(B&>(B(F(B*N(B,V(B.^(B0&(F2.(F46(F6 +(>(F8F(F:^!,` +` +end diff --git a/lib/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu b/lib/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu new file mode 100644 index 000000000000..dd013ffc84d8 --- /dev/null +++ b/lib/libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu @@ -0,0 +1,208 @@ +$FreeBSD$ + +begin 644 test_read_format_iso_rockridge_new.iso.Z +M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$FR +MI,F3*%.J7,FRIO8,.*'4NVK-FS:-.J7//JW/'D"-+GDRYLN7+F#-KWLRY +ML^?/H$.+'DVZM.G3J%.K7LVZM>O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\ +MN/'CR),K7\Z\N?/GT*-+GTZ]NO7KV+-KW\Z]N_?OX,.+'T^^O/GSZ-.K7\^^ +MO?OW\./+GT^_OOW[^//KW\^_O_^_`0Q!!`PPQ!```$;(44890DQ!!`@01BCA +MA!1***`43S11X88<1GA0#Q@,A$$/'QT(0``F'H@``@!84)`%$R14P4`B`'!! +M03>R*!"+1@0@0`(GDB!`0"D>V.&12":IY)),-NGDDU!&*>645%9IY9583MG$ +M$DE,\8014X#0Y1,@Y&"##3"\@`28(!B1!!-%3)'%%%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B7QBG^@G +M_HF`8J`H*`Z*A&*A:"@>BHABHJ@H+HJ,8J/H*#Z*D&*D*"E.BI1BI6@I7HJ8 +M8J:H*6Z*G&*GZ"E^BJ!BJ"@JCHJD8JEH*IZ*J&*JJ"JNBJQBJ^@JOHJP8JPH +M*\Z*M&*M:"O>BKABKJ@K[HJ\8J_H*_Z*P&*P*"P.B\1BL6@L'HO(8K*H+"Z+ +MS&*SZ"P^B]!BM"@M3HO48K5H+5Z+V&*VJ"UNB]QBM^@M?HO@8K@H+HZ+Y&*Y +M:"Z>B^ABNJ@NKHOL8KOH+KZ+\&*\*"_.B_1BO6@OWHOX8KZH+^Z+_&*_Z"_^ +'BP!CP+@7`0`` +` +end diff --git a/lib/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu b/lib/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu new file mode 100644 index 000000000000..00896e1f67e7 --- /dev/null +++ b/lib/libarchive/test/test_read_format_iso_zisofs.iso.Z.uu @@ -0,0 +1,63 @@ +$FreeBSD$ + +begin 644 test_read_format_iso_zisofs.iso.Z +M'YV0``(*'$BPH,&#"!,J7,BPH<.'$"-*G$BQHL6+&#-JW,BQH\>/($.*'$FR +MI,F3*%.J7,FRIO8,.*'4NVK-FS:-.J7//JW/'D"-+GDRYLN7+F#-KWLRY +ML^?/H$.+'DVZM.G3J%.K7LVZM>O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\ +MN/'CR),K7\Z\N?/GT*-+GTZ]NO7KV+-KW\Z]N_?OX,.+'T^^O/GSZ-.K7\^^ +MO?OW\./+GT^_OOW[^//KW\^_O_^_`0Q!!`PPQ!```$;(44890DQ!!`@01BCA +MA!1***`43S11X88<1GA0+`6!Z-&!``1`XH$((`"`!059,$%"%0PD`@`7%%2C +MB@*I:$0``B10(@D"!'3B@1T6:>212":IY)),-NGDDU!&*>645%9I991-+)'$ +M%$\8,04(6SX!0@XVV`##"TAX"8(123!1Q!193$%%$1H*446;1!0A!0@F@'!A +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,V(B.^(B0&(F2.(F46(F6 +@>(F8F(F:N(F^(F@&(JB.(JD6(JF>(JHF(JJN'`` +` +end diff --git a/lib/libarchive/test/test_read_format_isojoliet_bz2.c b/lib/libarchive/test/test_read_format_isojoliet_bz2.c index 9ee87c91cba6..b2f22a7a597f 100644 --- a/lib/libarchive/test/test_read_format_isojoliet_bz2.c +++ b/lib/libarchive/test/test_read_format_isojoliet_bz2.c @@ -46,49 +46,39 @@ else TZ=utc touch -afhm -t 197001020000.01 /tmp/iso /tmp/iso/long-joliet-file-name.textfile /tmp/iso/dir TZ=utc touch -afhm -t 197001030000.02 /tmp/iso/symlink fi -mkhybrid -J -uid 1 -gid 2 /tmp/iso | bzip2 > test_read_format_isojoliet_bz2.iso.bz2 -F=test_read_format_isojoliet_bz2.iso.bz2 +F=test_read_format_iso_joliet.iso.Z +mkhybrid -J -uid 1 -gid 2 /tmp/iso | compress > $F uuencode $F $F > $F.uu exit 1 */ -static void -joliettest(int withrr) +DEFINE_TEST(test_read_format_isojoliet_bz2) { - const char *refname = "test_read_format_isojoliet_bz2.iso.bz2"; + const char *refname = "test_read_format_iso_joliet.iso.Z"; struct archive_entry *ae; struct archive *a; const void *p; size_t size; off_t offset; - int r; - - if (withrr) { - refname = "test_read_format_isojolietrr_bz2.iso.bz2"; - } extract_reference_file(refname); assert((a = archive_read_new()) != NULL); - r = archive_read_support_compression_bzip2(a); - if (r == ARCHIVE_WARN) { - skipping("bzip2 reading not fully supported on this platform"); - assertEqualInt(0, archive_read_finish(a)); - return; - } - assertEqualInt(0, r); + assertEqualInt(0, archive_read_support_compression_all(a)); assertEqualInt(0, archive_read_support_format_all(a)); + assertEqualInt(ARCHIVE_OK, + archive_read_set_options(a, "iso9660:!rockridge")); assertEqualInt(ARCHIVE_OK, archive_read_open_filename(a, refname, 10240)); /* First entry is '.' root directory. */ assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString(".", archive_entry_pathname(ae)); - assert(S_ISDIR(archive_entry_stat(ae)->st_mode)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); assertEqualInt(2048, archive_entry_size(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(0, archive_entry_mtime_nsec(ae)); assertEqualInt(86401, archive_entry_ctime(ae)); - assertEqualInt(0, archive_entry_stat(ae)->st_nlink); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); assertEqualInt(0, archive_entry_uid(ae)); assertEqualIntA(a, ARCHIVE_EOF, archive_read_data_block(a, &p, &size, &offset)); @@ -97,100 +87,48 @@ joliettest(int withrr) /* A directory. */ assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("dir", archive_entry_pathname(ae)); - assert(S_ISDIR(archive_entry_stat(ae)->st_mode)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); assertEqualInt(2048, archive_entry_size(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); - if (withrr) { - assertEqualInt(2, archive_entry_stat(ae)->st_nlink); - assertEqualInt(1, archive_entry_uid(ae)); - assertEqualInt(2, archive_entry_gid(ae)); - } /* A regular file with two names ("hardlink" gets returned * first, so it's not marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("hardlink", archive_entry_pathname(ae)); - assert(S_ISREG(archive_entry_stat(ae)->st_mode)); + assertEqualString("long-joliet-file-name.textfile", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assert(archive_entry_hardlink(ae) == NULL); assertEqualInt(6, archive_entry_size(ae)); assertEqualInt(0, archive_read_data_block(a, &p, &size, &offset)); assertEqualInt(6, (int)size); assertEqualInt(0, offset); assertEqualInt(0, memcmp(p, "hello\n", 6)); - if (withrr) { - assertEqualInt(86401, archive_entry_mtime(ae)); - assertEqualInt(86401, archive_entry_atime(ae)); - /* TODO: Actually, libarchive should be able to - * compute nlinks correctly even without RR - * extensions. See comments in libarchive source. */ - assertEqualInt(2, archive_entry_nlink(ae)); - assertEqualInt(1, archive_entry_uid(ae)); - assertEqualInt(2, archive_entry_gid(ae)); - } /* Second name for the same regular file (this happens to be * returned second, so does get marked as a hardlink). */ assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assertEqualString("long-joliet-file-name.textfile", - archive_entry_pathname(ae)); - assert(S_ISREG(archive_entry_stat(ae)->st_mode)); - assertEqualString("hardlink", archive_entry_hardlink(ae)); + archive_entry_hardlink(ae)); assert(!archive_entry_size_is_set(ae)); - if (withrr) { - assertEqualInt(86401, archive_entry_mtime(ae)); - assertEqualInt(86401, archive_entry_atime(ae)); - /* TODO: See above. */ - assertEqualInt(2, archive_entry_nlink(ae)); - assertEqualInt(1, archive_entry_uid(ae)); - assertEqualInt(2, archive_entry_gid(ae)); - } /* A symlink to the regular file. */ assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("symlink", archive_entry_pathname(ae)); - if (withrr) { - assert(S_ISLNK(archive_entry_stat(ae)->st_mode)); - assertEqualString("long-joliet-file-name.textfile", - archive_entry_symlink(ae)); - } assertEqualInt(0, archive_entry_size(ae)); assertEqualInt(172802, archive_entry_mtime(ae)); assertEqualInt(172802, archive_entry_atime(ae)); - if (withrr) { - assertEqualInt(1, archive_entry_nlink(ae)); - assertEqualInt(1, archive_entry_uid(ae)); - assertEqualInt(2, archive_entry_gid(ae)); - } /* End of archive. */ assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); /* Verify archive format. */ - assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2); - if (withrr) { - assertEqualInt(archive_format(a), - ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); - } + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); /* Close the archive. */ assertEqualInt(0, archive_read_close(a)); assertEqualInt(0, archive_read_finish(a)); } - -DEFINE_TEST(test_read_format_isojoliet_bz2) -{ - joliettest(0); - - /* XXXX This doesn't work today; can it be made to work? */ -#if 0 - joliettest(1); -#else - skipping("Mixed Joliet/RR not fully supported yet."); -#endif -} - - - - diff --git a/lib/libarchive/test/test_read_format_isojoliet_long.c b/lib/libarchive/test/test_read_format_isojoliet_long.c new file mode 100644 index 000000000000..acd220f4b6e6 --- /dev/null +++ b/lib/libarchive/test/test_read_format_isojoliet_long.c @@ -0,0 +1,141 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2009 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* +Execute the following to rebuild the data for this program: + tail -n +35 test_read_format_isojoliet_long.c | /bin/sh + +rm -rf /tmp/iso +mkdir /tmp/iso +num=0 +file=""; +while [ $num -lt 100 ] +do + num=$((num+10)) + file="${file}1234567890" +done +dir="${file}dir" +mkdir /tmp/iso/${dir} +file="${file}123" +echo "hello" > /tmp/iso/${file} +ln /tmp/iso/${file} /tmp/iso/hardlink +if [ "$(uname -s)" = "Linux" ]; then # gnu coreutils touch doesn't have -h +TZ=utc touch -afm -t 197001020000.01 /tmp/iso /tmp/iso/${file} /tmp/iso/${dir} +else +TZ=utc touch -afhm -t 197001020000.01 /tmp/iso /tmp/iso/${file} /tmp/iso/${dir} +fi +F=test_read_format_iso_joliet_long.iso.Z +mkhybrid -J -joliet-long -uid 1 -gid 2 /tmp/iso | compress > $F +uuencode $F $F > $F.uu +rm -rf /tmp/iso +exit 1 + */ + +DEFINE_TEST(test_read_format_isojoliet_long) +{ + const char *refname = "test_read_format_iso_joliet_long.iso.Z"; + char pathname[104]; + struct archive_entry *ae; + struct archive *a; + const void *p; + size_t size; + off_t offset; + int i; + + for (i = 0; i < 100; i++) + pathname[i] = '0' + ((i+1) % 10); + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualInt(0, archive_read_support_compression_all(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + assertEqualInt(ARCHIVE_OK, + archive_read_set_options(a, "iso9660:!rockridge")); + assertEqualInt(ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* First entry is '.' root directory. */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString(".", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(86401, archive_entry_ctime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(0, archive_entry_uid(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt((int)size, 0); + + /* A directory. */ + pathname[100] = 'd'; + pathname[101] = 'i'; + pathname[102] = 'r'; + pathname[103] = '\0'; + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString(pathname, archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + + /* A regular file with two names (pathname gets returned + * first, so it's not marked as a hardlink). */ + pathname[100] = '1'; + pathname[101] = '2'; + pathname[102] = '3'; + pathname[103] = '\0'; + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString(pathname, archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assert(archive_entry_hardlink(ae) == NULL); + assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(0, archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(6, (int)size); + assertEqualInt(0, offset); + assertEqualInt(0, memcmp(p, "hello\n", 6)); + + /* Second name for the same regular file (this happens to be + * returned second, so does get marked as a hardlink). */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualString(pathname, archive_entry_hardlink(ae)); + assert(!archive_entry_size_is_set(ae)); + + /* End of archive. */ + assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + + /* Close the archive. */ + assertEqualInt(0, archive_read_close(a)); + assertEqualInt(0, archive_read_finish(a)); +} + diff --git a/lib/libarchive/test/test_read_format_isojoliet_rr.c b/lib/libarchive/test/test_read_format_isojoliet_rr.c new file mode 100644 index 000000000000..394df144f3ca --- /dev/null +++ b/lib/libarchive/test/test_read_format_isojoliet_rr.c @@ -0,0 +1,159 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Based on libarchive/test/test_read_format_isorr_bz2.c with + * bugs introduced by Andreas Henriksson for + * testing ISO9660 image with Joliet extension. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* +Execute the following to rebuild the data for this program: + tail -n +35 test_read_format_isojoliet_rr.c | /bin/sh + +rm -rf /tmp/iso +mkdir /tmp/iso +mkdir /tmp/iso/dir +file="long-joliet-file-name.textfile" +echo "hello" >/tmp/iso/$file +ln /tmp/iso/$file /tmp/iso/hardlink +(cd /tmp/iso; ln -s $file symlink) +if [ "$(uname -s)" = "Linux" ]; then # gnu coreutils touch doesn't have -h +TZ=utc touch -afm -t 197001020000.01 /tmp/iso/hardlink /tmp/iso/$file /tmp/iso/dir +TZ=utc touch -afm -t 197001030000.02 /tmp/iso/symlink +TZ=utc touch -afm -t 197001020000.01 /tmp/iso +else +TZ=utc touch -afhm -t 197001020000.01 /tmp/iso/hardlink /tmp/iso/$file /tmp/iso/dir +TZ=utc touch -afhm -t 197001030000.02 /tmp/iso/symlink +TZ=utc touch -afhm -t 197001020000.01 /tmp/iso +fi +F=test_read_format_iso_joliet_rockridge.iso.Z +mkhybrid -J -uid 1 -gid 2 /tmp/iso | compress > $F +uuencode $F $F > $F.uu +exit 1 + */ + +DEFINE_TEST(test_read_format_isojoliet_rr) +{ + const char *refname = "test_read_format_iso_joliet_rockridge.iso.Z"; + struct archive_entry *ae; + struct archive *a; + const void *p; + size_t size; + off_t offset; + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualInt(0, archive_read_support_compression_all(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + assertEqualInt(ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* First entry is '.' root directory. */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString(".", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt((int)size, 0); + + /* A directory. */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("dir", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + + /* A regular file with two names ("hardlink" gets returned + * first, so it's not marked as a hardlink). */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("long-joliet-file-name.textfile", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assert(archive_entry_hardlink(ae) == NULL); + assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(0, archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(6, (int)size); + assertEqualInt(0, offset); + assertEqualInt(0, memcmp(p, "hello\n", 6)); + assertEqualInt(86401, archive_entry_mtime(ae)); + /* mkisofs records their access time. */ + /*assertEqualInt(86401, archive_entry_atime(ae));*/ + /* TODO: Actually, libarchive should be able to + * compute nlinks correctly even without RR + * extensions. See comments in libarchive source. */ + assertEqualInt(2, archive_entry_nlink(ae)); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + + /* Second name for the same regular file (this happens to be + * returned second, so does get marked as a hardlink). */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualString("long-joliet-file-name.textfile", + archive_entry_hardlink(ae)); + assert(!archive_entry_size_is_set(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + /* TODO: See above. */ + assertEqualInt(2, archive_entry_nlink(ae)); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + + /* A symlink to the regular file. */ + assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualString("symlink", archive_entry_pathname(ae)); + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("long-joliet-file-name.textfile", + archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(172802, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_nlink(ae)); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + + /* End of archive. */ + assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); + + /* Close the archive. */ + assertEqualInt(0, archive_read_close(a)); + assertEqualInt(0, archive_read_finish(a)); +} + diff --git a/lib/libarchive/test/test_read_format_isorr_bz2.c b/lib/libarchive/test/test_read_format_isorr_bz2.c index 250019f81567..730c11228101 100644 --- a/lib/libarchive/test/test_read_format_isorr_bz2.c +++ b/lib/libarchive/test/test_read_format_isorr_bz2.c @@ -26,124 +26,178 @@ __FBSDID("$FreeBSD$"); /* +PLEASE use old cdrtools; mkisofs verion is 2.01. +This version mkisofs made wrong "SL" System Use Entry of RRIP. + Execute the following command to rebuild the data for this program: - tail -n +32 test_read_format_isorr_bz2.c | /bin/sh + tail -n +34 test_read_format_isorr_bz2.c | /bin/sh rm -rf /tmp/iso mkdir /tmp/iso mkdir /tmp/iso/dir echo "hello" >/tmp/iso/file -dd if=/dev/zero bs=1 count=12345678 >>/tmp/iso/file +dd if=/dev/zero count=1 bs=12345678 >>/tmp/iso/file ln /tmp/iso/file /tmp/iso/hardlink (cd /tmp/iso; ln -s file symlink) +(cd /tmp/iso; ln -s /tmp/ symlink2) +(cd /tmp/iso; ln -s /tmp/../ symlink3) +(cd /tmp/iso; ln -s .././../tmp/ symlink4) +(cd /tmp/iso; ln -s .///file symlink5) +(cd /tmp/iso; ln -s /tmp//../ symlink6) TZ=utc touch -afhm -t 197001020000.01 /tmp/iso /tmp/iso/file /tmp/iso/dir -TZ=utc touch -afhm -t 197001030000.02 /tmp/iso/symlink -mkhybrid -R -uid 1 -gid 2 /tmp/iso | bzip2 > test_read_format_isorr_bz2.iso.bz2 -F=test_read_format_isorr_bz2.iso.bz2 +TZ=utc touch -afhm -t 197001030000.02 /tmp/iso/symlink /tmp/iso/symlink5 +F=test_read_format_iso_rockridge.iso.Z +mkhybrid -R -uid 1 -gid 2 /tmp/iso | compress > $F uuencode $F $F > $F.uu exit 1 */ DEFINE_TEST(test_read_format_isorr_bz2) { - const char *refname = "test_read_format_isorr_bz2.iso.bz2"; + const char *refname = "test_read_format_iso_rockridge.iso.Z"; struct archive_entry *ae; struct archive *a; const void *p; size_t size; off_t offset; - int r; + int i; extract_reference_file(refname); assert((a = archive_read_new()) != NULL); - r = archive_read_support_compression_bzip2(a); - if (r == ARCHIVE_WARN) { - skipping("bzip2 reading not fully supported on this platform"); - assertEqualInt(0, archive_read_finish(a)); - return; - } - assertEqualInt(0, r); + assertEqualInt(0, archive_read_support_compression_all(a)); assertEqualInt(0, archive_read_support_format_all(a)); assertEqualInt(ARCHIVE_OK, archive_read_open_filename(a, refname, 10240)); - /* First entry is '.' root directory. */ - assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString(".", archive_entry_pathname(ae)); - assert(S_ISDIR(archive_entry_stat(ae)->st_mode)); - assertEqualInt(2048, archive_entry_size(ae)); - assertEqualInt(86401, archive_entry_mtime(ae)); - assertEqualInt(0, archive_entry_mtime_nsec(ae)); - assertEqualInt(86401, archive_entry_ctime(ae)); - assertEqualInt(0, archive_entry_stat(ae)->st_nlink); - assertEqualInt(0, archive_entry_uid(ae)); - assertEqualIntA(a, ARCHIVE_EOF, - archive_read_data_block(a, &p, &size, &offset)); - assertEqualInt((int)size, 0); + /* Retrieve each of the 8 files on the ISO image and + * verify that each one is what we expect. */ + for (i = 0; i < 10; ++i) { + assertEqualInt(0, archive_read_next_header(a, &ae)); - /* A directory. */ - assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("dir", archive_entry_pathname(ae)); - assert(S_ISDIR(archive_entry_stat(ae)->st_mode)); - assertEqualInt(2048, archive_entry_size(ae)); - assertEqualInt(86401, archive_entry_mtime(ae)); - assertEqualInt(86401, archive_entry_atime(ae)); - assertEqualInt(2, archive_entry_stat(ae)->st_nlink); - assertEqualInt(1, archive_entry_uid(ae)); - assertEqualInt(2, archive_entry_gid(ae)); - - /* A regular file. */ - assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("file", archive_entry_pathname(ae)); - assert(S_ISREG(archive_entry_stat(ae)->st_mode)); - assertEqualInt(12345684, archive_entry_size(ae)); - assertEqualInt(0, archive_read_data_block(a, &p, &size, &offset)); - assertEqualInt(0, offset); - assertEqualMem(p, "hello\n", 6); - assertEqualInt(86401, archive_entry_mtime(ae)); - assertEqualInt(86401, archive_entry_atime(ae)); - assertEqualInt(2, archive_entry_stat(ae)->st_nlink); - assertEqualInt(1, archive_entry_uid(ae)); - assertEqualInt(2, archive_entry_gid(ae)); - - /* A hardlink to the regular file. */ - assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("hardlink", archive_entry_pathname(ae)); - assert(S_ISREG(archive_entry_stat(ae)->st_mode)); - assertEqualString("file", archive_entry_hardlink(ae)); - assert(!archive_entry_size_is_set(ae)); - assertEqualInt(86401, archive_entry_mtime(ae)); - assertEqualInt(86401, archive_entry_atime(ae)); - assertEqualInt(2, archive_entry_stat(ae)->st_nlink); - assertEqualInt(1, archive_entry_uid(ae)); - assertEqualInt(2, archive_entry_gid(ae)); - - /* A symlink to the regular file. */ - assertEqualInt(0, archive_read_next_header(a, &ae)); - assertEqualString("symlink", archive_entry_pathname(ae)); - assert(S_ISLNK(archive_entry_stat(ae)->st_mode)); - assertEqualString("file", archive_entry_symlink(ae)); - assertEqualInt(0, archive_entry_size(ae)); - assertEqualInt(172802, archive_entry_mtime(ae)); - assertEqualInt(172802, archive_entry_atime(ae)); - assertEqualInt(1, archive_entry_stat(ae)->st_nlink); - assertEqualInt(1, archive_entry_uid(ae)); - assertEqualInt(2, archive_entry_gid(ae)); + if (strcmp(".", archive_entry_pathname(ae)) == 0) { + /* '.' root directory. */ + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + /* Now, we read timestamp recorded by RRIP "TF". */ + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + /* Now, we read links recorded by RRIP "PX". */ + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt((int)size, 0); + } else if (strcmp("dir", archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) { + /* A regular file. */ + assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(12345684, archive_entry_size(ae)); + assertEqualInt(0, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(0, offset); + assertEqualMem(p, "hello\n", 6); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { + /* A hardlink to the regular file. */ + /* Note: If "hardlink" gets returned before "file", + * then "hardlink" will get returned as a regular file + * and "file" will get returned as the hardlink. + * This test should tolerate that, since it's a + * perfectly permissible thing for libarchive to do. */ + assertEqualString("file", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualString("hardlink", archive_entry_hardlink(ae)); + assertEqualInt(0, archive_entry_size_is_set(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink", archive_entry_pathname(ae)) == 0) { + /* A symlink to the regular file. */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("file", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(172802, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink2", archive_entry_pathname(ae)) == 0) { + /* A symlink to /tmp (an absolute path) */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("/tmp", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink3", archive_entry_pathname(ae)) == 0) { + /* A symlink to /tmp/.. (with a ".." component) */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("/tmp/..", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink4", archive_entry_pathname(ae)) == 0) { + /* A symlink to a path with ".." and "." components */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString(".././../tmp", + archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink5", archive_entry_pathname(ae)) == 0) { + /* A symlink to the regular file with "/" components. */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString(".///file", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(172802, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink6", archive_entry_pathname(ae)) == 0) { + /* A symlink to /tmp//.. + * (with "/" and ".." components) */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("/tmp//..", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else { + failure("Saw a file that shouldn't have been there"); + assertEqualString(archive_entry_pathname(ae), ""); + } + } /* End of archive. */ assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); /* Verify archive format. */ - assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2); + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); /* Close the archive. */ assertEqualInt(0, archive_read_close(a)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_read_finish(a); -#else assertEqualInt(0, archive_read_finish(a)); -#endif } diff --git a/lib/libarchive/test/test_read_format_isorr_ce.c b/lib/libarchive/test/test_read_format_isorr_ce.c new file mode 100644 index 000000000000..c9cd059f0f03 --- /dev/null +++ b/lib/libarchive/test/test_read_format_isorr_ce.c @@ -0,0 +1,223 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2009 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* +Execute the following command to rebuild the data for this program: + tail -n +32 test_read_format_isorr_ce.c | /bin/sh + +dirname=/tmp/iso +# +rm -rf $dirname +mkdir $dirname +# +num=0 +file="" +while [ $num -lt 150 ] +do + num=$((num+1)) + file="a$file" +done +# +num=0 +while [ $num -lt 3 ] +do + num=$((num+1)) + file="a$file" + echo "hello $((num+150))" > $dirname/$file + dd if=/dev/zero count=1 bs=4080 >> $dirname/$file + (cd $dirname; ln -s $file sym$num) +done +# +mkdir $dirname/dir +# +time1="197001020000.01" +time2="197001030000.02" +TZ=utc touch -afhm -t $time1 $dirname/dir $dirname/aaaa* +TZ=utc touch -afhm -t $time2 $dirname/sym* +TZ=utc touch -afhm -t $time1 $dirname +# +F=test_read_format_iso_rockridge_ce.iso.Z +mkisofs -R -uid 1 -gid 2 $dirname | compress > $F +uuencode $F $F > $F.uu +rm -rf $dirname +exit 1 + */ + +/* + * Test reading SUSP "CE" extension is works fine. + */ + +static void +mkpath(char *p, int len) +{ + int i; + + for (i = 0; i < len; i++) + p[i] = 'a'; + p[len] = '\0'; +} + +DEFINE_TEST(test_read_format_isorr_ce) +{ + const char *refname = "test_read_format_iso_rockridge_ce.iso.Z"; + char path1[160]; + char path2[160]; + char path3[160]; + struct archive_entry *ae; + struct archive *a; + const void *p; + size_t size; + off_t offset; + int i; + + mkpath(path1, 151); + mkpath(path2, 152); + mkpath(path3, 153); + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualInt(0, archive_read_support_compression_all(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + assertEqualInt(ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Retrieve each of the 8 files on the ISO image and + * verify that each one is what we expect. */ + for (i = 0; i < 8; ++i) { + assertEqualInt(0, archive_read_next_header(a, &ae)); + + if (strcmp(".", archive_entry_pathname(ae)) == 0) { + /* '.' root directory. */ + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + /* Now, we read timestamp recorded by RRIP "TF". */ + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + /* Now, we read links recorded by RRIP "PX". */ + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt((int)size, 0); + } else if (strcmp("dir", archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp(path1, archive_entry_pathname(ae)) == 0) { + /* A regular file. */ + assertEqualString(path1, archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(4090, archive_entry_size(ae)); + assertEqualInt(0, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(0, offset); + assertEqualMem(p, "hello 151\n", 10); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp(path2, archive_entry_pathname(ae)) == 0) { + /* A regular file. */ + assertEqualString(path2, archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(4090, archive_entry_size(ae)); + assertEqualInt(0, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(0, offset); + assertEqualMem(p, "hello 152\n", 10); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp(path3, archive_entry_pathname(ae)) == 0) { + /* A regular file. */ + assertEqualString(path3, archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(4090, archive_entry_size(ae)); + assertEqualInt(0, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(0, offset); + assertEqualMem(p, "hello 153\n", 10); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("sym1", archive_entry_pathname(ae)) == 0) { + /* A symlink to the regular file. */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString(path1, archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("sym2", archive_entry_pathname(ae)) == 0) { + /* A symlink to the regular file. */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString(path2, archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("sym3", archive_entry_pathname(ae)) == 0) { + /* A symlink to the regular file. */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString(path3, archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else { + failure("Saw a file that shouldn't have been there"); + assertEqualString(archive_entry_pathname(ae), ""); + } + } + + /* End of archive. */ + assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); + + /* Close the archive. */ + assertEqualInt(0, archive_read_close(a)); + assertEqualInt(0, archive_read_finish(a)); +} + + diff --git a/lib/libarchive/test/test_read_format_isorr_new_bz2.c b/lib/libarchive/test/test_read_format_isorr_new_bz2.c new file mode 100644 index 000000000000..5fa2492ec265 --- /dev/null +++ b/lib/libarchive/test/test_read_format_isorr_new_bz2.c @@ -0,0 +1,204 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + + +/* +PLEASE use latest cdrtools at least mkisofs version is 2.01.01a63 or later. +Old version mkisofs made wrong "SL" System Use Entry of RRIP. + +Execute the following command to rebuild the data for this program: + tail -n +34 test_read_format_isorr_new_bz2.c | /bin/sh + +rm -rf /tmp/iso +mkdir /tmp/iso +mkdir /tmp/iso/dir +echo "hello" >/tmp/iso/file +dd if=/dev/zero count=1 bs=12345678 >>/tmp/iso/file +ln /tmp/iso/file /tmp/iso/hardlink +(cd /tmp/iso; ln -s file symlink) +(cd /tmp/iso; ln -s /tmp/ symlink2) +(cd /tmp/iso; ln -s /tmp/../ symlink3) +(cd /tmp/iso; ln -s .././../tmp/ symlink4) +(cd /tmp/iso; ln -s .///file symlink5) +(cd /tmp/iso; ln -s /tmp//../ symlink6) +TZ=utc touch -afhm -t 197001020000.01 /tmp/iso /tmp/iso/file /tmp/iso/dir +TZ=utc touch -afhm -t 197001030000.02 /tmp/iso/symlink +F=test_read_format_iso_rockridge_new.iso.Z +mkhybrid -R -uid 1 -gid 2 /tmp/iso | compress > $F +uuencode $F $F > $F.uu +exit 1 + */ + +DEFINE_TEST(test_read_format_isorr_new_bz2) +{ + const char *refname = "test_read_format_iso_rockridge_new.iso.Z"; + struct archive_entry *ae; + struct archive *a; + const void *p; + size_t size; + off_t offset; + int i; + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualInt(0, archive_read_support_compression_all(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + assertEqualInt(ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Retrieve each of the 8 files on the ISO image and + * verify that each one is what we expect. */ + for (i = 0; i < 10; ++i) { + assertEqualInt(0, archive_read_next_header(a, &ae)); + + if (strcmp(".", archive_entry_pathname(ae)) == 0) { + /* '.' root directory. */ + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + /* Now, we read timestamp recorded by RRIP "TF". */ + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + /* Now, we read links recorded by RRIP "PX". */ + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt((int)size, 0); + } else if (strcmp("dir", archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) { + /* A regular file. */ + assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(12345684, archive_entry_size(ae)); + assertEqualInt(0, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(0, offset); + assertEqualMem(p, "hello\n", 6); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { + /* A hardlink to the regular file. */ + /* Note: If "hardlink" gets returned before "file", + * then "hardlink" will get returned as a regular file + * and "file" will get returned as the hardlink. + * This test should tolerate that, since it's a + * perfectly permissible thing for libarchive to do. */ + assertEqualString("file", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualString("hardlink", archive_entry_hardlink(ae)); + assertEqualInt(0, archive_entry_size_is_set(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink", archive_entry_pathname(ae)) == 0) { + /* A symlink to the regular file. */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("file", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(172802, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink2", archive_entry_pathname(ae)) == 0) { + /* A symlink to /tmp/ (an absolute path) */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("/tmp/", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink3", archive_entry_pathname(ae)) == 0) { + /* A symlink to /tmp/../ (with a ".." component) */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("/tmp/../", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink4", archive_entry_pathname(ae)) == 0) { + /* A symlink to a path with ".." and "." components */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString(".././../tmp/", + archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink5", archive_entry_pathname(ae)) == 0) { + /* A symlink to the regular file with "/" components. */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString(".///file", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(172802, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink6", archive_entry_pathname(ae)) == 0) { + /* A symlink to /tmp//../ + * (with "/" and ".." components) */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("/tmp//../", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else { + failure("Saw a file that shouldn't have been there"); + assertEqualString(archive_entry_pathname(ae), ""); + } + } + + /* End of archive. */ + assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); + + /* Close the archive. */ + assertEqualInt(0, archive_read_close(a)); + assertEqualInt(0, archive_read_finish(a)); +} + + diff --git a/lib/libarchive/test/test_read_format_isorr_rr_moved.c b/lib/libarchive/test/test_read_format_isorr_rr_moved.c new file mode 100644 index 000000000000..0aeb2260fc85 --- /dev/null +++ b/lib/libarchive/test/test_read_format_isorr_rr_moved.c @@ -0,0 +1,270 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2009 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* +Execute the following command to rebuild the data for this program: + tail -n +32 test_read_format_isorr_rr_moved.c | /bin/sh + +dirname=/tmp/iso +rm -rf $dirname +mkdir -p $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10 +echo "hello" >$dirname/file +dd if=/dev/zero count=1 bs=12345678 >>$dirname/file +deepfile=$dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10/deep +echo "hello" >$deepfile +dd if=/dev/zero count=1 bs=12345678 >>$deepfile +time="197001020000.01" +TZ=utc touch -afhm -t $time $deepfile +TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9/dir10 +TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8/dir9 +TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7/dir8 +TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6/dir7 +TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5/dir6 +TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4/dir5 +TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3/dir4 +TZ=utc touch -afhm -t $time $dirname/dir1/dir2/dir3 +TZ=utc touch -afhm -t $time $dirname/dir1/dir2 +TZ=utc touch -afhm -t $time $dirname/dir1 +TZ=utc touch -afhm -t $time $dirname/file +TZ=utc touch -afhm -t $time $dirname +F=test_read_format_isorr_rockridge_moved.iso.Z +mkhybrid -R -uid 1 -gid 2 $dirname | compress > $F +uuencode $F $F > $F.uu +exit 1 + */ + +DEFINE_TEST(test_read_format_isorr_rr_moved) +{ + const char *refname = "test_read_format_iso_rockridge_rr_moved.iso.Z"; + struct archive_entry *ae; + struct archive *a; + const void *p; + size_t size; + off_t offset; + int i; + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualInt(0, archive_read_support_compression_all(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + assertEqualInt(ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Retrieve each of the 8 files on the ISO image and + * verify that each one is what we expect. */ + for (i = 0; i < 13; ++i) { + assertEqualInt(0, archive_read_next_header(a, &ae)); + + if (strcmp(".", archive_entry_pathname(ae)) == 0) { + /* '.' root directory. */ + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + /* Now, we read timestamp recorded by RRIP "TF". */ + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + /* Now, we read links recorded by RRIP "PX". */ + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt((int)size, 0); + } else if (strcmp("dir1", archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2", + archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1/dir2", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2/dir3", + archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1/dir2/dir3", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2/dir3/dir4", + archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1/dir2/dir3/dir4", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2/dir3/dir4/dir5", + archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1/dir2/dir3/dir4/dir5", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6", + archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7", + archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7" + "/dir8", + archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7" + "/dir8", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7" + "/dir8/dir9", + archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7" + "/dir8/dir9", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7" + "/dir8/dir9/dir10", + archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7" + "/dir8/dir9/dir10", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { + /* A regular file. */ + assertEqualString("file", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(12345684, archive_entry_size(ae)); + assertEqualInt(0, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(0, offset); + assertEqualMem(p, "hello\n", 6); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("dir1/dir2/dir3/dir4/dir5/dir6/dir7" + "/dir8/dir9/dir10/deep", + archive_entry_pathname(ae)) == 0) { + /* A regular file. */ + assertEqualString("dir1/dir2/dir3/dir4/dir5/dir6/dir7" + "/dir8/dir9/dir10/deep", + archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(12345684, archive_entry_size(ae)); + assertEqualInt(0, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt(0, offset); + assertEqualMem(p, "hello\n", 6); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else { + failure("Saw a file that shouldn't have been there"); + assertEqualString(archive_entry_pathname(ae), ""); + } + } + + /* End of archive. */ + assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); + + /* Close the archive. */ + assertEqualInt(0, archive_read_close(a)); + assertEqualInt(0, archive_read_finish(a)); +} + + diff --git a/lib/libarchive/test/test_read_format_isozisofs_bz2.c b/lib/libarchive/test/test_read_format_isozisofs_bz2.c new file mode 100644 index 000000000000..56c39c0be229 --- /dev/null +++ b/lib/libarchive/test/test_read_format_isozisofs_bz2.c @@ -0,0 +1,187 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* +Execute the following command to rebuild the data for this program: + tail -n +32 test_read_format_isozisofs_bz2.c | /bin/sh + +rm -rf /tmp/iso /tmp/ziso +mkdir /tmp/iso +mkdir /tmp/iso/dir +echo "hello" >/tmp/iso/file +dd if=/dev/zero count=1 bs=12345678 >>/tmp/iso/file +ln /tmp/iso/file /tmp/iso/hardlink +(cd /tmp/iso; ln -s file symlink) +(cd /tmp/iso; ln -s /tmp/ symlink2) +(cd /tmp/iso; ln -s /tmp/../ symlink3) +(cd /tmp/iso; ln -s .././../tmp/ symlink4) +TZ=utc touch -afhm -t 197001020000.01 /tmp/iso /tmp/iso/file /tmp/iso/dir +TZ=utc touch -afhm -t 197001030000.02 /tmp/iso/symlink +mkzftree /tmp/iso /tmp/ziso +TZ=utc touch -afhm -t 197001020000.01 /tmp/ziso /tmp/ziso/file /tmp/ziso/dir +TZ=utc touch -afhm -t 197001030000.02 /tmp/ziso/symlink +F=test_read_format_iso_zisofs.iso.Z +mkhybrid -R -uid 1 -gid 2 -z /tmp/ziso | compress > $F +uuencode $F $F > $F.uu +exit 1 + + */ + +DEFINE_TEST(test_read_format_isozisofs_bz2) +{ + const char *refname = "test_read_format_iso_zisofs.iso.Z"; + struct archive_entry *ae; + struct archive *a; + const void *p; + size_t size; + off_t offset; + int i; + + extract_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualInt(0, archive_read_support_compression_all(a)); + assertEqualInt(0, archive_read_support_format_all(a)); + assertEqualInt(ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Retrieve each of the 8 files on the ISO image and + * verify that each one is what we expect. */ + for (i = 0; i < 8; ++i) { + assertEqualInt(0, archive_read_next_header(a, &ae)); + + if (strcmp(".", archive_entry_pathname(ae)) == 0) { + /* '.' root directory. */ + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + /* Now, we read timestamp recorded by RRIP "TF". */ + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + /* Now, we read links recorded by RRIP "PX". */ + assertEqualInt(3, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &p, &size, &offset)); + assertEqualInt((int)size, 0); + } else if (strcmp("dir", archive_entry_pathname(ae)) == 0) { + /* A directory. */ + assertEqualString("dir", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(2048, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) { + int r; + /* A regular file. */ + assertEqualString("hardlink", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(12345684, archive_entry_size(ae)); + r = archive_read_data_block(a, &p, &size, &offset); + if (r == ARCHIVE_FAILED) { + skipping("Can't read body of ZISOFS entry."); + } else { + assertEqualInt(ARCHIVE_OK, r); + assertEqualInt(0, offset); + assertEqualMem(p, "hello\n", 6); + } + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("file", archive_entry_pathname(ae)) == 0) { + /* A hardlink to the regular file. */ + /* Note: If "hardlink" gets returned before "file", + * then "hardlink" will get returned as a regular file + * and "file" will get returned as the hardlink. + * This test should tolerate that, since it's a + * perfectly permissible thing for libarchive to do. */ + assertEqualString("file", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualString("hardlink", archive_entry_hardlink(ae)); + assertEqualInt(0, archive_entry_size_is_set(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(2, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink", archive_entry_pathname(ae)) == 0) { + /* A symlink to the regular file. */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("file", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(172802, archive_entry_mtime(ae)); + assertEqualInt(172802, archive_entry_atime(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink2", archive_entry_pathname(ae)) == 0) { + /* A symlink to /tmp (an absolute path) */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("/tmp", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink3", archive_entry_pathname(ae)) == 0) { + /* A symlink to /tmp/.. (with a ".." component) */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString("/tmp/..", archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else if (strcmp("symlink4", archive_entry_pathname(ae)) == 0) { + /* A symlink to a path with ".." and "." components */ + assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); + assertEqualString(".././../tmp", + archive_entry_symlink(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_stat(ae)->st_nlink); + assertEqualInt(1, archive_entry_uid(ae)); + assertEqualInt(2, archive_entry_gid(ae)); + } else { + failure("Saw a file that shouldn't have been there"); + assertEqualString(archive_entry_pathname(ae), ""); + } + } + + /* End of archive. */ + assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE); + + /* Close the archive. */ + assertEqualInt(0, archive_read_close(a)); + assertEqualInt(0, archive_read_finish(a)); +} + + diff --git a/lib/libarchive/test/test_read_format_mtree.c b/lib/libarchive/test/test_read_format_mtree.c index b13034fbf4d3..5001e4d8a7a6 100644 --- a/lib/libarchive/test/test_read_format_mtree.c +++ b/lib/libarchive/test/test_read_format_mtree.c @@ -25,34 +25,16 @@ #include "test.h" __FBSDID("$FreeBSD$"); -/* Single entry with a hardlink. */ -static unsigned char archive[] = { - "#mtree\n" - "file type=file uid=18 mode=0123 size=3\n" - "dir type=dir\n" - " file\\040with\\040space type=file uid=18\n" - " ..\n" - "file\\04with\\040space type=file\n" - "dir2 type=dir\n" - " dir3a type=dir\n" - " indir3a type=file\n" - "dir2/fullindir2 type=file mode=0777\n" - " ..\n" - " indir2 type=file\n" - " dir3b type=dir\n" - " indir3b type=file\n" - " ..\n" - " ..\n" - "notindir type=file\n" - "dir2/fullindir2 mode=0644\n" -}; - -DEFINE_TEST(test_read_format_mtree) +static void +test_read_format_mtree1(void) { + const char reffile[] = "test_read_format_mtree.mtree"; char buff[16]; struct archive_entry *ae; struct archive *a; - int fd; + FILE *f; + + extract_reference_file(reffile); /* * An access error occurred on some platform when mtree @@ -60,29 +42,28 @@ DEFINE_TEST(test_read_format_mtree) * the routine which open a directory that we create * "dir" and "dir2" directories. */ - assertEqualInt(0, mkdir("dir", 0775)); - assertEqualInt(0, mkdir("dir2", 0775)); + assertMakeDir("dir", 0775); + assertMakeDir("dir2", 0775); assert((a = archive_read_new()) != NULL); 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_open_file(a, reffile, 11)); /* * Read "file", whose data is available on disk. */ - fd = open("file", O_WRONLY | O_CREAT, 0777); - assert(fd >= 0); - assertEqualInt(3, write(fd, "hi\n", 3)); - close(fd); + f = fopen("file", "wb"); + assert(f != NULL); + assertEqualInt(3, fwrite("hi\n", 1, 3, f)); + fclose(f); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_MTREE); assertEqualString(archive_entry_pathname(ae), "file"); assertEqualInt(archive_entry_uid(ae), 18); - assert(S_ISREG(archive_entry_mode(ae))); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0123); assertEqualInt(archive_entry_size(ae), 3); assertEqualInt(3, archive_read_data(a, buff, 3)); @@ -90,13 +71,13 @@ DEFINE_TEST(test_read_format_mtree) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir"); - assert(S_ISDIR(archive_entry_mode(ae))); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir/file with space"); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); - assertEqualString(archive_entry_pathname(ae), "file\\04with space"); + assertEqualString(archive_entry_pathname(ae), "file with space"); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2"); @@ -125,11 +106,38 @@ DEFINE_TEST(test_read_format_mtree) assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_read_finish(a); -#else assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); -#endif +} + +static void +test_read_format_mtree2(void) +{ + static char archive[] = + "#mtree\n" + "d type=dir content=.\n"; + struct archive_entry *ae; + struct archive *a; + + assert((a = archive_read_new()) != NULL); + 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)); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_MTREE); + assertEqualString(archive_entry_pathname(ae), "d"); + assertEqualInt(archive_entry_filetype(ae), AE_IFDIR); + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); } + +DEFINE_TEST(test_read_format_mtree) +{ + test_read_format_mtree1(); + test_read_format_mtree2(); +} diff --git a/lib/libarchive/test/test_read_format_mtree.mtree.uu b/lib/libarchive/test/test_read_format_mtree.mtree.uu new file mode 100644 index 000000000000..9fa0d9b04d55 --- /dev/null +++ b/lib/libarchive/test/test_read_format_mtree.mtree.uu @@ -0,0 +1,13 @@ +$FreeBSD$ + +begin 644 test_read_format_mtree.mtree +M(VUT7!E/61I<@H@9FEL95PP-#!W:71H7#`T,'-P86-E('1Y<&4]9FEL +M92!U:60],3@*("XN"F9I;&5<,#0P=VET:%PP-#!S<&%C92!T>7!E/69I;&4* +M9&ER,B!T>7!E/61I<@H@9&ER,V$@='EP93UD:7(*("!I;F1I7!E/61I<@H@(&EN9&ER,V(@ +M='EP93UF:6QE"B`@+BX*("XN"FYO=&EN9&ER('1Y<&4]9FEL90ID:7(R+V9U +3;&QI;F1Ifilebytes > 0) { if (private->filebytes < skip) - skip = private->filebytes; + skip = (off_t)private->filebytes; private->filebytes -= skip; } else { skip = 0; diff --git a/lib/libarchive/test/test_write_compress_program.c b/lib/libarchive/test/test_write_compress_program.c index 713638e7eb69..34d0680489e2 100644 --- a/lib/libarchive/test/test_write_compress_program.c +++ b/lib/libarchive/test/test_write_compress_program.c @@ -38,12 +38,9 @@ DEFINE_TEST(test_write_compress_program) size_t used; int blocksize = 1024; int r; - const char *compprog, *decompprog; - decompprog = external_gzip_program(1); - if ((compprog = external_gzip_program(0)) == NULL) { - skipping("There is no gzip compression " - "program in this platform"); + if (!canGzip()) { + skipping("Cannot run 'gzip'"); return; } @@ -51,7 +48,7 @@ DEFINE_TEST(test_write_compress_program) /* Write it through an external "gzip" program. */ assert((a = archive_write_new()) != NULL); assertA(0 == archive_write_set_format_ustar(a)); - r = archive_write_set_compression_program(a, compprog); + r = archive_write_set_compression_program(a, "gzip"); if (r == ARCHIVE_FATAL) { skipping("Write compression via external " "program unsupported on this platform"); @@ -91,8 +88,8 @@ DEFINE_TEST(test_write_compress_program) /* The compression_gzip() handler will fall back to gunzip * automatically, but if we know gunzip isn't available, then * skip the rest. */ - if (r != ARCHIVE_OK && decompprog == NULL) { - skipping("No gzip decompression is available; " + if (r != ARCHIVE_OK && !canGunzip()) { + skipping("No libz and no gunzip program, " "unable to verify gzip compression"); assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); return; diff --git a/lib/libarchive/test/test_write_disk.c b/lib/libarchive/test/test_write_disk.c index c0b22e58a125..f3f4e56ee786 100644 --- a/lib/libarchive/test/test_write_disk.c +++ b/lib/libarchive/test/test_write_disk.c @@ -28,6 +28,14 @@ __FBSDID("$FreeBSD$"); #if ARCHIVE_VERSION_NUMBER >= 1009000 #define UMASK 022 +/* + * When comparing mode values, ignore high-order bits + * that are set on some OSes. This should cover the bits + * we're interested in (standard mode bits + file type bits) + * while ignoring extra markers such as Haiku/BeOS index + * flags. + */ +#define MODE_MASK 0777777 static void create(struct archive_entry *ae, const char *msg) { @@ -46,14 +54,15 @@ static void create(struct archive_entry *ae, const char *msg) #endif /* Test the entries on disk. */ assert(0 == stat(archive_entry_pathname(ae), &st)); - failure("st.st_mode=%o archive_entry_mode(ae)=%o", - st.st_mode, archive_entry_mode(ae)); + failure("%s", msg); + +#if !defined(_WIN32) || defined(__CYGWIN__) /* When verifying a dir, ignore the S_ISGID bit, as some systems set * that automatically. */ if (archive_entry_filetype(ae) == AE_IFDIR) st.st_mode &= ~S_ISGID; -#if !defined(_WIN32) || defined(__CYGWIN__) - assertEqualInt(st.st_mode, archive_entry_mode(ae) & ~UMASK); + assertEqualInt(st.st_mode & MODE_MASK, + archive_entry_mode(ae) & ~UMASK & MODE_MASK); #endif } @@ -61,8 +70,6 @@ static void create_reg_file(struct archive_entry *ae, const char *msg) { static const char data[]="abcdefghijklmnopqrstuvwxyz"; struct archive *ad; - struct stat st; - time_t now; /* Write the entry to disk. */ assert((ad = archive_write_disk_new()) != NULL); @@ -96,28 +103,20 @@ static void create_reg_file(struct archive_entry *ae, const char *msg) assertEqualInt(0, archive_write_finish(ad)); #endif /* Test the entries on disk. */ - assert(0 == stat(archive_entry_pathname(ae), &st)); - failure("st.st_mode=%o archive_entry_mode(ae)=%o", - st.st_mode, archive_entry_mode(ae)); -#if !defined(_WIN32) || defined(__CYGWIN__) - assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK)); -#endif - assertEqualInt(st.st_size, sizeof(data)); + assertIsReg(archive_entry_pathname(ae), archive_entry_mode(ae) & 0777); + assertFileSize(archive_entry_pathname(ae), sizeof(data)); /* test_write_disk_times has more detailed tests of this area. */ - assertEqualInt(st.st_mtime, 123456789); - failure("No atime was specified, so atime should get set to current time"); - now = time(NULL); - assert(st.st_atime <= now && st.st_atime > now - 5); + assertFileMtime(archive_entry_pathname(ae), 123456789, 0); + failure("No atime given, so atime should get set to current time"); + assertFileAtimeRecent(archive_entry_pathname(ae)); } static void create_reg_file2(struct archive_entry *ae, const char *msg) { const int datasize = 100000; char *data; - char *compare; struct archive *ad; - struct stat st; - int i, fd; + int i; data = malloc(datasize); for (i = 0; i < datasize; i++) @@ -137,26 +136,12 @@ static void create_reg_file2(struct archive_entry *ae, const char *msg) archive_write_data_block(ad, data + i, 1000, i)); } assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_write_finish(ad); -#else assertEqualInt(0, archive_write_finish(ad)); -#endif - /* Test the entries on disk. */ - assert(0 == stat(archive_entry_pathname(ae), &st)); - failure("st.st_mode=%o archive_entry_mode(ae)=%o", - st.st_mode, archive_entry_mode(ae)); -#if !defined(_WIN32) || defined(__CYGWIN__) - assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK)); -#endif - assertEqualInt(st.st_size, i); - compare = malloc(datasize); - fd = open(archive_entry_pathname(ae), O_RDONLY); - assertEqualInt(datasize, read(fd, compare, datasize)); - close(fd); - assert(memcmp(compare, data, datasize) == 0); - free(compare); + /* Test the entries on disk. */ + assertIsReg(archive_entry_pathname(ae), archive_entry_mode(ae) & 0777); + assertFileSize(archive_entry_pathname(ae), i); + assertFileContents(data, datasize, archive_entry_pathname(ae)); free(data); } @@ -268,7 +253,7 @@ DEFINE_TEST(test_write_disk) struct archive_entry *ae; /* Force the umask to something predictable. */ - umask(UMASK); + assertUmask(UMASK); /* A regular file. */ assert((ae = archive_entry_new()) != NULL); diff --git a/lib/libarchive/test/test_write_disk_failures.c b/lib/libarchive/test/test_write_disk_failures.c index 1befbac61d85..f74c947ab365 100644 --- a/lib/libarchive/test/test_write_disk_failures.c +++ b/lib/libarchive/test/test_write_disk_failures.c @@ -42,13 +42,13 @@ DEFINE_TEST(test_write_disk_failures) int fd; /* Force the umask to something predictable. */ - umask(UMASK); + assertUmask(UMASK); /* A directory that we can't write to. */ - assertEqualInt(0, mkdir("dir", 0555)); + assertMakeDir("dir", 0555); /* Can we? */ - fd = open("dir/testfile", O_WRONLY | O_CREAT, 0777); + fd = open("dir/testfile", O_WRONLY | O_CREAT | O_BINARY, 0777); if (fd >= 0) { /* Apparently, we can, so the test below won't work. */ close(fd); diff --git a/lib/libarchive/test/test_write_disk_hardlink.c b/lib/libarchive/test/test_write_disk_hardlink.c index 2ab242093a61..5756602d28ef 100644 --- a/lib/libarchive/test/test_write_disk_hardlink.c +++ b/lib/libarchive/test/test_write_disk_hardlink.c @@ -43,16 +43,16 @@ __FBSDID("$FreeBSD$"); */ DEFINE_TEST(test_write_disk_hardlink) { -#if ARCHIVE_VERSION_NUMBER < 1009000 - skipping("archive_write_disk_hardlink tests"); +#if defined(__HAIKU__) + skipping("archive_write_disk_hardlink; hardlinks are not supported on bfs"); #else static const char data[]="abcdefghijklmnopqrstuvwxyz"; struct archive *ad; struct archive_entry *ae; - struct stat st, st2; + int r; /* Force the umask to something predictable. */ - umask(UMASK); + assertUmask(UMASK); /* Write entries to disk. */ assert((ad = archive_write_disk_new()) != NULL); @@ -79,10 +79,12 @@ DEFINE_TEST(test_write_disk_hardlink) archive_entry_set_mode(ae, S_IFREG | 0642); archive_entry_set_size(ae, 0); archive_entry_copy_hardlink(ae, "link1a"); - assertEqualIntA(ad, 0, archive_write_header(ad, ae)); - assertEqualInt(ARCHIVE_WARN, - archive_write_data(ad, data, sizeof(data))); - assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r >= ARCHIVE_WARN) { + assertEqualInt(ARCHIVE_WARN, + archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + } archive_entry_free(ae); /* @@ -107,10 +109,12 @@ DEFINE_TEST(test_write_disk_hardlink) archive_entry_set_mode(ae, S_IFREG | 0642); archive_entry_unset_size(ae); archive_entry_copy_hardlink(ae, "link2a"); - assertEqualIntA(ad, 0, archive_write_header(ad, ae)); - assertEqualInt(ARCHIVE_WARN, - archive_write_data(ad, data, sizeof(data))); - assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r >= ARCHIVE_WARN) { + assertEqualInt(ARCHIVE_WARN, + archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + } archive_entry_free(ae); /* @@ -134,9 +138,12 @@ DEFINE_TEST(test_write_disk_hardlink) archive_entry_set_mode(ae, S_IFREG | 0755); archive_entry_set_size(ae, sizeof(data)); archive_entry_copy_hardlink(ae, "link3a"); - assertEqualIntA(ad, 0, archive_write_header(ad, ae)); - assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data))); - assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r > ARCHIVE_WARN) { + assertEqualInt(sizeof(data), + archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + } archive_entry_free(ae); /* @@ -164,34 +171,26 @@ DEFINE_TEST(test_write_disk_hardlink) archive_entry_set_mode(ae, S_IFREG | 0755); archive_entry_set_size(ae, sizeof(data)); archive_entry_copy_hardlink(ae, "link4a"); - assertEqualIntA(ad, 0, archive_write_header(ad, ae)); - assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data))); - assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r > ARCHIVE_FAILED) { + assertEqualInt(sizeof(data), + archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + } archive_entry_free(ae); -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_write_finish(ad); -#else assertEqualInt(0, archive_write_finish(ad)); -#endif /* Test the entries on disk. */ /* Test #1 */ - assert(0 == stat("link1a", &st)); /* If the hardlink was successfully created and the archive * doesn't carry data for it, we consider it to be * non-authoritive for meta data as well. This is consistent * with GNU tar and BSD pax. */ - assertEqualInt(st.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK); - assertEqualInt(st.st_size, sizeof(data)); - assertEqualInt(st.st_nlink, 2); - - assert(0 == stat("link1b", &st2)); - assertEqualInt(st.st_mode, st2.st_mode); - assertEqualInt(st.st_size, st2.st_size); - assertEqualInt(st.st_nlink, st2.st_nlink); - assertEqualInt(st.st_ino, st2.st_ino); - assertEqualInt(st.st_dev, st2.st_dev); + assertIsReg("link1a", 0755 & ~UMASK); + assertFileSize("link1a", sizeof(data)); + assertFileNLinks("link1a", 2); + assertIsHardlink("link1a", "link1b"); /* Test #2: Should produce identical results to test #1 */ /* Note that marking a hardlink with size = 0 is treated the @@ -200,42 +199,21 @@ DEFINE_TEST(test_write_disk_hardlink) * relied on size == 0) and partly to match the model used by * common file formats that store a size of zero for * hardlinks. */ - assert(0 == stat("link2a", &st)); - assertEqualInt(st.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK); - assertEqualInt(st.st_size, sizeof(data)); - assertEqualInt(st.st_nlink, 2); - - assert(0 == stat("link2b", &st2)); - assertEqualInt(st.st_mode, st2.st_mode); - assertEqualInt(st.st_size, st2.st_size); - assertEqualInt(st.st_nlink, st2.st_nlink); - assertEqualInt(st.st_ino, st2.st_ino); - assertEqualInt(st.st_dev, st2.st_dev); + assertIsReg("link2a", 0755 & ~UMASK); + assertFileSize("link2a", sizeof(data)); + assertFileNLinks("link2a", 2); + assertIsHardlink("link2a", "link2b"); /* Test #3 */ - assert(0 == stat("link3a", &st)); - assertEqualInt(st.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK); - assertEqualInt(st.st_size, sizeof(data)); - assertEqualInt(st.st_nlink, 2); - - assert(0 == stat("link3b", &st2)); - assertEqualInt(st2.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK); - assertEqualInt(st2.st_size, sizeof(data)); - assertEqualInt(st2.st_nlink, 2); - assertEqualInt(st.st_ino, st2.st_ino); - assertEqualInt(st.st_dev, st2.st_dev); + assertIsReg("link3a", 0755 & ~UMASK); + assertFileSize("link3a", sizeof(data)); + assertFileNLinks("link3a", 2); + assertIsHardlink("link3a", "link3b"); /* Test #4 */ - assert(0 == stat("link4a", &st)); - assertEqualInt(st.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK); - assertEqualInt(st.st_size, sizeof(data)); - assertEqualInt(st.st_nlink, 2); - - assert(0 == stat("link4b", &st2)); - assertEqualInt(st2.st_mode & E_MASK, (S_IFREG | 0755) & ~UMASK); - assertEqualInt(st2.st_size, sizeof(data)); - assertEqualInt(st2.st_nlink, 2); - assertEqualInt(st.st_ino, st2.st_ino); - assertEqualInt(st.st_dev, st2.st_dev); + assertIsReg("link4a", 0755 & ~UMASK); + assertFileNLinks("link4a", 2); + assertFileSize("link4a", sizeof(data)); + assertIsHardlink("link4a", "link4b"); #endif } diff --git a/lib/libarchive/test/test_write_disk_perms.c b/lib/libarchive/test/test_write_disk_perms.c index 3d9be27e5964..f53ce1946bdc 100644 --- a/lib/libarchive/test/test_write_disk_perms.c +++ b/lib/libarchive/test/test_write_disk_perms.c @@ -60,7 +60,7 @@ searchgid(void) _searched = 1; /* Create a file on disk in the current default dir. */ - fd = open("test_gid", O_CREAT, 0664); + fd = open("test_gid", O_CREAT | O_BINARY, 0664); failure("Couldn't create a file for gid testing."); assert(fd > 0); @@ -132,6 +132,8 @@ DEFINE_TEST(test_write_disk_perms) struct archive_entry *ae; struct stat st; + assertUmask(UMASK); + /* * Set ownership of the current directory to the group of this * process. Otherwise, the SGID tests below fail if the @@ -182,7 +184,7 @@ DEFINE_TEST(test_write_disk_perms) /* Overwrite an existing dir. */ /* For dir, the first perms should get left. */ - assert(mkdir("dir_overwrite_0744", 0744) == 0); + assertMakeDir("dir_overwrite_0744", 0744); /* Check original perms. */ assert(0 == stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); diff --git a/lib/libarchive/test/test_write_disk_secure.c b/lib/libarchive/test/test_write_disk_secure.c index d41748907b8f..74506f1bccb0 100644 --- a/lib/libarchive/test/test_write_disk_secure.c +++ b/lib/libarchive/test/test_write_disk_secure.c @@ -36,13 +36,13 @@ DEFINE_TEST(test_write_disk_secure) { #if ARCHIVE_VERSION_NUMBER < 1009000 skipping("archive_write_disk interface"); -#else +#elif !defined(_WIN32) || defined(__CYGWIN__) struct archive *a; struct archive_entry *ae; struct stat st; /* Start with a known umask. */ - umask(UMASK); + assertUmask(UMASK); /* Create an archive_write_disk object. */ assert((a = archive_write_disk_new()) != NULL); @@ -55,7 +55,6 @@ DEFINE_TEST(test_write_disk_secure) archive_entry_free(ae); assert(0 == archive_write_finish_entry(a)); -#if !defined(_WIN32) || defined(__CYGWIN__) /* Write a symlink to the dir above. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "link_to_dir"); @@ -150,7 +149,6 @@ DEFINE_TEST(test_write_disk_secure) assertEqualInt(0, lstat("link_to_dir4", &st)); assert(S_ISDIR(st.st_mode)); archive_entry_free(ae); -#endif /* * As above, but a link to a non-dir, so the link should get replaced. @@ -180,14 +178,8 @@ DEFINE_TEST(test_write_disk_secure) assert(S_ISDIR(st.st_mode)); archive_entry_free(ae); - -#if ARCHIVE_VERSION_NUMBER < 2000000 - archive_write_finish(a); -#else assert(0 == archive_write_finish(a)); -#endif -#if !defined(_WIN32) || defined(__CYGWIN__) /* Test the entries on disk. */ assert(0 == lstat("dir", &st)); failure("dir: st.st_mode=%o", st.st_mode); @@ -220,5 +212,4 @@ DEFINE_TEST(test_write_disk_secure) failure("link_to_dir2/filec: st.st_mode=%o", st.st_mode); assert((st.st_mode & 07777) == 0755); #endif -#endif } diff --git a/lib/libarchive/test/test_write_disk_sparse.c b/lib/libarchive/test/test_write_disk_sparse.c index c9c00d3d1e61..b613f56c026b 100644 --- a/lib/libarchive/test/test_write_disk_sparse.c +++ b/lib/libarchive/test/test_write_disk_sparse.c @@ -40,7 +40,7 @@ verify_write_data(struct archive *a, int sparse) size_t buff_size = 64 * 1024; char *buff, *p; const char *msg = sparse ? "sparse" : "non-sparse"; - int fd; + FILE *f; buff = malloc(buff_size); assert(buff != NULL); @@ -78,12 +78,12 @@ verify_write_data(struct archive *a, int sparse) /* Test the entry on disk. */ assert(0 == stat(archive_entry_pathname(ae), &st)); assertEqualInt(st.st_size, 8 * buff_size); - fd = open(archive_entry_pathname(ae), O_RDONLY); - if (!assert(fd >= 0)) + f = fopen(archive_entry_pathname(ae), "rb"); + if (!assert(f != NULL)) return; /* Check first block. */ - assertEqualInt(buff_size, read(fd, buff, buff_size)); + assertEqualInt(buff_size, fread(buff, 1, buff_size, f)); failure("%s", msg); assertEqualMem(buff, data, sizeof(data)); for (p = buff + sizeof(data); p < buff + buff_size; ++p) { @@ -93,7 +93,7 @@ verify_write_data(struct archive *a, int sparse) } /* Check second block. */ - assertEqualInt(buff_size, read(fd, buff, buff_size)); + assertEqualInt(buff_size, fread(buff, 1, buff_size, f)); for (p = buff; p < buff + buff_size; ++p) { failure("offset: %d, %s", (int)(p - buff), msg); if (p == buff + buff_size / 2 - 3) { @@ -104,7 +104,7 @@ verify_write_data(struct archive *a, int sparse) } /* Check third block. */ - assertEqualInt(buff_size, read(fd, buff, buff_size)); + assertEqualInt(buff_size, fread(buff, 1, buff_size, f)); for (p = buff; p < buff + buff_size - sizeof(data); ++p) { failure("offset: %d, %s", (int)(p - buff), msg); if (!assertEqualInt(0, *p)) @@ -115,7 +115,7 @@ verify_write_data(struct archive *a, int sparse) /* XXX more XXX */ - assertEqualInt(0, close(fd)); + assertEqualInt(0, fclose(f)); archive_entry_free(ae); free(buff); } @@ -132,7 +132,7 @@ verify_write_data_block(struct archive *a, int sparse) size_t buff_size = 64 * 1024; char *buff, *p; const char *msg = sparse ? "sparse" : "non-sparse"; - int fd; + FILE *f; buff = malloc(buff_size); assert(buff != NULL); @@ -174,12 +174,12 @@ verify_write_data_block(struct archive *a, int sparse) /* Test the entry on disk. */ assert(0 == stat(archive_entry_pathname(ae), &st)); assertEqualInt(st.st_size, 8 * buff_size); - fd = open(archive_entry_pathname(ae), O_RDONLY); - if (!assert(fd >= 0)) + f = fopen(archive_entry_pathname(ae), "rb"); + if (!assert(f != NULL)) return; /* Check 100-byte gap at beginning */ - assertEqualInt(100, read(fd, buff, 100)); + assertEqualInt(100, fread(buff, 1, 100, f)); failure("%s", msg); for (p = buff; p < buff + 100; ++p) { failure("offset: %d, %s", (int)(p - buff), msg); @@ -188,7 +188,7 @@ verify_write_data_block(struct archive *a, int sparse) } /* Check first block. */ - assertEqualInt(buff_size, read(fd, buff, buff_size)); + assertEqualInt(buff_size, fread(buff, 1, buff_size, f)); failure("%s", msg); assertEqualMem(buff, data, sizeof(data)); for (p = buff + sizeof(data); p < buff + buff_size; ++p) { @@ -198,7 +198,7 @@ verify_write_data_block(struct archive *a, int sparse) } /* Check 100-byte gap */ - assertEqualInt(100, read(fd, buff, 100)); + assertEqualInt(100, fread(buff, 1, 100, f)); failure("%s", msg); for (p = buff; p < buff + 100; ++p) { failure("offset: %d, %s", (int)(p - buff), msg); @@ -207,7 +207,7 @@ verify_write_data_block(struct archive *a, int sparse) } /* Check second block. */ - assertEqualInt(buff_size, read(fd, buff, buff_size)); + assertEqualInt(buff_size, fread(buff, 1, buff_size, f)); for (p = buff; p < buff + buff_size; ++p) { failure("offset: %d, %s", (int)(p - buff), msg); if (p == buff + buff_size / 2 - 3) { @@ -218,7 +218,7 @@ verify_write_data_block(struct archive *a, int sparse) } /* Check 100-byte gap */ - assertEqualInt(100, read(fd, buff, 100)); + assertEqualInt(100, fread(buff, 1, 100, f)); failure("%s", msg); for (p = buff; p < buff + 100; ++p) { failure("offset: %d, %s", (int)(p - buff), msg); @@ -227,7 +227,7 @@ verify_write_data_block(struct archive *a, int sparse) } /* Check third block. */ - assertEqualInt(buff_size, read(fd, buff, buff_size)); + assertEqualInt(buff_size, fread(buff, 1, buff_size, f)); for (p = buff; p < buff + buff_size - sizeof(data); ++p) { failure("offset: %d, %s", (int)(p - buff), msg); if (!assertEqualInt(0, *p)) @@ -237,7 +237,7 @@ verify_write_data_block(struct archive *a, int sparse) assertEqualMem(buff + buff_size - sizeof(data), data, sizeof(data)); /* Check another block size beyond last we wrote. */ - assertEqualInt(buff_size, read(fd, buff, buff_size)); + assertEqualInt(buff_size, fread(buff, 1, buff_size, f)); failure("%s", msg); for (p = buff; p < buff + buff_size; ++p) { failure("offset: %d, %s", (int)(p - buff), msg); @@ -248,7 +248,7 @@ verify_write_data_block(struct archive *a, int sparse) /* XXX more XXX */ - assertEqualInt(0, close(fd)); + assertEqualInt(0, fclose(f)); free(buff); archive_entry_free(ae); } diff --git a/lib/libarchive/test/test_write_disk_symlink.c b/lib/libarchive/test/test_write_disk_symlink.c new file mode 100644 index 000000000000..861f3bf6704e --- /dev/null +++ b/lib/libarchive/test/test_write_disk_symlink.c @@ -0,0 +1,117 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * Exercise symlink recreation. + */ +DEFINE_TEST(test_write_disk_symlink) +{ + static const char data[]="abcdefghijklmnopqrstuvwxyz"; + struct archive *ad; + struct archive_entry *ae; + int r; + + if (!canSymlink()) { + skipping("Symlinks not supported"); + return; + } + + /* Write entries to disk. */ + assert((ad = archive_write_disk_new()) != NULL); + + /* + * First, create a regular file then a symlink to that file. + */ + + /* Regular file: link1a */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "link1a"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, sizeof(data)); + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualInt(sizeof(data), + archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* Symbolic Link: link1b -> link1a */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "link1b"); + archive_entry_set_mode(ae, AE_IFLNK | 0642); + archive_entry_set_size(ae, 0); + archive_entry_copy_symlink(ae, "link1a"); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r >= ARCHIVE_WARN) + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + /* + * We should be able to do this in the other order as well, + * of course. + */ + + /* Symbolic link: link2b -> link2a */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "link2b"); + archive_entry_set_mode(ae, AE_IFLNK | 0642); + archive_entry_unset_size(ae); + archive_entry_copy_symlink(ae, "link2a"); + assertEqualIntA(ad, 0, r = archive_write_header(ad, ae)); + if (r >= ARCHIVE_WARN) { + assertEqualInt(ARCHIVE_WARN, + archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + } + archive_entry_free(ae); + + /* File: link2a */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "link2a"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, sizeof(data)); + assertEqualIntA(ad, 0, archive_write_header(ad, ae)); + assertEqualInt(sizeof(data), + archive_write_data(ad, data, sizeof(data))); + assertEqualIntA(ad, 0, archive_write_finish_entry(ad)); + archive_entry_free(ae); + + assertEqualInt(ARCHIVE_OK, archive_write_finish(ad)); + + /* Test the entries on disk. */ + + /* Test #1 */ + assertIsReg("link1a", -1); + assertFileSize("link1a", sizeof(data)); + assertFileNLinks("link1a", 1); + assertIsSymlink("link1b", "link1a"); + + /* Test #2: Should produce identical results to test #1 */ + assertIsReg("link2a", -1); + assertFileSize("link2a", sizeof(data)); + assertFileNLinks("link2a", 1); + assertIsSymlink("link2b", "link2a"); +} diff --git a/lib/libarchive/test/test_write_disk_times.c b/lib/libarchive/test/test_write_disk_times.c index 2891e3612aff..13841cfddafe 100644 --- a/lib/libarchive/test/test_write_disk_times.c +++ b/lib/libarchive/test/test_write_disk_times.c @@ -35,8 +35,6 @@ DEFINE_TEST(test_write_disk_times) { struct archive *a; struct archive_entry *ae; - struct stat st; - time_t now = time(NULL); /* Create an archive_write_disk object. */ assert((a = archive_write_disk_new()) != NULL); @@ -55,9 +53,8 @@ DEFINE_TEST(test_write_disk_times) assertEqualInt(ARCHIVE_OK, archive_write_finish_entry(a)); archive_entry_free(ae); /* Verify */ - assertEqualInt(0, stat("file1", &st)); - assertEqualInt(123456, st.st_atime); - assertEqualInt(234567, st.st_mtime); + assertFileAtime("file1", 123456, 0); + assertFileMtime("file1", 234567, 0); /* * mtime specified, but not atime @@ -69,11 +66,8 @@ DEFINE_TEST(test_write_disk_times) assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); assertEqualInt(ARCHIVE_OK, archive_write_finish_entry(a)); archive_entry_free(ae); - /* Verify: Current atime and mtime as specified. */ - assertEqualInt(0, stat("file2", &st)); - assertEqualInt(234567, st.st_mtime); - failure("now: %ld st.st_atime: %ld", (long)now, (long)st.st_atime); - assert(st.st_atime >= now && st.st_atime < now + 3); + assertFileMtime("file2", 234567, 0); + assertFileAtimeRecent("file2"); /* * atime specified, but not mtime @@ -86,10 +80,8 @@ DEFINE_TEST(test_write_disk_times) assertEqualInt(ARCHIVE_OK, archive_write_finish_entry(a)); archive_entry_free(ae); /* Verify: Current mtime and atime as specified. */ - assertEqualInt(0, stat("file3", &st)); - assertEqualInt(345678, st.st_atime); - failure("now: %ld st.st_mtime: %ld", (long)now, (long)st.st_mtime); - assert(st.st_mtime >= now && st.st_mtime < now + 3); + assertFileAtime("file3", 345678, 0); + assertFileMtimeRecent("file3"); /* * Neither atime nor mtime specified. @@ -101,11 +93,8 @@ DEFINE_TEST(test_write_disk_times) assertEqualInt(ARCHIVE_OK, archive_write_finish_entry(a)); archive_entry_free(ae); /* Verify: Current mtime and atime. */ - assertEqualInt(0, stat("file4", &st)); - failure("now: %ld st.st_atime: %ld", (long)now, (long)st.st_atime); - assert(st.st_atime >= now && st.st_atime < now + 3); - failure("now: %ld st.st_mtime: %ld", (long)now, (long)st.st_mtime); - assert(st.st_mtime >= now && st.st_mtime < now + 3); + assertFileAtimeRecent("file4"); + assertFileMtimeRecent("file4"); #if defined(__FreeBSD__) /* @@ -120,12 +109,8 @@ DEFINE_TEST(test_write_disk_times) assertEqualInt(ARCHIVE_OK, archive_write_finish_entry(a)); archive_entry_free(ae); /* Verify */ - /* FreeBSD can only store usec resolution, hence rounding here. */ - assertEqualInt(0, stat("file10", &st)); - assertEqualInt(1234567, st.st_atime); - assertEqualInt(23000, st.st_atimespec.tv_nsec); - assertEqualInt(2345678, st.st_mtime); - assertEqualInt(4000, st.st_mtimespec.tv_nsec); + assertFileMtime("file10", 2345678, 4567); + assertFileAtime("file10", 1234567, 23456); /* * Birthtime, mtime and atime on FreeBSD @@ -141,14 +126,9 @@ DEFINE_TEST(test_write_disk_times) assertEqualInt(ARCHIVE_OK, archive_write_finish_entry(a)); archive_entry_free(ae); /* Verify */ - /* FreeBSD can only store usec resolution, hence rounding here. */ - assertEqualInt(0, stat("file11", &st)); - assertEqualInt(1234567, st.st_atime); - assertEqualInt(23000, st.st_atimespec.tv_nsec); - assertEqualInt(3456789, st.st_birthtime); - assertEqualInt(12000, st.st_birthtimespec.tv_nsec); - assertEqualInt(12345678, st.st_mtime); - assertEqualInt(4000, st.st_mtimespec.tv_nsec); + assertFileAtime("file11", 1234567, 23456); + assertFileBirthtime("file11", 3456789, 12345); + assertFileMtime("file11", 12345678, 4567); /* * Birthtime only on FreeBSD. @@ -161,14 +141,9 @@ DEFINE_TEST(test_write_disk_times) assertEqualInt(ARCHIVE_OK, archive_write_finish_entry(a)); archive_entry_free(ae); /* Verify */ - /* FreeBSD can only store usec resolution, hence rounding here. */ - assertEqualInt(0, stat("file12", &st)); - assertEqualInt(3456789, st.st_birthtime); - assertEqualInt(12000, st.st_birthtimespec.tv_nsec); - failure("now: %ld st.st_atime: %ld", (long)now, (long)st.st_atime); - assert(st.st_atime >= now && st.st_atime < now + 3); - failure("now: %ld st.st_mtime: %ld", (long)now, (long)st.st_mtime); - assert(st.st_mtime >= now && st.st_mtime < now + 3); + assertFileAtimeRecent("file12"); + assertFileBirthtime("file12", 3456789, 12345); + assertFileMtimeRecent("file12"); /* * mtime only on FreeBSD. @@ -181,14 +156,9 @@ DEFINE_TEST(test_write_disk_times) assertEqualInt(ARCHIVE_OK, archive_write_finish_entry(a)); archive_entry_free(ae); /* Verify */ - /* FreeBSD can only store usec resolution, hence rounding here. */ - assertEqualInt(0, stat("file13", &st)); - assertEqualInt(4567890, st.st_birthtime); - assertEqualInt(23000, st.st_birthtimespec.tv_nsec); - assertEqualInt(4567890, st.st_mtime); - assertEqualInt(23000, st.st_mtimespec.tv_nsec); - failure("now: %ld st.st_atime: %ld", (long)now, (long)st.st_atime); - assert(st.st_atime >= now && st.st_atime < now + 3); + assertFileAtimeRecent("file13"); + assertFileBirthtime("file13", 4567890, 23456); + assertFileMtime("file13", 4567890, 23456); #else skipping("Platform-specific time restore tests"); #endif diff --git a/lib/libarchive/test/test_write_format_cpio_empty.c b/lib/libarchive/test/test_write_format_cpio_empty.c index 81f17a415acf..fed26ec04020 100644 --- a/lib/libarchive/test/test_write_format_cpio_empty.c +++ b/lib/libarchive/test/test_write_format_cpio_empty.c @@ -71,5 +71,5 @@ DEFINE_TEST(test_write_format_cpio_empty) failure("Empty cpio archive should be exactly 87 bytes, was %d.", used); assert(used == 87); failure("Empty cpio archive is incorrectly formatted."); - assert(memcmp(buff, ref, 87) == 0); + assertEqualMem(buff, ref, 87); } diff --git a/lib/libarchive/test/test_write_format_cpio_newc.c b/lib/libarchive/test/test_write_format_cpio_newc.c index 512df7422912..447d111420dc 100644 --- a/lib/libarchive/test/test_write_format_cpio_newc.c +++ b/lib/libarchive/test/test_write_format_cpio_newc.c @@ -52,7 +52,7 @@ DEFINE_TEST(test_write_format_cpio_newc) { struct archive *a; struct archive_entry *entry; - char *buff, *e; + char *buff, *e, *file; size_t buffsize = 100000; size_t used; @@ -99,7 +99,8 @@ DEFINE_TEST(test_write_format_cpio_newc) assert((entry = archive_entry_new()) != NULL); archive_entry_set_mtime(entry, 3, 30); archive_entry_set_pathname(entry, "lnk"); - archive_entry_set_mode(entry, S_IFLNK | 0664); + archive_entry_set_mode(entry, 0664); + archive_entry_set_filetype(entry, AE_IFLNK); archive_entry_set_size(entry, 0); archive_entry_set_uid(entry, 83); archive_entry_set_gid(entry, 93); @@ -123,9 +124,10 @@ DEFINE_TEST(test_write_format_cpio_newc) e = buff; /* First entry is "file" */ + file = e; assert(is_hex(e, 110)); /* Entire header is hex digits. */ assertEqualMem(e + 0, "070701", 6); /* Magic */ - assertEqualMem(e + 6, "00000059", 8); /* ino */ + assert(memcmp(e + 6, "00000000", 8) != 0); /* ino != 0 */ assertEqualMem(e + 14, "000081b4", 8); /* Mode */ assertEqualMem(e + 22, "00000050", 8); /* uid */ assertEqualMem(e + 30, "0000005a", 8); /* gid */ @@ -166,7 +168,8 @@ DEFINE_TEST(test_write_format_cpio_newc) /* Third entry is "lnk" */ assert(is_hex(e, 110)); /* Entire header is hex digits. */ assertEqualMem(e + 0, "070701", 6); /* Magic */ - assertEqualMem(e + 6, "00000058", 8); /* ino */ + assert(memcmp(e + 6, file + 6, 8) != 0); /* ino != file ino */ + assert(memcmp(e + 6, "00000000", 8) != 0); /* ino != 0 */ assertEqualMem(e + 14, "0000a1b4", 8); /* Mode */ assertEqualMem(e + 22, "00000053", 8); /* uid */ assertEqualMem(e + 30, "0000005d", 8); /* gid */ diff --git a/lib/libarchive/test/test_write_format_cpio_odc.c b/lib/libarchive/test/test_write_format_cpio_odc.c index 73cc3e6218c5..309e003e18b2 100644 --- a/lib/libarchive/test/test_write_format_cpio_odc.c +++ b/lib/libarchive/test/test_write_format_cpio_odc.c @@ -46,7 +46,7 @@ DEFINE_TEST(test_write_format_cpio_odc) { struct archive *a; struct archive_entry *entry; - char *buff, *e; + char *buff, *e, *file; size_t buffsize = 100000; size_t used; @@ -109,7 +109,8 @@ DEFINE_TEST(test_write_format_cpio_odc) assert((entry = archive_entry_new()) != NULL); archive_entry_set_mtime(entry, 3, 30); archive_entry_set_pathname(entry, "symlink"); - archive_entry_set_mode(entry, S_IFLNK | 0664); + archive_entry_set_mode(entry, 0664); + archive_entry_set_filetype(entry, AE_IFLNK); archive_entry_set_symlink(entry,"file"); archive_entry_set_size(entry, 0); archive_entry_set_uid(entry, 88); @@ -130,14 +131,29 @@ DEFINE_TEST(test_write_format_cpio_odc) /* * Verify the archive format. + * + * Notes on the ino validation: cpio does not actually require + * that the ino values written to the archive match those read + * from disk. It really requires that: + * * matching non-zero ino values be written as matching + * non-zero values + * * non-matching non-zero ino values be written as non-matching + * non-zero values + * Libarchive further ensures that zero ino values get written + * as zeroes. This allows the cpio writer to generate + * synthetic ino values for the archive that may be different + * than those on disk in order to avoid problems due to truncation. + * This is especially needed for odc (POSIX format) that + * only supports 18-bit ino values. */ e = buff; /* "file" */ + file = e; /* Remember where this starts... */ assert(is_octal(e, 76)); /* Entire header is octal digits. */ assertEqualMem(e + 0, "070707", 6); /* Magic */ assertEqualMem(e + 6, "000014", 6); /* dev */ - assertEqualMem(e + 12, "000131", 6); /* ino */ + assert(memcmp(e + 12, "000000", 6) != 0); /* ino must be != 0 */ assertEqualMem(e + 18, "100664", 6); /* Mode */ assertEqualMem(e + 24, "000120", 6); /* uid */ assertEqualMem(e + 30, "000132", 6); /* gid */ @@ -154,7 +170,7 @@ DEFINE_TEST(test_write_format_cpio_odc) assert(is_octal(e, 76)); /* Entire header is octal digits. */ assertEqualMem(e + 0, "070707", 6); /* Magic */ assertEqualMem(e + 6, "000014", 6); /* dev */ - assertEqualMem(e + 12, "000131", 6); /* ino */ + assertEqualMem(e + 12, file + 12, 6); /* ino must match above */ assertEqualMem(e + 18, "100664", 6); /* Mode */ assertEqualMem(e + 24, "000120", 6); /* uid */ assertEqualMem(e + 30, "000132", 6); /* gid */ @@ -187,7 +203,8 @@ DEFINE_TEST(test_write_format_cpio_odc) assert(is_octal(e, 76)); /* Entire header is octal digits. */ assertEqualMem(e + 0, "070707", 6); /* Magic */ assertEqualMem(e + 6, "000014", 6); /* dev */ - assertEqualMem(e + 12, "000132", 6); /* ino */ + assert(memcmp(e + 12, file + 12, 6) != 0); /* ino must != file ino */ + assert(memcmp(e + 12, "000000", 6) != 0); /* ino must != 0 */ assertEqualMem(e + 18, "120664", 6); /* Mode */ assertEqualMem(e + 24, "000130", 6); /* uid */ assertEqualMem(e + 30, "000142", 6); /* gid */ diff --git a/lib/libarchive/test/test_write_format_tar_ustar.c b/lib/libarchive/test/test_write_format_tar_ustar.c index 3adacb4e90d1..f66fd7ad82bc 100644 --- a/lib/libarchive/test/test_write_format_tar_ustar.c +++ b/lib/libarchive/test/test_write_format_tar_ustar.c @@ -133,7 +133,8 @@ DEFINE_TEST(test_write_format_tar_ustar) assert((entry = archive_entry_new()) != NULL); archive_entry_set_mtime(entry, 3, 30); archive_entry_set_pathname(entry, "symlink"); - archive_entry_set_mode(entry, S_IFLNK | 0664); + archive_entry_set_mode(entry, 0664); + archive_entry_set_filetype(entry, AE_IFLNK); archive_entry_set_symlink(entry,"file"); archive_entry_set_size(entry, 0); archive_entry_set_uid(entry, 88); diff --git a/lib/libarchive/test/test_write_format_zip.c b/lib/libarchive/test/test_write_format_zip.c new file mode 100644 index 000000000000..f4c51f34ba93 --- /dev/null +++ b/lib/libarchive/test/test_write_format_zip.c @@ -0,0 +1,180 @@ +/*- + * Copyright (c) 2003-2008 Tim Kientzle + * Copyright (c) 2008 Anselm Strauss + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Development supported by Google Summer of Code 2008. + */ + +/* TODO: reader does not yet restore permissions. */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_write_format_zip) +{ + char filedata[64]; + struct archive_entry *ae; + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + const char *compression_type; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); +#ifdef HAVE_ZLIB_H + compression_type = "zip:compression=deflate"; +#else + compression_type = "zip:compression=store"; +#endif + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_format_options(a, compression_type)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_compression_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(10, archive_entry_mtime_nsec(ae)); + archive_entry_copy_pathname(ae, "file"); + assertEqualString("file", archive_entry_pathname(ae)); + archive_entry_set_mode(ae, S_IFREG | 0755); + assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae)); + archive_entry_set_size(ae, 8); + + assertEqualInt(0, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(8, archive_write_data(a, "12345678", 9)); + assertEqualInt(0, archive_write_data(a, "1", 1)); + + /* + * Write another file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(10, archive_entry_mtime_nsec(ae)); + archive_entry_copy_pathname(ae, "file2"); + assertEqualString("file2", archive_entry_pathname(ae)); + archive_entry_set_mode(ae, S_IFREG | 0755); + assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae)); + archive_entry_set_size(ae, 4); + + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(4, archive_write_data(a, "1234", 5)); + + /* + * Write a directory to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 11, 110); + archive_entry_copy_pathname(ae, "dir"); + archive_entry_set_mode(ae, S_IFDIR | 0755); + archive_entry_set_size(ae, 512); + + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + failure("size should be zero so that applications know not to write"); + assertEqualInt(0, archive_entry_size(ae)); + archive_entry_free(ae); + assertEqualIntA(a, 0, archive_write_data(a, "12345678", 9)); + + /* Close out the archive. */ + assertEqualInt(ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + + /* + * Now, read the data back. + */ + ae = NULL; + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_compression_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, buff, used)); + + /* + * Read and verify first file. + */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + /* Zip doesn't store high-resolution mtime. */ + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file", archive_entry_pathname(ae)); + //assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualIntA(a, 8, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "12345678", 8); + + + /* + * Read the second file back. + */ + if (!assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae))){ + free(buff); + return; + } + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file2", archive_entry_pathname(ae)); + //assert((S_IFREG | 0755) == archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualIntA(a, 4, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "1234", 4); + + /* + * Read the dir entry back. + */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(11, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("dir/", archive_entry_pathname(ae)); + //assertEqualInt((S_IFDIR | 0755), archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualIntA(a, 0, archive_read_data(a, filedata, 10)); + + /* Verify the end of the archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_finish(a)); + free(buff); +} diff --git a/lib/libarchive/test/test_write_format_zip_empty.c b/lib/libarchive/test/test_write_format_zip_empty.c new file mode 100644 index 000000000000..ef90b8d96551 --- /dev/null +++ b/lib/libarchive/test/test_write_format_zip_empty.c @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2008 Anselm Strauss + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Development supported by Google Summer of Code 2008. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_write_format_zip_empty) +{ + struct archive *a; + char buff[256]; + size_t used; + + /* Zip format: Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertA(0 == archive_write_set_format_zip(a)); + assertA(0 == archive_write_set_compression_none(a)); + assertA(0 == archive_write_set_bytes_per_block(a, 1)); + assertA(0 == archive_write_set_bytes_in_last_block(a, 1)); + assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used)); + + /* Close out the archive without writing anything. */ + assertA(0 == archive_write_close(a)); + assertA(0 == archive_write_finish(a)); + + /* Verify the correct format for an empy Zip archive. */ + assertEqualInt(used, 22); + assertEqualMem(buff, + "PK\005\006\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", + 22); +} diff --git a/lib/libarchive/test/test_write_format_zip_no_compression.c b/lib/libarchive/test/test_write_format_zip_no_compression.c new file mode 100644 index 000000000000..63e76b670387 --- /dev/null +++ b/lib/libarchive/test/test_write_format_zip_no_compression.c @@ -0,0 +1,304 @@ +/*- + * Copyright (c) 2008 Anselm Strauss + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Development supported by Google Summer of Code 2008. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +static unsigned long +bitcrc32(unsigned long c, void *_p, size_t s) +{ + /* This is a drop-in replacement for crc32() from zlib. + * Libarchive should be able to correctly generate + * uncompressed zip archives (including correct CRCs) even + * when zlib is unavailable, and this function helps us verify + * that. Yes, this is very, very slow and unsuitable for + * production use, but it's correct, compact, and works well + * enough for this particular usage. Libarchive internally + * uses a much more efficient implementation. */ + const unsigned char *p = _p; + int bitctr; + + if (p == NULL) + return (0); + + for (; s > 0; --s) { + c ^= *p++; + for (bitctr = 8; bitctr > 0; --bitctr) { + if (c & 1) c = (c >> 1); + else c = (c >> 1) ^ 0xedb88320; + c ^= 0x80000000; + } + } + return (c); +} + +/* Quick and dirty: Read 2-byte and 4-byte integers from Zip file. */ +static int i2(const char *p) { return ((p[0] & 0xff) | ((p[1] & 0xff) << 8)); } +static int i4(const char *p) { return (i2(p) | (i2(p + 2) << 16)); } + +DEFINE_TEST(test_write_format_zip_no_compression) +{ + /* Buffer data */ + struct archive *a; + struct archive_entry *entry; + char buff[100000]; + const char *buffend; + /* p is the pointer to walk over the central directory, + * q walks over the local headers, the data and the data descriptors. */ + const char *p, *q; + size_t used; + + /* File data */ + char file_name[] = "file"; + char file_data1[] = {'1', '2', '3', '4', '5'}; + char file_data2[] = {'6', '7', '8', '9', '0'}; + int file_perm = 00644; + short file_uid = 10; + short file_gid = 20; + + /* Folder data */ + char folder_name[] = "folder/"; + int folder_perm = 00755; + short folder_uid = 30; + short folder_gid = 40; + + /* Time data */ + time_t t = time(NULL); + struct tm *tm = localtime(&t); + + /* Misc variables */ + unsigned long crc; + + /* Create new ZIP archive in memory without padding. */ + assert((a = archive_write_new()) != NULL); + assertA(0 == archive_write_set_format_zip(a)); + assertA(0 == archive_write_set_format_options(a, "zip:compression=store")); + assertA(0 == archive_write_set_compression_none(a)); + assertA(0 == archive_write_set_bytes_per_block(a, 1)); + assertA(0 == archive_write_set_bytes_in_last_block(a, 1)); + assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used)); + + /* Write entries. */ + + /* Regular file */ + assert((entry = archive_entry_new()) != NULL); + archive_entry_set_pathname(entry, file_name); + archive_entry_set_mode(entry, S_IFREG | 0644); + archive_entry_set_size(entry, sizeof(file_data1) + sizeof(file_data2)); + archive_entry_set_uid(entry, file_uid); + archive_entry_set_gid(entry, file_gid); + archive_entry_set_mtime(entry, t, 0); + archive_entry_set_atime(entry, t, 0); + archive_entry_set_ctime(entry, t, 0); + assertEqualIntA(a, 0, archive_write_header(a, entry)); + assertEqualIntA(a, sizeof(file_data1), archive_write_data(a, file_data1, sizeof(file_data1))); + assertEqualIntA(a, sizeof(file_data2), archive_write_data(a, file_data2, sizeof(file_data2))); + archive_entry_free(entry); + + /* Folder */ + assert((entry = archive_entry_new()) != NULL); + archive_entry_set_pathname(entry, folder_name); + archive_entry_set_mode(entry, S_IFDIR | folder_perm); + archive_entry_set_size(entry, 0); + archive_entry_set_uid(entry, folder_uid); + archive_entry_set_gid(entry, folder_gid); + archive_entry_set_mtime(entry, t, 0); + archive_entry_set_atime(entry, t, 0); + archive_entry_set_ctime(entry, t, 0); + assertEqualIntA(a, 0, archive_write_header(a, entry)); + archive_entry_free(entry); + + /* Close the archive . */ + assertA(0 == archive_write_close(a)); + assertA(0 == archive_write_finish(a)); + + /* Remember the end of the archive in memory. */ + buffend = buff + used; + + /* Verify "End of Central Directory" record. */ + /* Get address of end-of-central-directory record. */ + p = buffend - 22; /* Assumes there is no zip comment field. */ + failure("End-of-central-directory begins with PK\\005\\006 signature"); + assertEqualMem(p, "PK\005\006", 4); + failure("This must be disk 0"); + assertEqualInt(i2(p + 4), 0); + failure("Central dir must start on disk 0"); + assertEqualInt(i2(p + 6), 0); + failure("All central dir entries are on this disk"); + assertEqualInt(i2(p + 8), i2(p + 10)); + failure("CD start (%d) + CD length (%d) should == archive size - 22", + i4(p + 12), i4(p + 16)); + assertEqualInt(i4(p + 12) + i4(p + 16), used - 22); + failure("no zip comment"); + assertEqualInt(i2(p + 20), 0); + + /* Get address of first entry in central directory. */ + p = buff + i4(buffend - 6); + failure("Central file record at offset %d should begin with" + " PK\\001\\002 signature", + i4(buffend - 10)); + + /* Verify file entry in central directory. */ + assertEqualMem(p, "PK\001\002", 4); /* Signature */ + assertEqualInt(i2(p + 4), 3 * 256 + 20); /* Version made by */ + assertEqualInt(i2(p + 6), 20); /* Version needed to extract */ + assertEqualInt(i2(p + 8), 8); /* Flags */ + assertEqualInt(i2(p + 10), 0); /* Compression method */ + assertEqualInt(i2(p + 12), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ + assertEqualInt(i2(p + 14), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ + crc = bitcrc32(0, file_data1, sizeof(file_data1)); + crc = bitcrc32(crc, file_data2, sizeof(file_data2)); + assertEqualInt(i4(p + 16), crc); /* CRC-32 */ + assertEqualInt(i4(p + 20), sizeof(file_data1) + sizeof(file_data2)); /* Compressed size */ + assertEqualInt(i4(p + 24), sizeof(file_data1) + sizeof(file_data2)); /* Uncompressed size */ + assertEqualInt(i2(p + 28), strlen(file_name)); /* Pathname length */ + assertEqualInt(i2(p + 30), 13); /* Extra field length */ + assertEqualInt(i2(p + 32), 0); /* File comment length */ + assertEqualInt(i2(p + 34), 0); /* Disk number start */ + assertEqualInt(i2(p + 36), 0); /* Internal file attrs */ + assertEqualInt(i4(p + 38) >> 16 & 01777, file_perm); /* External file attrs */ + assertEqualInt(i4(p + 42), 0); /* Offset of local header */ + assertEqualMem(p + 46, file_name, strlen(file_name)); /* Pathname */ + p = p + 46 + strlen(file_name); + assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ + assertEqualInt(i2(p + 2), 5); /* 'UT' size */ + assertEqualInt(p[4], 7); /* 'UT' flags */ + assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ + p = p + 9; + assertEqualInt(i2(p), 0x7855); /* 'Ux' extension header */ + assertEqualInt(i2(p + 2), 0); /* 'Ux' size */ + p = p + 4; + + /* Verify local header of file entry. */ + q = buff; + assertEqualMem(q, "PK\003\004", 4); /* Signature */ + assertEqualInt(i2(q + 4), 20); /* Version needed to extract */ + assertEqualInt(i2(q + 6), 8); /* Flags */ + assertEqualInt(i2(q + 8), 0); /* Compression method */ + assertEqualInt(i2(q + 10), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ + assertEqualInt(i2(q + 12), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ + assertEqualInt(i4(q + 14), 0); /* CRC-32 */ + assertEqualInt(i4(q + 18), sizeof(file_data1) + sizeof(file_data2)); /* Compressed size */ + assertEqualInt(i4(q + 22), sizeof(file_data1) + sizeof(file_data2)); /* Uncompressed size */ + assertEqualInt(i2(q + 26), strlen(file_name)); /* Pathname length */ + assertEqualInt(i2(q + 28), 25); /* Extra field length */ + assertEqualMem(q + 30, file_name, strlen(file_name)); /* Pathname */ + q = q + 30 + strlen(file_name); + assertEqualInt(i2(q), 0x5455); /* 'UT' extension header */ + assertEqualInt(i2(q + 2), 13); /* 'UT' size */ + assertEqualInt(q[4], 7); /* 'UT' flags */ + assertEqualInt(i4(q + 5), t); /* 'UT' mtime */ + assertEqualInt(i4(q + 9), t); /* 'UT' atime */ + assertEqualInt(i4(q + 13), t); /* 'UT' ctime */ + q = q + 17; + assertEqualInt(i2(q), 0x7855); /* 'Ux' extension header */ + assertEqualInt(i2(q + 2), 4); /* 'Ux' size */ + assertEqualInt(i2(q + 4), file_uid); /* 'Ux' UID */ + assertEqualInt(i2(q + 6), file_gid); /* 'Ux' GID */ + q = q + 8; + + /* Verify data of file entry. */ + assertEqualMem(q, file_data1, sizeof(file_data1)); + assertEqualMem(q + sizeof(file_data1), file_data2, sizeof(file_data2)); + q = q + sizeof(file_data1) + sizeof(file_data2); + + /* Verify data descriptor of file entry. */ + assertEqualMem(q, "PK\007\010", 4); /* Signature */ + assertEqualInt(i4(q + 4), crc); /* CRC-32 */ + assertEqualInt(i4(q + 8), sizeof(file_data1) + sizeof(file_data2)); /* Compressed size */ + assertEqualInt(i4(q + 12), sizeof(file_data1) + sizeof(file_data2)); /* Uncompressed size */ + q = q + 16; + + /* Verify folder entry in central directory. */ + assertEqualMem(p, "PK\001\002", 4); /* Signature */ + assertEqualInt(i2(p + 4), 3 * 256 + 20); /* Version made by */ + assertEqualInt(i2(p + 6), 20); /* Version needed to extract */ + assertEqualInt(i2(p + 8), 8); /* Flags */ + assertEqualInt(i2(p + 10), 0); /* Compression method */ + assertEqualInt(i2(p + 12), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ + assertEqualInt(i2(p + 14), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ + crc = 0; + assertEqualInt(i4(p + 16), crc); /* CRC-32 */ + assertEqualInt(i4(p + 20), 0); /* Compressed size */ + assertEqualInt(i4(p + 24), 0); /* Uncompressed size */ + assertEqualInt(i2(p + 28), strlen(folder_name)); /* Pathname length */ + assertEqualInt(i2(p + 30), 13); /* Extra field length */ + assertEqualInt(i2(p + 32), 0); /* File comment length */ + assertEqualInt(i2(p + 34), 0); /* Disk number start */ + assertEqualInt(i2(p + 36), 0); /* Internal file attrs */ + assertEqualInt(i4(p + 38) >> 16 & 01777, folder_perm); /* External file attrs */ + assertEqualInt(i4(p + 42), q - buff); /* Offset of local header */ + assertEqualMem(p + 46, folder_name, strlen(folder_name)); /* Pathname */ + p = p + 46 + strlen(folder_name); + assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ + assertEqualInt(i2(p + 2), 5); /* 'UT' size */ + assertEqualInt(p[4], 7); /* 'UT' flags */ + assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ + p = p + 9; + assertEqualInt(i2(p), 0x7855); /* 'Ux' extension header */ + assertEqualInt(i2(p + 2), 0); /* 'Ux' size */ + p = p + 4; + + /* Verify local header of folder entry. */ + assertEqualMem(q, "PK\003\004", 4); /* Signature */ + assertEqualInt(i2(q + 4), 20); /* Version needed to extract */ + assertEqualInt(i2(q + 6), 8); /* Flags */ + assertEqualInt(i2(q + 8), 0); /* Compression method */ + assertEqualInt(i2(q + 10), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ + assertEqualInt(i2(q + 12), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ + assertEqualInt(i4(q + 14), 0); /* CRC-32 */ + assertEqualInt(i4(q + 18), 0); /* Compressed size */ + assertEqualInt(i4(q + 22), 0); /* Uncompressed size */ + assertEqualInt(i2(q + 26), strlen(folder_name)); /* Pathname length */ + assertEqualInt(i2(q + 28), 25); /* Extra field length */ + assertEqualMem(q + 30, folder_name, strlen(folder_name)); /* Pathname */ + q = q + 30 + strlen(folder_name); + assertEqualInt(i2(q), 0x5455); /* 'UT' extension header */ + assertEqualInt(i2(q + 2), 13); /* 'UT' size */ + assertEqualInt(q[4], 7); /* 'UT' flags */ + assertEqualInt(i4(q + 5), t); /* 'UT' mtime */ + assertEqualInt(i4(q + 9), t); /* 'UT' atime */ + assertEqualInt(i4(q + 13), t); /* 'UT' ctime */ + q = q + 17; + assertEqualInt(i2(q), 0x7855); /* 'Ux' extension header */ + assertEqualInt(i2(q + 2), 4); /* 'Ux' size */ + assertEqualInt(i2(q + 4), folder_uid); /* 'Ux' UID */ + assertEqualInt(i2(q + 6), folder_gid); /* 'Ux' GID */ + q = q + 8; + + /* There should not be any data in the folder entry, + * meaning next is the data descriptor header. */ + + /* Verify data descriptor of folder entry. */ + assertEqualMem(q, "PK\007\010", 4); /* Signature */ + assertEqualInt(i4(q + 4), crc); /* CRC-32 */ + assertEqualInt(i4(q + 8), 0); /* Compressed size */ + assertEqualInt(i4(q + 12), 0); /* Uncompressed size */ + q = q + 16; +}