From 342798df53c0dde41529e11bc852f7cc09903f20 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Thu, 13 Apr 2017 15:02:04 +0800 Subject: [PATCH 1/2] print log after test Signed-off-by: Lai Jiangshan --- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index a4b12dae..1fea03fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,4 +22,5 @@ build-runv: go build -tags "static_build $(HYPER_BULD_TAGS)" -o runv . test-integration: cd integration-test/test_data && make - cd integration-test && go test -check.v -test.timeout=120m ${TESTFLAGS} . + cd integration-test && go test -check.v -test.timeout=120m ${TESTFLAGS} . ; ret=$$? ;\ + sync; sleep 20; sync; find /var/log/hyper/ -type f -exec echo -e '\n\nLog of ' {} ':' \; -exec cat {} \; ; exit $$ret From 70deb0920621b3fa09ae7e7c1f4d31701438d83b Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Thu, 13 Apr 2017 16:38:02 +0800 Subject: [PATCH 2/2] add timeout killer for the test Signed-off-by: Lai Jiangshan --- integration-test/utils.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/integration-test/utils.go b/integration-test/utils.go index 28dbb958..23289b64 100644 --- a/integration-test/utils.go +++ b/integration-test/utils.go @@ -7,6 +7,7 @@ import ( "os/exec" "path/filepath" "syscall" + "time" "github.com/docker/docker/integration-cli/checker" "github.com/go-check/check" @@ -39,11 +40,20 @@ func ProcessExitCode(err error) (exitCode int) { } func (s *RunVSuite) runvCommandWithError(args ...string) (string, int, error) { + killer := time.AfterFunc(40*time.Second, func() { + exec.Command("pkill", "-9", "runv").Run() + exec.Command("pkill", "-9", "qemu").Run() + exec.Command("pkill", "-9", "containerd-nslistener").Run() + }) + cmdArgs := []string{"--kernel", s.kernelPath, "--initrd", s.initrdPath, "--debug"} cmdArgs = append(cmdArgs, args...) cmd := exec.Command(s.binaryPath, cmdArgs...) out, err := cmd.CombinedOutput() exitCode := ProcessExitCode(err) + if !killer.Stop() { + err = fmt.Errorf("test timeout error, orgin exec error: %v", err) + } return string(out), exitCode, err }