2014-02-26 00:17:48 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"io"
|
2014-09-02 22:35:25 +08:00
|
|
|
"os"
|
2014-02-26 00:17:48 +08:00
|
|
|
"os/exec"
|
2014-07-29 13:50:16 +08:00
|
|
|
"time"
|
2014-09-06 19:49:40 +08:00
|
|
|
|
2015-09-09 21:36:44 +08:00
|
|
|
"github.com/docker/docker/pkg/integration"
|
2014-02-26 00:17:48 +08:00
|
|
|
)
|
|
|
|
|
|
2016-02-03 22:16:00 +08:00
|
|
|
func getPrefixAndSlashFromDaemonPlatform() (prefix, slash string) {
|
|
|
|
|
if daemonPlatform == "windows" {
|
|
|
|
|
return "c:", `\`
|
|
|
|
|
}
|
|
|
|
|
return "", "/"
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-26 00:17:48 +08:00
|
|
|
func getExitCode(err error) (int, error) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.GetExitCode(err)
|
2014-02-26 00:17:48 +08:00
|
|
|
}
|
|
|
|
|
|
2014-08-13 22:23:11 +08:00
|
|
|
func processExitCode(err error) (exitCode int) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.ProcessExitCode(err)
|
2014-08-13 22:23:11 +08:00
|
|
|
}
|
|
|
|
|
|
2015-07-22 20:59:24 +08:00
|
|
|
func isKilled(err error) bool {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.IsKilled(err)
|
2015-03-11 06:10:00 +08:00
|
|
|
}
|
|
|
|
|
|
2014-08-13 22:23:11 +08:00
|
|
|
func runCommandWithOutput(cmd *exec.Cmd) (output string, exitCode int, err error) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.RunCommandWithOutput(cmd)
|
2014-02-26 00:17:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func runCommandWithStdoutStderr(cmd *exec.Cmd) (stdout string, stderr string, exitCode int, err error) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.RunCommandWithStdoutStderr(cmd)
|
2014-02-26 00:17:48 +08:00
|
|
|
}
|
|
|
|
|
|
2015-02-14 17:19:57 +08:00
|
|
|
func runCommandWithOutputForDuration(cmd *exec.Cmd, duration time.Duration) (output string, exitCode int, timedOut bool, err error) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.RunCommandWithOutputForDuration(cmd, duration)
|
2015-02-14 17:19:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func runCommandWithOutputAndTimeout(cmd *exec.Cmd, timeout time.Duration) (output string, exitCode int, err error) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.RunCommandWithOutputAndTimeout(cmd, timeout)
|
2014-08-14 00:02:04 +08:00
|
|
|
}
|
|
|
|
|
|
2014-02-26 00:17:48 +08:00
|
|
|
func runCommand(cmd *exec.Cmd) (exitCode int, err error) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.RunCommand(cmd)
|
2014-02-26 00:17:48 +08:00
|
|
|
}
|
|
|
|
|
|
2015-02-15 06:25:13 +08:00
|
|
|
func runCommandPipelineWithOutput(cmds ...*exec.Cmd) (output string, exitCode int, err error) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.RunCommandPipelineWithOutput(cmds...)
|
2015-02-15 06:25:13 +08:00
|
|
|
}
|
|
|
|
|
|
2014-07-09 04:25:22 +08:00
|
|
|
func unmarshalJSON(data []byte, result interface{}) error {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.UnmarshalJSON(data, result)
|
2014-07-09 04:25:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func convertSliceOfStringsToMap(input []string) map[string]struct{} {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.ConvertSliceOfStringsToMap(input)
|
2014-07-29 13:50:16 +08:00
|
|
|
}
|
2014-09-02 22:35:25 +08:00
|
|
|
|
|
|
|
|
func compareDirectoryEntries(e1 []os.FileInfo, e2 []os.FileInfo) error {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.CompareDirectoryEntries(e1, e2)
|
2014-09-02 22:35:25 +08:00
|
|
|
}
|
2014-09-06 19:49:40 +08:00
|
|
|
|
2015-07-22 20:59:24 +08:00
|
|
|
func listTar(f io.Reader) ([]string, error) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.ListTar(f)
|
2014-09-06 19:49:40 +08:00
|
|
|
}
|
2014-09-13 01:10:42 +08:00
|
|
|
|
2015-09-25 01:53:47 +08:00
|
|
|
func randomTmpDirPath(s string, platform string) string {
|
|
|
|
|
return integration.RandomTmpDirPath(s, platform)
|
2015-02-14 14:59:01 +08:00
|
|
|
}
|
|
|
|
|
|
2014-10-31 03:10:38 +08:00
|
|
|
func consumeWithSpeed(reader io.Reader, chunkSize int, interval time.Duration, stop chan bool) (n int, err error) {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.ConsumeWithSpeed(reader, chunkSize, interval, stop)
|
2014-10-31 02:52:13 +08:00
|
|
|
}
|
2015-03-21 06:32:40 +08:00
|
|
|
|
|
|
|
|
func parseCgroupPaths(procCgroupData string) map[string]string {
|
2015-09-09 21:36:44 +08:00
|
|
|
return integration.ParseCgroupPaths(procCgroupData)
|
2015-05-27 10:22:03 +08:00
|
|
|
}
|
2015-07-23 00:14:48 +08:00
|
|
|
|
|
|
|
|
func runAtDifferentDate(date time.Time, block func()) {
|
2015-09-09 21:36:44 +08:00
|
|
|
integration.RunAtDifferentDate(date, block)
|
2015-07-23 00:14:48 +08:00
|
|
|
}
|