[strip-nondeterminism] 01/05: t/fixtures.t: Add a lookup table for descriptions of stat(1) indices.
Chris Lamb
chris at chris-lamb.co.uk
Fri Sep 9 09:56:26 UTC 2016
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository strip-nondeterminism.
commit 76d5520c105ec1fef07d5dc45b6142f01470ec6f
Author: Chris Lamb <lamby at debian.org>
Date: Fri Sep 9 10:32:58 2016 +0100
t/fixtures.t: Add a lookup table for descriptions of stat(1) indices.
---
t/fixtures.t | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/t/fixtures.t b/t/fixtures.t
index 777cde3..8102e15 100644
--- a/t/fixtures.t
+++ b/t/fixtures.t
@@ -29,6 +29,23 @@ use File::Temp qw(tempdir);
use File::StripNondeterminism;
use Test::More;
+# perlfunc(1)
+my %STAT = (
+ 0 => "dev (device number of filesystem)",
+ 1 => "ino (inode number)",
+ 2 => "mode (file mode (type and permissions))",
+ 3 => "nlink (number of hard links to the file)",
+ 4 => "uid (numeric user ID of file's owner)",
+ 5 => "gid (numeric group ID of file's owner)",
+ 6 => "rdev (the device identifier; special files only)",
+ # 7 => "size (total size of file, in bytes)",
+ # 8 => "atime (last access time in seconds since the epoch)",
+ # 9 => "mtime (last modified time in seconds since the epoch)",
+ # 10 => "ctime (inode change time in seconds since the epoch)",
+ 11 => "blksize (preferred I/O size in bytes for interacting with the file)",
+ 12 => "blocks (actual number of system-specific blocks allocated on disk)",
+);
+
$File::StripNondeterminism::canonical_time = 1423159771;
my @fixtures = glob('t/fixtures/*/*.in');
@@ -54,14 +71,8 @@ foreach my $filename (@fixtures) {
my @stat_after = lstat $in;
# Check that file attributes remain unchanged.
- foreach (my $i = 0; $i < @stat_after; $i++) {
- next if (
- $i == 7 # size
- || $i == 8 # atime
- || $i == 9 # mtime
- || $i == 10 # ctime
- );
- is($stat_before[$i], $stat_after[$i], "$filename: stat[$i]");
+ foreach my $i (sort keys %STAT) {
+ is($stat_before[$i], $stat_after[$i], "$filename: $STAT{$i}");
}
ok(compare($in, $out) == 0, "Got expected output");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/strip-nondeterminism.git
More information about the Reproducible-commits
mailing list