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