btrfs: test btrfs snapshots with driver suite

We now include btrfs in the snapshot driver test suite. This includes
the addition of parent links and name hashing into the btrfs driver.
We'll probably endup replacing this with a common metadata store, as
these relationships are generally identical between implementations.

A small bug was discovered in the delete implementation in the course
testing, so the btrfs package has been updated with a fix.

The overlay driver was modified accordingly with the btrfs driver to use
`Driver` as the exported type of each driver packge.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2017-02-03 14:20:05 -08:00
parent 127882fca7
commit aeffd4f92c
No known key found for this signature in database
GPG key ID: 67B3DED84EDC823F
7 changed files with 276 additions and 71 deletions

View file

@ -2,8 +2,10 @@ package testutil
import (
"flag"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"syscall"
"testing"
@ -55,6 +57,18 @@ func DumpDir(t *testing.T, root string) {
return err
}
t.Log(fi.Mode(), path, "->", target)
} else if fi.Mode().IsRegular() {
p, err := ioutil.ReadFile(path)
if err != nil {
t.Log("error reading file: %v", err)
return nil
}
if len(p) > 64 { // just display a little bit.
p = p[:64]
}
t.Log(fi.Mode(), path, "[", strconv.Quote(string(p)), "...]")
} else {
t.Log(fi.Mode(), path)
}