testutil: add Size to DumpDir output

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2017-11-01 14:20:38 -07:00 committed by Michael Crosby
parent 7d64713dce
commit 368dc17a4c

View File

@ -2,6 +2,7 @@ package testutil
import (
"flag"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@ -35,7 +36,7 @@ func DumpDir(t *testing.T, root string) {
if err != nil {
return err
}
t.Log(fi.Mode(), path, "->", target)
t.Log(fi.Mode(), fmt.Sprintf("%10s", ""), path, "->", target)
} else if fi.Mode().IsRegular() {
p, err := ioutil.ReadFile(path)
if err != nil {
@ -46,10 +47,9 @@ func DumpDir(t *testing.T, root string) {
if len(p) > 64 { // just display a little bit.
p = p[:64]
}
t.Log(fi.Mode(), path, "[", strconv.Quote(string(p)), "...]")
t.Log(fi.Mode(), fmt.Sprintf("%10d", fi.Size()), path, "[", strconv.Quote(string(p)), "...]")
} else {
t.Log(fi.Mode(), path)
t.Log(fi.Mode(), fmt.Sprintf("%10d", fi.Size()), path)
}
return nil