diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-01-17 10:00:40 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-01-17 10:00:40 +0000 |
commit | 2b72bc8a2174d6c80a86260a47719d1ebf6de8ce (patch) | |
tree | 39fd5b1b706e732abb50c1f35a1dc0d7f572d830 | |
parent | 35c44b70524d0763fb517068a1e00c9ed3418e3e (diff) | |
download | obnam-2b72bc8a2174d6c80a86260a47719d1ebf6de8ce.tar.gz |
Normalise manifest times in test
Some filesystems don't store sub-second parts of mtime. Bleh.
-rw-r--r-- | test-gpghome/random_seed | bin | 600 -> 600 bytes | |||
-rw-r--r-- | yarns/0200-repo-formats.yarn | 6 | ||||
-rw-r--r-- | yarns/obnam.sh | 12 |
3 files changed, 14 insertions, 4 deletions
diff --git a/test-gpghome/random_seed b/test-gpghome/random_seed Binary files differindex 2346b7da..57826173 100644 --- a/test-gpghome/random_seed +++ b/test-gpghome/random_seed diff --git a/yarns/0200-repo-formats.yarn b/yarns/0200-repo-formats.yarn index 9ad0898c..be902209 100644 --- a/yarns/0200-repo-formats.yarn +++ b/yarns/0200-repo-formats.yarn @@ -89,5 +89,7 @@ against the manifest. done summain -r --exclude=Ino --exclude=Dev --exclude=Uid \ --exclude=Username --exclude=Gid --exclude=Group \ - . > "$DATADIR/restored-manifest" - diff -u "$DATADIR/$MATCH_2" "$DATADIR/restored-manifest" + . | normalise_manifest_times > "$DATADIR/restored-manifest" + normalise_manifest_times "$DATADIR/$MATCH_2" \ + > "$DATADIR/original-manifest" + diff -u "$DATADIR/original-manifest" "$DATADIR/restored-manifest" diff --git a/yarns/obnam.sh b/yarns/obnam.sh index 75258415..f05393b2 100644 --- a/yarns/obnam.sh +++ b/yarns/obnam.sh @@ -112,10 +112,18 @@ attempt_exit_was() } +# Normalise time fields in a manifest that vary uncontrollably on +# some filesystems. + +normalise_manifest_times() +{ + sed '/^Mtime:/s/\.[0-9]* / /' "$@" +} + + # Create a manifest with summain of a directory. manifest() { - summain -r "$1" --exclude Ino --exclude Dev | - sed '/^Mtime:/s/\.[0-9]* / /' + summain -r "$1" --exclude Ino --exclude Dev | normalise_manifest_times } |