Beispiel #1
0
func makeOneNamedTestDirectory(c *C, rng *xr.PRNG, name string,
	depth, width int) (dirPath string) {

	dirPath = fmt.Sprintf("tmp/%s", name)
	if _, err := os.Stat(dirPath); err == nil {
		err = os.RemoveAll(dirPath)
		c.Assert(err, IsNil)
	}
	//                                     maxLen, minLen of files (bytes)
	rng.NextDataDir(dirPath, depth, width, 4096, 32)
	return
}
Beispiel #2
0
func (s *XLSuite) makeOneNamedTestDirectory(c *C, rng *xr.PRNG,
	name string, depth, width int) string {

	name = strings.TrimSpace(name)
	dirPath := fmt.Sprintf("tmp/%s", name)
	if strings.Contains(dirPath, "..") {
		msg := fmt.Sprintf("directory name '%s' contains a double-dot\n", name)
		panic(msg)
	}
	err := os.RemoveAll(dirPath)
	c.Assert(err, IsNil)
	//                                     max/minLen
	rng.NextDataDir(dirPath, depth, width, 32, 1)
	return dirPath
}