1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

go fmt and aufs support removed

This commit is contained in:
Victor Vieux 2013-09-26 15:40:13 +00:00
parent 5e1d540209
commit ebfa24acb0
11 changed files with 124 additions and 396 deletions

View file

@ -56,13 +56,13 @@ type APIContainers struct {
func (self *APIContainers) ToLegacy() APIContainersOld {
return APIContainersOld{
ID: self.ID,
Image: self.Image,
Command: self.Command,
Created: self.Created,
Status: self.Status,
Ports: displayablePorts(self.Ports),
SizeRw: self.SizeRw,
ID: self.ID,
Image: self.Image,
Command: self.Command,
Created: self.Created,
Status: self.Status,
Ports: displayablePorts(self.Ports),
SizeRw: self.SizeRw,
SizeRootFs: self.SizeRootFs,
}
}

View file

@ -566,7 +566,6 @@ func TestPostCommit(t *testing.T) {
srv := &Server{runtime: runtime}
// Create a container and remove a file
container, err := runtime.Create(
&Config{

View file

@ -84,13 +84,13 @@ func Tar(path string, compression Compression) (io.Reader, error) {
}
func escapeName(name string) string {
escaped := make([]byte,0)
escaped := make([]byte, 0)
for i, c := range []byte(name) {
if i == 0 && c == '/' {
continue
}
// all printable chars except "-" which is 0x2d
if (0x20 <= c && c <= 0x7E) && c != 0x2d {
if (0x20 <= c && c <= 0x7E) && c != 0x2d {
escaped = append(escaped, c)
} else {
escaped = append(escaped, fmt.Sprintf("\\%03o", c)...)
@ -102,7 +102,7 @@ func escapeName(name string) string {
// Tar creates an archive from the directory at `path`, only including files whose relative
// paths are included in `filter`. If `filter` is nil, then all files are included.
func TarFilter(path string, compression Compression, filter []string, recursive bool, createFiles []string) (io.Reader, error) {
args := []string{"tar", "--numeric-owner", "-f", "-", "-C", path, "-T", "-",}
args := []string{"tar", "--numeric-owner", "-f", "-", "-C", path, "-T", "-"}
if filter == nil {
filter = []string{"."}
}
@ -142,7 +142,7 @@ func TarFilter(path string, compression Compression, filter []string, recursive
}
}
return CmdStream(exec.Command(args[0], args[1:]...), &files, func () {
return CmdStream(exec.Command(args[0], args[1:]...), &files, func() {
if tmpDir != "" {
_ = os.RemoveAll(tmpDir)
}

View file

@ -34,82 +34,10 @@ func (change *Change) String() string {
return fmt.Sprintf("%s %s", kind, change.Path)
}
func ChangesAUFS(layers []string, rw string) ([]Change, error) {
var changes []Change
err := filepath.Walk(rw, func(path string, f os.FileInfo, err error) error {
if err != nil {
return err
}
// Rebase path
path, err = filepath.Rel(rw, path)
if err != nil {
return err
}
path = filepath.Join("/", path)
// Skip root
if path == "/" {
return nil
}
// Skip AUFS metadata
if matched, err := filepath.Match("/.wh..wh.*", path); err != nil || matched {
return err
}
change := Change{
Path: path,
}
// Find out what kind of modification happened
file := filepath.Base(path)
// If there is a whiteout, then the file was removed
if strings.HasPrefix(file, ".wh.") {
originalFile := file[len(".wh."):]
change.Path = filepath.Join(filepath.Dir(path), originalFile)
change.Kind = ChangeDelete
} else {
// Otherwise, the file was added
change.Kind = ChangeAdd
// ...Unless it already existed in a top layer, in which case, it's a modification
for _, layer := range layers {
stat, err := os.Stat(filepath.Join(layer, path))
if err != nil && !os.IsNotExist(err) {
return err
}
if err == nil {
// The file existed in the top layer, so that's a modification
// However, if it's a directory, maybe it wasn't actually modified.
// If you modify /foo/bar/baz, then /foo will be part of the changed files only because it's the parent of bar
if stat.IsDir() && f.IsDir() {
if f.Size() == stat.Size() && f.Mode() == stat.Mode() && f.ModTime() == stat.ModTime() {
// Both directories are the same, don't record the change
return nil
}
}
change.Kind = ChangeModify
break
}
}
}
// Record change
changes = append(changes, change)
return nil
})
if err != nil && !os.IsNotExist(err) {
return nil, err
}
return changes, nil
}
type FileInfo struct {
parent *FileInfo
name string
stat syscall.Stat_t
parent *FileInfo
name string
stat syscall.Stat_t
children map[string]*FileInfo
}
@ -132,20 +60,20 @@ func (root *FileInfo) LookUp(path string) *FileInfo {
return parent
}
func (info *FileInfo)path() string {
func (info *FileInfo) path() string {
if info.parent == nil {
return "/"
}
return filepath.Join(info.parent.path(), info.name)
}
func (info *FileInfo)unlink() {
func (info *FileInfo) unlink() {
if info.parent != nil {
delete(info.parent.children, info.name)
}
}
func (info *FileInfo)Remove(path string) bool {
func (info *FileInfo) Remove(path string) bool {
child := info.LookUp(path)
if child != nil {
child.unlink()
@ -154,12 +82,11 @@ func (info *FileInfo)Remove(path string) bool {
return false
}
func (info *FileInfo)isDir() bool {
func (info *FileInfo) isDir() bool {
return info.parent == nil || info.stat.Mode&syscall.S_IFDIR == syscall.S_IFDIR
}
func (info *FileInfo)addChanges(oldInfo *FileInfo, changes *[]Change) {
func (info *FileInfo) addChanges(oldInfo *FileInfo, changes *[]Change) {
if oldInfo == nil {
// add
change := Change{
@ -198,7 +125,7 @@ func (info *FileInfo)addChanges(oldInfo *FileInfo, changes *[]Change) {
oldStat.Gid != newStat.Gid ||
oldStat.Rdev != newStat.Rdev ||
// Don't look at size for dirs, its not a good measure of change
(oldStat.Size != newStat.Size && oldStat.Mode &syscall.S_IFDIR != syscall.S_IFDIR) ||
(oldStat.Size != newStat.Size && oldStat.Mode&syscall.S_IFDIR != syscall.S_IFDIR) ||
oldMtime.Sec != newMtime.Sec ||
oldMtime.Usec != newMtime.Usec {
change := Change{
@ -223,10 +150,9 @@ func (info *FileInfo)addChanges(oldInfo *FileInfo, changes *[]Change) {
*changes = append(*changes, change)
}
}
func (info *FileInfo)Changes(oldInfo *FileInfo) []Change {
func (info *FileInfo) Changes(oldInfo *FileInfo) []Change {
var changes []Change
info.addChanges(oldInfo, &changes)
@ -234,10 +160,9 @@ func (info *FileInfo)Changes(oldInfo *FileInfo) []Change {
return changes
}
func newRootFileInfo() *FileInfo {
root := &FileInfo {
name: "/",
root := &FileInfo{
name: "/",
children: make(map[string]*FileInfo),
}
return root
@ -299,11 +224,11 @@ func applyLayer(root *FileInfo, layer string) error {
return fmt.Errorf("collectFileInfo: Unexpectedly no parent for %s", relPath)
}
info := &FileInfo {
name: filepath.Base(relPath),
info := &FileInfo{
name: filepath.Base(relPath),
children: make(map[string]*FileInfo),
parent: parent,
stat: layerStat,
parent: parent,
stat: layerStat,
}
parent.children[info.name] = info
@ -314,7 +239,6 @@ func applyLayer(root *FileInfo, layer string) error {
return err
}
func collectFileInfo(sourceDir string) (*FileInfo, error) {
root := newRootFileInfo()
@ -339,10 +263,10 @@ func collectFileInfo(sourceDir string) (*FileInfo, error) {
return fmt.Errorf("collectFileInfo: Unexpectedly no parent for %s", relPath)
}
info := &FileInfo {
name: filepath.Base(relPath),
info := &FileInfo{
name: filepath.Base(relPath),
children: make(map[string]*FileInfo),
parent: parent,
parent: parent,
}
if err := syscall.Lstat(path, &info.stat); err != nil {
@ -365,7 +289,7 @@ func ChangesLayers(newDir string, layers []string) ([]Change, error) {
return nil, err
}
oldRoot := newRootFileInfo()
for i := len(layers)-1; i >= 0; i-- {
for i := len(layers) - 1; i >= 0; i-- {
layer := layers[i]
if err = applyLayer(oldRoot, layer); err != nil {
return nil, err

View file

@ -803,10 +803,10 @@ func (container *Container) Start(hostConfig *HostConfig) error {
// without exec in go we have to do this horrible shell hack...
shellString :=
"mount --make-rprivate /; exec " +
utils.ShellQuoteArguments(params)
utils.ShellQuoteArguments(params)
params = []string{
"unshare", "-m", "--", "/bin/sh", "-c", shellString,
"unshare", "-m", "--", "/bin/sh", "-c", shellString,
}
}

View file

@ -15,7 +15,7 @@ type DeviceSet interface {
type DeviceSetWrapper struct {
wrapped DeviceSet
prefix string
prefix string
}
func (wrapper *DeviceSetWrapper) wrap(hash string) string {
@ -25,7 +25,6 @@ func (wrapper *DeviceSetWrapper) wrap(hash string) string {
return hash
}
func (wrapper *DeviceSetWrapper) AddDevice(hash, baseHash string) error {
return wrapper.wrapped.AddDevice(wrapper.wrap(hash), wrapper.wrap(baseHash))
}
@ -69,7 +68,7 @@ func (wrapper *DeviceSetWrapper) HasActivatedDevice(hash string) bool {
func NewDeviceSetWrapper(wrapped DeviceSet, prefix string) DeviceSet {
wrapper := &DeviceSetWrapper{
wrapped: wrapped,
prefix: prefix,
prefix: prefix,
}
return wrapper
}

290
image.go
View file

@ -8,9 +8,7 @@ import (
"github.com/dotcloud/docker/utils"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
"path"
"path/filepath"
"strconv"
@ -141,31 +139,6 @@ func mountPath(root string) string {
return path.Join(root, "mount")
}
func MountAUFS(ro []string, rw string, target string) error {
// FIXME: Now mount the layers
rwBranch := fmt.Sprintf("%v=rw", rw)
roBranches := ""
for _, layer := range ro {
roBranches += fmt.Sprintf("%v=ro+wh:", layer)
}
branches := fmt.Sprintf("br:%v:%v", rwBranch, roBranches)
branches += ",xino=/dev/shm/aufs.xino"
//if error, try to load aufs kernel module
if err := mount("none", target, "aufs", 0, branches); err != nil {
log.Printf("Kernel does not support AUFS, trying to load the AUFS module with modprobe...")
if err := exec.Command("modprobe", "aufs").Run(); err != nil {
return fmt.Errorf("Unable to load the AUFS module")
}
log.Printf("...module loaded.")
if err := mount("none", target, "aufs", 0, branches); err != nil {
return fmt.Errorf("Unable to mount using aufs")
}
}
return nil
}
// TarLayer returns a tar archive of the image's filesystem layer.
func (image *Image) TarLayer(compression Compression) (Archive, error) {
layerPath, err := image.layer()
@ -315,7 +288,7 @@ func (image *Image) applyLayer(layer, target string) error {
syscall.NsecToTimeval(srcStat.Mtim.Nano()),
}
u := TimeUpdate {
u := TimeUpdate{
path: targetPath,
time: ts,
}
@ -335,7 +308,7 @@ func (image *Image) applyLayer(layer, target string) error {
update := updateTimes[i]
O_PATH := 010000000 // Not in syscall yet
fd, err := syscall.Open(update.path, syscall.O_RDWR | O_PATH | syscall.O_NOFOLLOW, 0600)
fd, err := syscall.Open(update.path, syscall.O_RDWR|O_PATH|syscall.O_NOFOLLOW, 0600)
if err == syscall.EISDIR || err == syscall.ELOOP {
// O_PATH not supported, use Utimes except on symlinks where Utimes doesn't work
if err != syscall.ELOOP {
@ -411,7 +384,6 @@ func (image *Image) ensureImageDevice(devices DeviceSet) error {
return err
}
err = ioutil.WriteFile(path.Join(mountDir, ".docker-id"), []byte(image.ID), 0600)
if err != nil {
_ = devices.UnmountDevice(image.ID, mountDir)
@ -461,25 +433,7 @@ func (image *Image) ensureImageDevice(devices DeviceSet) error {
}
func (image *Image) Mounted(runtime *Runtime, root, rw string) (bool, error) {
method := runtime.GetMountMethod()
if method == MountMethodFilesystem {
if _, err := os.Stat(rw); err != nil {
if os.IsNotExist(err) {
err = nil
}
return false, err
}
mountedPath := path.Join(rw, ".fs-mounted")
if _, err := os.Stat(mountedPath); err != nil {
if os.IsNotExist(err) {
err = nil
}
return false, err
}
return true, nil
} else {
return Mounted(root)
}
return Mounted(root)
}
func (image *Image) Mount(runtime *Runtime, root, rw string, id string) error {
@ -492,195 +446,107 @@ func (image *Image) Mount(runtime *Runtime, root, rw string, id string) error {
return err
}
switch runtime.GetMountMethod() {
case MountMethodNone:
return fmt.Errorf("No supported Mount implementation")
devices, err := runtime.GetDeviceSet()
if err != nil {
return err
}
err = image.ensureImageDevice(devices)
if err != nil {
return err
}
case MountMethodAUFS:
if err := os.Mkdir(rw, 0755); err != nil && !os.IsExist(err) {
return err
}
layers, err := image.layers()
createdDevice := false
if !devices.HasDevice(id) {
utils.Debugf("Creating device %s for container based on image %s", id, image.ID)
err = devices.AddDevice(id, image.ID)
if err != nil {
return err
}
if err := MountAUFS(layers, rw, root); err != nil {
return err
}
createdDevice = true
}
case MountMethodDeviceMapper:
devices, err := runtime.GetDeviceSet()
utils.Debugf("Mounting container %s at %s for container", id, root)
err = devices.MountDevice(id, root)
if err != nil {
return err
}
if createdDevice {
err = ioutil.WriteFile(path.Join(root, ".docker-id"), []byte(id), 0600)
if err != nil {
_ = devices.RemoveDevice(image.ID)
return err
}
err = image.ensureImageDevice(devices)
if err != nil {
return err
}
createdDevice := false
if !devices.HasDevice(id) {
utils.Debugf("Creating device %s for container based on image %s", id, image.ID)
err = devices.AddDevice(id, image.ID)
if err != nil {
return err
}
createdDevice = true
}
utils.Debugf("Mounting container %s at %s for container", id, root)
err = devices.MountDevice(id, root)
if err != nil {
return err
}
if createdDevice {
err = ioutil.WriteFile(path.Join(root, ".docker-id"), []byte(id), 0600)
if err != nil {
_ = devices.RemoveDevice(image.ID)
return err
}
}
case MountMethodFilesystem:
if err := os.Mkdir(rw, 0755); err != nil && !os.IsExist(err) {
return err
}
layers, err := image.layers()
if err != nil {
return err
}
for i := len(layers)-1; i >= 0; i-- {
layer := layers[i]
if err = image.applyLayer(layer, root); err != nil {
return err
}
}
mountedPath := path.Join(rw, ".fs-mounted")
fo, err := os.Create(mountedPath)
if err != nil {
return err
}
fo.Close()
}
return nil
}
func (image *Image) Unmount(runtime *Runtime, root string, id string) error {
switch runtime.GetMountMethod() {
case MountMethodNone:
return fmt.Errorf("No supported Unmount implementation")
case MountMethodAUFS:
return Unmount(root)
case MountMethodDeviceMapper:
// Try to deactivate the device as generally there is no use for it anymore
devices, err := runtime.GetDeviceSet()
if err != nil {
return err;
}
err = devices.UnmountDevice(id, root)
if err != nil {
return err
}
return devices.DeactivateDevice(id)
case MountMethodFilesystem:
return nil
// Try to deactivate the device as generally there is no use for it anymore
devices, err := runtime.GetDeviceSet()
if err != nil {
return err
}
return nil
err = devices.UnmountDevice(id, root)
if err != nil {
return err
}
return devices.DeactivateDevice(id)
}
func (image *Image) Changes(runtime *Runtime, root, rw, id string) ([]Change, error) {
switch runtime.GetMountMethod() {
case MountMethodAUFS:
layers, err := image.layers()
if err != nil {
return nil, err
}
return ChangesAUFS(layers, rw)
case MountMethodDeviceMapper:
devices, err := runtime.GetDeviceSet()
if err != nil {
return nil, err
}
if err := os.Mkdir(rw, 0755); err != nil && !os.IsExist(err) {
return nil, err
}
wasActivated := devices.HasActivatedDevice(image.ID)
// We re-use rw for the temporary mount of the base image as its
// not used by device-mapper otherwise
err = devices.MountDevice(image.ID, rw)
if err != nil {
return nil, err
}
changes, err := ChangesDirs(root, rw)
_ = devices.UnmountDevice(image.ID, rw)
if !wasActivated {
_ = devices.DeactivateDevice(image.ID)
}
if err != nil {
return nil, err
}
return changes, nil
case MountMethodFilesystem:
layers, err := image.layers()
if err != nil {
return nil, err
}
changes, err := ChangesLayers(root, layers)
if err != nil {
return nil, err
}
return changes, nil
devices, err := runtime.GetDeviceSet()
if err != nil {
return nil, err
}
return nil, fmt.Errorf("No supported Changes implementation")
if err := os.Mkdir(rw, 0755); err != nil && !os.IsExist(err) {
return nil, err
}
wasActivated := devices.HasActivatedDevice(image.ID)
// We re-use rw for the temporary mount of the base image as its
// not used by device-mapper otherwise
err = devices.MountDevice(image.ID, rw)
if err != nil {
return nil, err
}
changes, err := ChangesDirs(root, rw)
_ = devices.UnmountDevice(image.ID, rw)
if !wasActivated {
_ = devices.DeactivateDevice(image.ID)
}
if err != nil {
return nil, err
}
return changes, nil
}
func (image *Image) ExportChanges(runtime *Runtime, root, rw, id string) (Archive, error) {
switch runtime.GetMountMethod() {
case MountMethodAUFS:
return Tar(rw, Uncompressed)
case MountMethodFilesystem, MountMethodDeviceMapper:
changes, err := image.Changes(runtime, root, rw, id)
if err != nil {
return nil, err
}
files := make([]string, 0)
deletions := make([]string, 0)
for _, change := range changes {
if change.Kind == ChangeModify || change.Kind == ChangeAdd {
files = append(files, change.Path)
}
if change.Kind == ChangeDelete {
base := filepath.Base(change.Path)
dir := filepath.Dir(change.Path)
deletions = append(deletions, filepath.Join(dir, ".wh."+base))
}
}
return TarFilter(root, Uncompressed, files, false, deletions)
changes, err := image.Changes(runtime, root, rw, id)
if err != nil {
return nil, err
}
return nil, fmt.Errorf("No supported Changes implementation")
}
files := make([]string, 0)
deletions := make([]string, 0)
for _, change := range changes {
if change.Kind == ChangeModify || change.Kind == ChangeAdd {
files = append(files, change.Path)
}
if change.Kind == ChangeDelete {
base := filepath.Base(change.Path)
dir := filepath.Dir(change.Path)
deletions = append(deletions, filepath.Join(dir, ".wh."+base))
}
}
return TarFilter(root, Uncompressed, files, false, deletions)
}
func (image *Image) ShortID() string {
return utils.TruncateID(image.ID)

View file

@ -1,40 +1,11 @@
package docker
import (
"fmt"
"github.com/dotcloud/docker/utils"
"os"
"os/exec"
"path/filepath"
"syscall"
"time"
)
func Unmount(target string) error {
if err := exec.Command("auplink", target, "flush").Run(); err != nil {
utils.Debugf("[warning]: couldn't run auplink before unmount: %s", err)
}
if err := syscall.Unmount(target, 0); err != nil {
return err
}
// Even though we just unmounted the filesystem, AUFS will prevent deleting the mntpoint
// for some time. We'll just keep retrying until it succeeds.
for retries := 0; retries < 1000; retries++ {
err := os.Remove(target)
if err == nil {
// rm mntpoint succeeded
return nil
}
if os.IsNotExist(err) {
// mntpoint doesn't exist anymore. Success.
return nil
}
// fmt.Printf("(%v) Remove %v returned: %v\n", retries, target, err)
time.Sleep(10 * time.Millisecond)
}
return fmt.Errorf("Umount: Failed to umount %v", target)
}
func Mounted(mountpoint string) (bool, error) {
mntpoint, err := os.Stat(mountpoint)
if err != nil {

View file

@ -17,14 +17,6 @@ import (
)
var defaultDns = []string{"8.8.8.8", "8.8.4.4"}
type MountMethod int
const (
MountMethodNone MountMethod = iota
MountMethodAUFS
MountMethodDeviceMapper
MountMethodFilesystem
)
type Capabilities struct {
MemoryLimit bool
@ -47,7 +39,6 @@ type Runtime struct {
srv *Server
Dns []string
deviceSet DeviceSet
mountMethod MountMethod
}
var sysInitPath string
@ -109,27 +100,6 @@ func hasFilesystemSupport(fstype string) bool {
return false
}
func (runtime *Runtime) GetMountMethod() MountMethod {
if runtime.mountMethod == MountMethodNone {
// Try to automatically pick a method
if hasFilesystemSupport("aufs") {
utils.Debugf("Using AUFS backend.")
runtime.mountMethod = MountMethodAUFS
} else {
_ = exec.Command("modprobe", "aufs").Run()
if hasFilesystemSupport("aufs") {
utils.Debugf("Using AUFS backend.")
runtime.mountMethod = MountMethodAUFS
} else {
utils.Debugf("Using device-mapper backend.")
runtime.mountMethod = MountMethodDeviceMapper
}
}
}
return runtime.mountMethod
}
func (runtime *Runtime) GetDeviceSet() (DeviceSet, error) {
if runtime.deviceSet == nil {
return nil, fmt.Errorf("No device set available")
@ -288,7 +258,7 @@ func (runtime *Runtime) Destroy(container *Container) error {
if err := os.RemoveAll(container.root); err != nil {
return fmt.Errorf("Unable to remove filesystem for %v: %v", container.ID, err)
}
if runtime.GetMountMethod() == MountMethodDeviceMapper && runtime.deviceSet.HasDevice(container.ID) {
if runtime.deviceSet.HasDevice(container.ID) {
if err := runtime.deviceSet.RemoveDevice(container.ID); err != nil {
return fmt.Errorf("Unable to remove device for %v: %v", container.ID, err)
}
@ -301,7 +271,7 @@ func (runtime *Runtime) DeleteImage(id string) error {
if err != nil {
return err
}
if runtime.GetMountMethod() == MountMethodDeviceMapper && runtime.deviceSet.HasDevice(id) {
if runtime.deviceSet.HasDevice(id) {
if err := runtime.deviceSet.RemoveDevice(id); err != nil {
return fmt.Errorf("Unable to remove device for %v: %v", id, err)
}

View file

@ -3,8 +3,8 @@ package docker
import (
"bytes"
"fmt"
"github.com/dotcloud/docker/utils"
"github.com/dotcloud/docker/devmapper"
"github.com/dotcloud/docker/utils"
"io"
"io/ioutil"
"log"
@ -20,13 +20,13 @@ import (
)
const (
unitTestImageName = "docker-test-image"
unitTestImageID = "83599e29c455eb719f77d799bc7c51521b9551972f5a850d7ad265bc1b5292f6" // 1.0
unitTestNetworkBridge = "testdockbr0"
unitTestStoreBase = "/var/lib/docker/unit-tests"
unitTestStoreDevicesBase = "/var/lib/docker/unit-tests-devices"
testDaemonAddr = "127.0.0.1:4270"
testDaemonProto = "tcp"
unitTestImageName = "docker-test-image"
unitTestImageID = "83599e29c455eb719f77d799bc7c51521b9551972f5a850d7ad265bc1b5292f6" // 1.0
unitTestNetworkBridge = "testdockbr0"
unitTestStoreBase = "/var/lib/docker/unit-tests"
unitTestStoreDevicesBase = "/var/lib/docker/unit-tests-devices"
testDaemonAddr = "127.0.0.1:4270"
testDaemonProto = "tcp"
)
var (
@ -75,7 +75,6 @@ func cleanupLast(runtime *Runtime) error {
return nil
}
func layerArchive(tarfile string) (io.Reader, error) {
// FIXME: need to close f somewhere
f, err := os.Open(tarfile)

View file

@ -2,11 +2,11 @@ package docker
import (
"github.com/dotcloud/docker/utils"
"path/filepath"
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
"testing"
)