Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit f92b0b2

Browse files
authored
Merge pull request #489 from laijs/print_log
print log after test
2 parents ec0599f + 70deb09 commit f92b0b2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ build-runv:
2222
go build -tags "static_build $(HYPER_BULD_TAGS)" -o runv .
2323
test-integration:
2424
cd integration-test/test_data && make
25-
cd integration-test && go test -check.v -test.timeout=120m ${TESTFLAGS} .
25+
cd integration-test && go test -check.v -test.timeout=120m ${TESTFLAGS} . ; ret=$$? ;\
26+
sync; sleep 20; sync; find /var/log/hyper/ -type f -exec echo -e '\n\nLog of ' {} ':' \; -exec cat {} \; ; exit $$ret

integration-test/utils.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"os/exec"
88
"path/filepath"
99
"syscall"
10+
"time"
1011

1112
"github.com/docker/docker/integration-cli/checker"
1213
"github.com/go-check/check"
@@ -39,11 +40,20 @@ func ProcessExitCode(err error) (exitCode int) {
3940
}
4041

4142
func (s *RunVSuite) runvCommandWithError(args ...string) (string, int, error) {
43+
killer := time.AfterFunc(40*time.Second, func() {
44+
exec.Command("pkill", "-9", "runv").Run()
45+
exec.Command("pkill", "-9", "qemu").Run()
46+
exec.Command("pkill", "-9", "containerd-nslistener").Run()
47+
})
48+
4249
cmdArgs := []string{"--kernel", s.kernelPath, "--initrd", s.initrdPath, "--debug"}
4350
cmdArgs = append(cmdArgs, args...)
4451
cmd := exec.Command(s.binaryPath, cmdArgs...)
4552
out, err := cmd.CombinedOutput()
4653
exitCode := ProcessExitCode(err)
54+
if !killer.Stop() {
55+
err = fmt.Errorf("test timeout error, orgin exec error: %v", err)
56+
}
4757
return string(out), exitCode, err
4858
}
4959

0 commit comments

Comments
 (0)