]> wimlib.net Git - wimlib/commitdiff
wlfuzz: compare timestamps
authorEric Biggers <ebiggers3@gmail.com>
Wed, 19 Apr 2017 06:58:03 +0000 (23:58 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Wed, 19 Apr 2017 07:17:01 +0000 (00:17 -0700)
src/test_support.c

index b8a6aa81b5828101e22641ac366b03a312d66d70..4df34d4cc8a8f06278313ddac92da82333121ecf 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 /*
  */
 
 /*
- * Copyright (C) 2015-2016 Eric Biggers
+ * Copyright (C) 2015-2017 Eric Biggers
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
  *
  * This file is free software; you can redistribute it and/or modify it under
  * the terms of the GNU Lesser General Public License as published by the Free
@@ -1518,6 +1518,32 @@ cmp_linux_xattrs(const struct wim_inode *inode1,
        }
 }
 
        }
 }
 
+static int
+cmp_timestamps(const struct wim_inode *inode1, const struct wim_inode *inode2,
+              int cmp_flags)
+{
+       if (inode1->i_creation_time != inode2->i_creation_time &&
+           !(cmp_flags & WIMLIB_CMP_FLAG_UNIX_MODE)) {
+               ERROR("Creation time of %"TS" differs",
+                     inode_any_full_path(inode1));
+               return WIMLIB_ERR_IMAGES_ARE_DIFFERENT;
+       }
+
+       if (inode1->i_last_write_time != inode2->i_last_write_time) {
+               ERROR("Last write time of %"TS" differs",
+                     inode_any_full_path(inode1));
+               return WIMLIB_ERR_IMAGES_ARE_DIFFERENT;
+       }
+
+       if (inode1->i_last_access_time != inode2->i_last_access_time) {
+               ERROR("Last access time of %"TS" differs",
+                     inode_any_full_path(inode1));
+               return WIMLIB_ERR_IMAGES_ARE_DIFFERENT;
+       }
+
+       return 0;
+}
+
 static int
 cmp_inodes(const struct wim_inode *inode1, const struct wim_inode *inode2,
           const struct wim_image_metadata *imd1,
 static int
 cmp_inodes(const struct wim_inode *inode1, const struct wim_inode *inode2,
           const struct wim_image_metadata *imd1,
@@ -1598,6 +1624,11 @@ cmp_inodes(const struct wim_inode *inode1, const struct wim_inode *inode2,
        if (ret)
                return ret;
 
        if (ret)
                return ret;
 
+       /* Compare timestamps  */
+       ret = cmp_timestamps(inode1, inode2, cmp_flags);
+       if (ret)
+               return ret;
+
        /* Compare standard UNIX metadata  */
        ret = cmp_unix_metadata(inode1, inode2, cmp_flags);
        if (ret)
        /* Compare standard UNIX metadata  */
        ret = cmp_unix_metadata(inode1, inode2, cmp_flags);
        if (ret)