test_read_disk.c (302408) | test_read_disk.c (315432) |
---|---|
1/*- 2 * Copyright (c) 2003-2009 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25#include "test.h" | 1/*- 2 * Copyright (c) 2003-2009 Tim Kientzle 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 */ 25#include "test.h" |
26__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_read_disk.c 248616 2013-03-22 13:36:03Z mm $"); | 26__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/test/test_read_disk.c 315432 2017-03-16 23:07:35Z mm $"); |
27 28static void 29gname_cleanup(void *d) 30{ 31 int *mp = d; 32 assertEqualInt(*mp, 0x13579); 33 *mp = 0x2468; 34} --- 21 unchanged lines hidden (view full) --- 56{ 57 int *mp = d; 58 assertEqualInt(*mp, 0x1234); 59 if (u == 1) 60 return ("FOO"); 61 return ("NOTFOO"); 62} 63 | 27 28static void 29gname_cleanup(void *d) 30{ 31 int *mp = d; 32 assertEqualInt(*mp, 0x13579); 33 *mp = 0x2468; 34} --- 21 unchanged lines hidden (view full) --- 56{ 57 int *mp = d; 58 assertEqualInt(*mp, 0x1234); 59 if (u == 1) 60 return ("FOO"); 61 return ("NOTFOO"); 62} 63 |
64#if !defined(__CYGWIN__) && !defined(__HAIKU__) |
|
64/* We test GID lookup by looking up the name of group number zero and 65 * checking it against the following list. If your system uses a 66 * different conventional name for group number zero, please extend 67 * this array and send us a patch. As always, please keep this list 68 * sorted alphabetically. 69 */ 70static const char *zero_groups[] = { 71 "root", /* Linux */ 72 "wheel" /* BSD */ 73}; | 65/* We test GID lookup by looking up the name of group number zero and 66 * checking it against the following list. If your system uses a 67 * different conventional name for group number zero, please extend 68 * this array and send us a patch. As always, please keep this list 69 * sorted alphabetically. 70 */ 71static const char *zero_groups[] = { 72 "root", /* Linux */ 73 "wheel" /* BSD */ 74}; |
75#endif |
|
74 75DEFINE_TEST(test_read_disk) 76{ 77 struct archive *a; 78 int gmagic = 0x13579, umagic = 0x1234; | 76 77DEFINE_TEST(test_read_disk) 78{ 79 struct archive *a; 80 int gmagic = 0x13579, umagic = 0x1234; |
81#if !defined(__CYGWIN__) && !defined(__HAIKU__) |
|
79 const char *p; 80 size_t i; | 82 const char *p; 83 size_t i; |
84#endif |
|
81 82 assert((a = archive_read_disk_new()) != NULL); 83 84 /* Default uname/gname lookups always return NULL. */ 85 assert(archive_read_disk_gname(a, 0) == NULL); 86 assert(archive_read_disk_uname(a, 0) == NULL); 87 88 /* Register some weird lookup functions. */ --- 21 unchanged lines hidden (view full) --- 110 /* Try the standard lookup functions. */ 111 if (archive_read_disk_set_standard_lookup(a) != ARCHIVE_OK) { 112 skipping("standard uname/gname lookup"); 113 } else { 114#if defined(__CYGWIN__) || defined(__HAIKU__) 115 /* Some platforms don't have predictable names for 116 * uid=0, so we skip this part of the test. */ 117 skipping("standard uname/gname lookup"); | 85 86 assert((a = archive_read_disk_new()) != NULL); 87 88 /* Default uname/gname lookups always return NULL. */ 89 assert(archive_read_disk_gname(a, 0) == NULL); 90 assert(archive_read_disk_uname(a, 0) == NULL); 91 92 /* Register some weird lookup functions. */ --- 21 unchanged lines hidden (view full) --- 114 /* Try the standard lookup functions. */ 115 if (archive_read_disk_set_standard_lookup(a) != ARCHIVE_OK) { 116 skipping("standard uname/gname lookup"); 117 } else { 118#if defined(__CYGWIN__) || defined(__HAIKU__) 119 /* Some platforms don't have predictable names for 120 * uid=0, so we skip this part of the test. */ 121 skipping("standard uname/gname lookup"); |
118 i = 0; 119 p = zero_groups[0]; /* avoid unused warnings */ | |
120#else 121 /* XXX Someday, we may need to generalize this the 122 * same way we generalized the group name check below. 123 * That's needed only if we encounter a system where 124 * uid 0 is not "root". XXX */ 125 assertEqualString(archive_read_disk_uname(a, 0), "root"); 126 127 /* Get the group name for group 0 and see if it makes sense. */ --- 46 unchanged lines hidden --- | 122#else 123 /* XXX Someday, we may need to generalize this the 124 * same way we generalized the group name check below. 125 * That's needed only if we encounter a system where 126 * uid 0 is not "root". XXX */ 127 assertEqualString(archive_read_disk_uname(a, 0), "root"); 128 129 /* Get the group name for group 0 and see if it makes sense. */ --- 46 unchanged lines hidden --- |