X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=tests%2Ftree-cmp.c;h=4b70a8308277c5aa15a3055064a79293e5656fec;hp=aed6ecb18358fb779bc833bcca91f7354f3c13e9;hb=e8db2c80ad428c536de564c9c29e1dc2893cafcb;hpb=d0e7f039e4ab206b9fd973c983e3fb841fcd2bf2 diff --git a/tests/tree-cmp.c b/tests/tree-cmp.c index aed6ecb1..4b70a830 100644 --- a/tests/tree-cmp.c +++ b/tests/tree-cmp.c @@ -4,7 +4,7 @@ * There are two modes: * - Normal mode for any filesystems. We compare file names, contents, * sizes, modes, access times, and hard links. - * - NTFS mode for NTFS-3g mounted volumes. In this mode we need to + * - NTFS mode for NTFS-3G mounted volumes. In this mode we need to * compare various NTFS-specific attributes such as named data streams * and DOS names. * @@ -13,6 +13,9 @@ * files are expected to be hard linked together in the other directory tree. */ +#include "config.h" + + #include #include #include @@ -24,9 +27,16 @@ #include #include #include -#include +#include +#ifdef HAVE_SYS_XATTR_H +# include +#endif #include +#ifndef ENOATTR +# define ENOATTR ENODATA +#endif + typedef uint64_t u64; #if 0 @@ -160,6 +170,7 @@ static void cmp(const char *file1, const char *file2, size_t size) close(fd2); } +#ifdef HAVE_SYS_XATTR_H /* Compares an extended attribute of the files. */ static void cmp_xattr(const char *file1, const char *file2, const char *xattr_name, ssize_t max_size, @@ -264,17 +275,25 @@ static void cmp_ads(const char *file1, const char *file2) free(list2); } } +#endif /* HAVE_SYS_XATTR_H */ /* Compares special NTFS data of the files, as accessed through extended * attributes. */ static void special_cmp(const char *file1, const char *file2) { +#ifdef HAVE_SYS_XATTR_H cmp_xattr(file1, file2, "system.ntfs_acl", 0, false); cmp_xattr(file1, file2, "system.ntfs_attrib", 0, false); cmp_xattr(file1, file2, "system.ntfs_dos_name", 0, true); + cmp_xattr(file1, file2, "system.ntfs_object_id", 64, true); cmp_xattr(file1, file2, "system.ntfs_reparse_data", 0, true); cmp_xattr(file1, file2, "system.ntfs_times", 16, false); cmp_ads(file1, file2); +#else + fprintf(stderr, "tree-cmp: Warning: cannot compare xattrs of `%s' and `%s'\n", + file1, file2); + fprintf(stderr, " Extended attributes are not supported on this platform.\n"); +#endif } @@ -302,18 +321,16 @@ static void tree_cmp(char file1[], int file1_len, char file2[], int file2_len) if (S_ISREG(st1.st_mode) && st1.st_size != st2.st_size) difference("Sizes of `%s' and `%s' are not the same", file1, file2); +#if 0 if (ntfs_mode && st1.st_atime != st2.st_atime) - difference("Access times of `%s' and `%s' are not the same", - file1, file2); + difference("Access times of `%s' (%x) and `%s' (%x) are " + "not the same", + file1, st1.st_atime, file2, st2.st_atime); +#endif if (st1.st_mtime != st2.st_mtime) difference("Modification times of `%s' (%x) and `%s' (%x) are " "not the same", file1, st1.st_mtime, file2, st2.st_mtime); -#if 0 - if (st1.st_ctime != st2.st_ctime) - difference("Status change times of `%s' and `%s' are not the same", - file1, file2); -#endif if ((ntfs_mode || S_ISREG(st1.st_mode)) && st1.st_nlink != st2.st_nlink) difference("Link count of `%s' (%u) and `%s' (%u) " "are not the same",