diff options
author | kientzle <kientzle@FreeBSD.org> | 2009-04-17 04:04:57 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2009-04-17 04:04:57 +0000 |
commit | 5853643ce6ecab17fd51492c41fe5a44599637b2 (patch) | |
tree | 71b1033c9249ea051e5e93acaad8389233a40909 /usr.bin/cpio/test/test_gcpio_compat.c | |
parent | 4e8cb50d8bef897f785cb884230eb42be06c0541 (diff) | |
download | FreeBSD-src-5853643ce6ecab17fd51492c41fe5a44599637b2.zip FreeBSD-src-5853643ce6ecab17fd51492c41fe5a44599637b2.tar.gz |
Merge from libarchive.googlecode.com:
* Lots of new tests.
* New -n / --numeric-uid-gid option
* More sanity-checking of arguments
* Various Windows portability improvements
* Sync up version number to 2.7.0
Diffstat (limited to 'usr.bin/cpio/test/test_gcpio_compat.c')
-rw-r--r-- | usr.bin/cpio/test/test_gcpio_compat.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.bin/cpio/test/test_gcpio_compat.c b/usr.bin/cpio/test/test_gcpio_compat.c index 4b97c82..767719b 100644 --- a/usr.bin/cpio/test/test_gcpio_compat.c +++ b/usr.bin/cpio/test/test_gcpio_compat.c @@ -25,12 +25,13 @@ #include "test.h" __FBSDID("$FreeBSD$"); - static void unpack_test(const char *from, const char *options, const char *se) { struct stat st, st2; +#if !defined(_WIN32) || defined(__CYGWIN__) char buff[128]; +#endif int r; /* Create a work dir named after the file we're unpacking. */ @@ -49,7 +50,7 @@ unpack_test(const char *from, const char *options, const char *se) /* Verify that nothing went to stderr. */ failure("Error invoking %s -i %s < %s", testprog, options, from); - assertFileContents(se, strlen(se), "unpack.err"); + assertTextFileContents(se, "unpack.err"); /* * Verify unpacked files. @@ -61,7 +62,11 @@ unpack_test(const char *from, const char *options, const char *se) assertEqualInt(r, 0); if (r == 0) { assert(S_ISREG(st.st_mode)); +#if defined(_WIN32) && !defined(__CYGWIN__) + assertEqualInt(0600, st.st_mode & 0700); +#else assertEqualInt(0644, st.st_mode & 0777); +#endif failure("file %s/file", from); assertEqualInt(10, st.st_size); failure("file %s/file", from); @@ -74,7 +79,11 @@ unpack_test(const char *from, const char *options, const char *se) assertEqualInt(r, 0); if (r == 0) { assert(S_ISREG(st2.st_mode)); +#if defined(_WIN32) && !defined(__CYGWIN__) + assertEqualInt(0600, st2.st_mode & 0700); +#else assertEqualInt(0644, st2.st_mode & 0777); +#endif failure("file %s/file", from); assertEqualInt(10, st2.st_size); failure("file %s/file", from); @@ -89,6 +98,7 @@ unpack_test(const char *from, const char *options, const char *se) r = lstat("symlink", &st); failure("Failed to stat file %s/symlink, errno=%d", from, errno); assertEqualInt(r, 0); +#if !defined(_WIN32) || defined(__CYGWIN__) if (r == 0) { failure("symlink should be a symlink; actual mode is %o", st.st_mode); @@ -100,13 +110,18 @@ unpack_test(const char *from, const char *options, const char *se) assertEqualString(buff, "file"); } } +#endif /* dir */ r = lstat("dir", &st); if (r == 0) { assertEqualInt(r, 0); assert(S_ISDIR(st.st_mode)); +#if defined(_WIN32) && !defined(__CYGWIN__) + assertEqualInt(0700, st.st_mode & 0700); +#else assertEqualInt(0775, st.st_mode & 0777); +#endif } chdir(".."); |