diff options
author | mm <mm@FreeBSD.org> | 2012-02-08 12:53:14 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2012-02-08 12:53:14 +0000 |
commit | 2f6e434fe4c652da1969314fa57ae21936cec85d (patch) | |
tree | 28a8e9d81eb7ed48e286dfc384e2e0ffccc238b5 /cpio/test/test_basic.c | |
parent | 5ae64fdbb237eec1fbe1362330190b974b1a1061 (diff) | |
download | FreeBSD-src-2f6e434fe4c652da1969314fa57ae21936cec85d.zip FreeBSD-src-2f6e434fe4c652da1969314fa57ae21936cec85d.tar.gz |
Update vendor libarchive dist to new "release" branch (post 3.0.3)
Git branch: release
Git commit: 9af87742342aa4f37a22ec12c4cc1c82e00ffa2f
Obtained from: https://github.com/libarchive/libarchive.git
Diffstat (limited to 'cpio/test/test_basic.c')
-rw-r--r-- | cpio/test/test_basic.c | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/cpio/test/test_basic.c b/cpio/test/test_basic.c index 852b069..c40813e 100644 --- a/cpio/test/test_basic.c +++ b/cpio/test/test_basic.c @@ -33,12 +33,15 @@ verify_files(const char *msg) */ /* Regular file with 2 links. */ + failure(msg); assertIsReg("file", 0644); failure(msg); assertFileSize("file", 10); + failure(msg); assertFileNLinks("file", 2); /* Another name for the same file. */ + failure(msg); assertIsHardlink("linkfile", "file"); /* Symlink */ @@ -46,8 +49,11 @@ verify_files(const char *msg) assertIsSymlink("symlink", "file"); /* Another file with 1 link and different permissions. */ + failure(msg); assertIsReg("file2", 0777); + failure(msg); assertFileSize("file2", 10); + failure(msg); assertFileNLinks("file2", 1); /* dir */ @@ -58,7 +64,7 @@ static void basic_cpio(const char *target, const char *pack_options, const char *unpack_options, - const char *se) + const char *se, const char *se2) { int r; @@ -87,7 +93,7 @@ basic_cpio(const char *target, /* Verify stderr. */ failure("Error invoking %s -i %s in dir %s", testprog, unpack_options, target); - assertTextFileContents(se, "unpack.err"); + assertTextFileContents(se2, "unpack.err"); verify_files(pack_options); @@ -125,6 +131,7 @@ DEFINE_TEST(test_basic) { FILE *filelist; const char *msg; + char result[1024]; assertUmask(0); @@ -132,28 +139,56 @@ DEFINE_TEST(test_basic) * Create an assortment of files on disk. */ filelist = fopen("filelist", "w"); + memset(result, 0, sizeof(result)); /* File with 10 bytes content. */ assertMakeFile("file", 0644, "1234567890"); fprintf(filelist, "file\n"); + if (is_LargeInode("file")) + strncat(result, + "bsdcpio: file: large inode number truncated: " + "Numerical result out of range\n", + sizeof(result) - strlen(result)); /* hardlink to above file. */ assertMakeHardlink("linkfile", "file"); fprintf(filelist, "linkfile\n"); + if (is_LargeInode("linkfile")) + strncat(result, + "bsdcpio: linkfile: large inode number truncated: " + "Numerical result out of range\n", + sizeof(result) - strlen(result)); /* Symlink to above file. */ if (canSymlink()) { assertMakeSymlink("symlink", "file"); fprintf(filelist, "symlink\n"); + if (is_LargeInode("symlink")) + strncat(result, + "bsdcpio: symlink: large inode number truncated: " + "Numerical result out of range\n", + sizeof(result) - strlen(result)); } /* Another file with different permissions. */ assertMakeFile("file2", 0777, "1234567890"); fprintf(filelist, "file2\n"); + if (is_LargeInode("file2")) + strncat(result, + "bsdcpio: file2: large inode number truncated: " + "Numerical result out of range\n", + sizeof(result) - strlen(result)); /* Directory. */ assertMakeDir("dir", 0775); fprintf(filelist, "dir\n"); + if (is_LargeInode("dir")) + strncat(result, + "bsdcpio: dir: large inode number truncated: " + "Numerical result out of range\n", + sizeof(result) - strlen(result)); + strncat(result, "2 blocks\n", sizeof(result) - strlen(result)); + /* All done. */ fclose(filelist); @@ -161,12 +196,12 @@ DEFINE_TEST(test_basic) /* Archive/dearchive with a variety of options. */ msg = canSymlink() ? "2 blocks\n" : "1 block\n"; - basic_cpio("copy", "", "", msg); - basic_cpio("copy_odc", "--format=odc", "", msg); - basic_cpio("copy_newc", "-H newc", "", "2 blocks\n"); - basic_cpio("copy_cpio", "-H odc", "", msg); + basic_cpio("copy", "", "", msg, msg); + basic_cpio("copy_odc", "--format=odc", "", msg, msg); + basic_cpio("copy_newc", "-H newc", "", result, "2 blocks\n"); + basic_cpio("copy_cpio", "-H odc", "", msg, msg); msg = canSymlink() ? "9 blocks\n" : "8 blocks\n"; - basic_cpio("copy_ustar", "-H ustar", "", msg); + basic_cpio("copy_ustar", "-H ustar", "", msg, msg); /* Copy in one step using -p */ passthrough("passthrough"); |