Commit d617938d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 085049f6
...@@ -34,19 +34,23 @@ const ( ...@@ -34,19 +34,23 @@ const (
// prepareTestTree copies files from src to dst recursively processing *.ok and *.rm depending on mode // prepareTestTree copies files from src to dst recursively processing *.ok and *.rm depending on mode
// dst should not initially exist // dst should not initially exist
func prepareTestTree(src, dst string, mode TreePrepareMode) error { func prepareTestTree(src, dst string, mode TreePrepareMode) error {
println("AAA", dst)
err := os.MkdirAll(dst, 0777) err := os.MkdirAll(dst, 0777)
if err != nil { if err != nil {
return err return err
} }
return filepath.Walk(src, func(srcpath string, info os.FileInfo, err error) error { return filepath.Walk(src, func(srcpath string, info os.FileInfo, err error) error {
dstpath := dst + "/" + strings.TrimPrefix(srcpath, src) println("*", srcpath)
if srcpath == src /* skip root */ || err != nil {
return err
}
dstpath := dst + strings.TrimPrefix(srcpath, src)
//println("·", dstpath)
if info.IsDir() { if info.IsDir() {
err := os.Mkdir(dstpath, 0777) err := os.Mkdir(dstpath, 0777)
if err != nil { return err
return err
}
return prepareTestTree(srcpath, dstpath, mode)
} }
var isOk, isRm bool var isOk, isRm bool
...@@ -85,11 +89,7 @@ func prepareTestTree(src, dst string, mode TreePrepareMode) error { ...@@ -85,11 +89,7 @@ func prepareTestTree(src, dst string, mode TreePrepareMode) error {
} }
err = ioutil.WriteFile(dstpath, data, info.Mode()) err = ioutil.WriteFile(dstpath, data, info.Mode())
if err != nil { return err
return err
}
return nil
}) })
} }
...@@ -117,7 +117,7 @@ func TestGoTraceGen(t *testing.T) { ...@@ -117,7 +117,7 @@ func TestGoTraceGen(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer os.RemoveAll(tmp) //defer os.RemoveAll(tmp)
good := tmp + "/good" good := tmp + "/good"
work := tmp + "/work" work := tmp + "/work"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment