const char *pathname, const char *contents)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
+ // TODO: Vista supports symlinks
+ ++failures;
+ if (!previous_failures(file, line, 1)) {
+ fprintf(stderr, "%s:%d: Symlink ``%s'' not supported\n",
+ file, line, pathname);
+ report_failure(NULL);
+ }
return (0);
#else
char buff[300];
#undef HAVE_LIBACL
#define HAVE_LIBARCHIVE 1
#define HAVE_LIMITS_H 1
+#define HAVE_LINK 1
#undef HAVE_LINUX_EXT2_FS_H
#undef HAVE_LINUX_FS_H
#define HAVE_LOCALE_H 1
#endif
#define HAVE_PATHS_H 1
#define HAVE_PWD_H 1
+#define HAVE_READLINK 1
#define HAVE_REGEX_H 1
#define HAVE_SETLOCALE 1
#define HAVE_SIGNAL_H 1
#undef HAVE_STRUCT_STAT_ST_MTIME_USEC
#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
#undef HAVE_STRUCT_STAT_ST_UMTIME
+#define HAVE_SYMLINK 1
#undef HAVE_SYS_DIR_H
#define HAVE_SYS_IOCTL_H 1
#undef HAVE_SYS_NDIR_H
#define S_ISREG(m) ((m) & _S_IFREG)
#endif
#define access _access
+#define chdir _chdir
#ifndef fileno
#define fileno _fileno
#endif
test_filename, test_line);
fprintf(stderr, " file=\"%s\"\n", fn);
if (n > 0)
- hexdump(contents, buff, n, 0);
+ hexdump(contents, buff, n > 512 ? 512 : 0, 0);
else {
fprintf(stderr, " File empty, contents should be:\n");
- hexdump(buff, NULL, s, 0);
+ hexdump(buff, NULL, s > 512 ? 512 : 0, 0);
}
report_failure(test_extra);
}
count_assertion(file, line);
r = lstat(pathname, &st);
- if (r != 0 || !S_ISDIR(st.st_mode)) {
+ if (r != 0) {
++failures;
if (!previous_failures(file, line, 1)) {
fprintf(stderr, "%s:%d: Dir ``%s'' doesn't exist\n",
}
return (0);
}
- if (mode < 0)
+ if (!S_ISDIR(st.st_mode)) {
+ ++failures;
+ if (!previous_failures(file, line, 1)) {
+ fprintf(stderr, "%s:%d: ``%s'' is not a dir\n",
+ file, line, pathname);
+ report_failure(NULL);
+ }
+ return (0);
+ }
+ if (mode < 0) {
+ msg[0] = '\0';
return (1);
+ }
if (mode != (st.st_mode & 07777)) {
++failures;
if (!previous_failures(file, line, 1)) {
}
return (0);
}
+ msg[0] = '\0';
return (1);
}
int
-test_assert_is_link(const char *file, int line,
+test_assert_is_symlink(const char *file, int line,
const char *pathname, const char *contents)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
int
test_assert_make_symlink(const char *file, int line,
- const char *newpath, const char *linkto)
+ const char *newpath, const char *linkto)
{
int succeeded;
test_setup(__FILE__, __LINE__);test_assert_text_file_contents
#define assertIsDir(pathname, mode) \
test_assert_is_dir(__FILE__, __LINE__, pathname, mode)
-#define assertIsLink(pathname, contents) \
- test_assert_is_link(__FILE__, __LINE__, pathname, contents)
#define assertIsReg(pathname, mode) \
test_assert_is_reg(__FILE__, __LINE__, pathname, mode)
+#define assertIsSymlink(pathname, contents) \
+ test_assert_is_symlink(__FILE__, __LINE__, pathname, contents)
/* Create a directory, report error if it fails. */
#define assertMakeDir(dirname, mode) \
test_assert_make_dir(__FILE__, __LINE__, dirname, mode)
int test_assert_file_nlinks(const char *, int, const char *, int);
int test_assert_file_size(const char *, int, const char *, long);
int test_assert_is_dir(const char *, int, const char *, int);
-int test_assert_is_link(const char *, int, const char *, const char *);
int test_assert_is_reg(const char *, int, const char *, int);
+int test_assert_is_symlink(const char *, int, const char *, const char *);
int test_assert_make_dir(const char *, int, const char *, int);
int test_assert_make_hardlink(const char *, int, const char *newpath, const char *);
int test_assert_make_symlink(const char *, int, const char *newpath, const char *);
#if !defined(_WIN32) || defined(__CYGWIN__)
/* Symlink */
- assertIsLink("symlink", "file");
+ assertIsSymlink("symlink", "file");
#endif
/* dir */
strcpy(name2, "../f/");
strcat(name2, filename);
if (limit != LIMIT_USTAR || strlen(name2) <= 100)
- assertIsLink(name1, name2);
+ assertIsSymlink(name1, name2);
#else
skipping("verify symlink");
#endif
failure("d0/d1/s2 is a symlink to something that won't be extracted");
#if !defined(_WIN32) || defined(__CYGWIN__)
assertFileNotExists("target/s2");
- assertIsLink("target/s2", "d2/f1");
+ assertIsSymlink("target/s2", "d2/f1");
#else
skipping("symlink");
#endif