diff options
author | Lars Wirzenius <liw@liw.fi> | 2014-01-26 14:51:57 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2014-01-26 14:51:57 +0000 |
commit | 57d016517b38043962dfd4a428869565163c1fa2 (patch) | |
tree | 09607142d3942bf248589bc34405ffb6c7023a2d /yarns/9000-implements.yarn | |
parent | f5502b638093291eb9cf39c1506f77ef391ff270 (diff) | |
download | obnam-57d016517b38043962dfd4a428869565163c1fa2.tar.gz |
Fix file restore, add xattr value change test
The single file restore test had a bug, in that it was depending on
various test steps to execute fast enough that the wall clock did not
advance to the next second. This has been fixed by allowing manifests
to be done on single files instead of just directories.
Add a test for an extended attribute value changing, and that being
the only change in the live data. The backup needs to notice that it
has changed. This was intended to be the original change in this
commit, but I ran into the test bug above, so I had to fix that too.
I was too lazy to detangle the two sets of changes for commits.
Diffstat (limited to 'yarns/9000-implements.yarn')
-rw-r--r-- | yarns/9000-implements.yarn | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/yarns/9000-implements.yarn b/yarns/9000-implements.yarn index 65a6f2f3..2932373b 100644 --- a/yarns/9000-implements.yarn +++ b/yarns/9000-implements.yarn @@ -82,6 +82,11 @@ UTC format, as is common in Unix. os.utime(filename, (timestamp, timestamp)) ' +We need to manipulate extended attributes. + + IMPLEMENTS GIVEN file (\S+) has extended attribute (\S+) set to (\S+) + mkdir -p $(dirname "$DATADIR/$MATCH_1") + setfattr --name="$MATCH_2" --value "$MATCH_3" "$DATADIR/$MATCH_1" Manifest creation and checking ------------------------------ @@ -91,7 +96,7 @@ that naming of the manifest is explicit. This reduces the need to debug weird test suite bugs, when an automatic or implicit manifest naming goes wrong. - IMPLEMENTS GIVEN a manifest of directory (\S+) in (\S+) + IMPLEMENTS GIVEN a manifest of (\S+) in (\S+) manifest "$DATADIR/$MATCH_1" > "$DATADIR/$MATCH_2" We need to check a directory tree against an existing manifest. We do @@ -101,8 +106,14 @@ see what the temporary manifest actually contains. Being able to look at the actual file is easier than trying to interpret complicated diffs. +We remove the restore directory prefix from the manifest (the `Name:` +field that Summain outputs). This is necessary so that comparisons +with **diff**(1) will work well. + IMPLEMENTS THEN (\S+), restored to (\S+), matches manifest (\S+) - manifest "$DATADIR/$MATCH_2/$DATADIR/$MATCH_1" > "$DATADIR/temp-manifest" + manifest "$DATADIR/$MATCH_2/$DATADIR/$MATCH_1" | + sed "s*$DATADIR/$MATCH_2/**" > "$DATADIR/temp-manifest" + diff -u "$DATADIR/$MATCH_3" "$DATADIR/temp-manifest" rm -f "$DATADIR/temp-manifest" |