зеркало из https://github.com/microsoft/docker.git
Improve crashTest
This commit is contained in:
Родитель
cdc2657ee9
Коммит
d97661aa71
|
@ -77,53 +77,32 @@ func crashTest() error {
|
||||||
stop = false
|
stop = false
|
||||||
for i := 0; i < 100 && !stop; {
|
for i := 0; i < 100 && !stop; {
|
||||||
func() error {
|
func() error {
|
||||||
if conn != nil {
|
cmd := exec.Command(DOCKER_PATH, "run", "base", "echo", fmt.Sprintf("%d", totalTestCount))
|
||||||
fmt.Fprintf(conn, "%d\n", totalTestCount)
|
i++
|
||||||
}
|
totalTestCount++
|
||||||
cmd := exec.Command(DOCKER_PATH, "run", "base", "echo", "hello", "world")
|
|
||||||
outPipe, err := cmd.StdoutPipe()
|
outPipe, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// inPipe, err := cmd.StdinPipe()
|
inPipe, err := cmd.StdinPipe()
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
// }
|
}
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
go func() {
|
if conn != nil {
|
||||||
io.Copy(os.Stdout, outPipe)
|
go io.Copy(conn, outPipe)
|
||||||
}()
|
}
|
||||||
// Expecting error, do not check
|
|
||||||
// inPipe.Write([]byte("hello world!!!!!\n"))
|
// Expecting error, do not check
|
||||||
// go inPipe.Write([]byte("hello world!!!!!\n"))
|
inPipe.Write([]byte("hello world!!!!!\n"))
|
||||||
// go inPipe.Write([]byte("hello world!!!!!\n"))
|
go inPipe.Write([]byte("hello world!!!!!\n"))
|
||||||
// inPipe.Close()
|
go inPipe.Write([]byte("hello world!!!!!\n"))
|
||||||
|
inPipe.Close()
|
||||||
|
|
||||||
// go func() error {
|
|
||||||
// r := bufio.NewReader(outPipe)
|
|
||||||
// if out, err := r.ReadString('\n'); err != nil {
|
|
||||||
// return err
|
|
||||||
// } else if out == "hello world\n" {
|
|
||||||
// log.Printf("%d", i)
|
|
||||||
// if conn != nil {
|
|
||||||
// fmt.Fprintf(conn, "%d\n", totalTestCount)
|
|
||||||
// }
|
|
||||||
// i++
|
|
||||||
// totalTestCount++
|
|
||||||
// }
|
|
||||||
// return nil
|
|
||||||
// }()
|
|
||||||
if err := cmd.Wait(); err != nil {
|
if err := cmd.Wait(); err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
|
||||||
log.Printf("%d", i)
|
|
||||||
if conn != nil {
|
|
||||||
fmt.Fprintf(conn, "%d\n", totalTestCount)
|
|
||||||
}
|
|
||||||
i++
|
|
||||||
totalTestCount++
|
|
||||||
}
|
}
|
||||||
outPipe.Close()
|
outPipe.Close()
|
||||||
return nil
|
return nil
|
||||||
|
|
Загрузка…
Ссылка в новой задаче