From: Tim Kientzle Date: Thu, 6 Aug 2009 03:21:38 +0000 (-0400) Subject: Update some more cpio tests to use new file assertions. X-Git-Tag: v2.8.0~448 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b46739cb873f63ac30c570bef1468e7632f6b2f0;p=thirdparty%2Flibarchive.git Update some more cpio tests to use new file assertions. SVN-Revision: 1340 --- diff --git a/cpio/test/test_passthrough_dotdot.c b/cpio/test/test_passthrough_dotdot.c index 72f8562e3..bb04341a4 100644 --- a/cpio/test/test_passthrough_dotdot.c +++ b/cpio/test/test_passthrough_dotdot.c @@ -31,7 +31,6 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_dotdot.c,v 1.4 2008/0 DEFINE_TEST(test_passthrough_dotdot) { - struct stat st; int r; FILE *filelist; @@ -71,17 +70,7 @@ DEFINE_TEST(test_passthrough_dotdot) assertEmptyFile("stdout"); /* Regular file. */ - r = lstat("file", &st); - failure("Failed to stat file, errno=%d", errno); - 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(0642, st.st_mode & 0777); -#endif - assertEqualInt(10, st.st_size); - assertEqualInt(1, st.st_nlink); - } + assertIsReg("file", 0642); + assertFileSize("file", 10); + assertFileNLinks("file", 1); } diff --git a/cpio/test/test_passthrough_reverse.c b/cpio/test/test_passthrough_reverse.c index 8a4a5193e..674e52bc0 100644 --- a/cpio/test/test_passthrough_reverse.c +++ b/cpio/test/test_passthrough_reverse.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_passthrough_reverse.c,v 1.2 2008/ DEFINE_TEST(test_passthrough_reverse) { - struct stat st; int r; FILE *filelist; @@ -76,31 +75,11 @@ DEFINE_TEST(test_passthrough_reverse) assertEmptyFile("../stdout"); /* dir */ - r = lstat("dir", &st); - if (r == 0) { - assertEqualInt(r, 0); - assert(S_ISDIR(st.st_mode)); - failure("st.st_mode=0%o", st.st_mode); -#if defined(_WIN32) && !defined(__CYGWIN__) - assertEqualInt(0700, st.st_mode & 0700); -#else - assertEqualInt(0743, st.st_mode & 0777); -#endif - } + assertIsDir("dir", 0743); /* Regular file. */ - r = lstat("dir/file", &st); - failure("Failed to stat dir/file, errno=%d", errno); - 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 - assertEqualInt(10, st.st_size); - assertEqualInt(1, st.st_nlink); - } + assertIsReg("dir/file", 0644); + assertFileSize("dir/file", 10); + assertFileNLinks("dir/file", 1); }