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