bobuhiro11 / gokvm

KVM based tiny x86 hypervisor written in pure golang, which can boot Linux
https://blog.bobuhiro11.net/tags/gokvm.html
MIT License
206 stars 21 forks source link

flaky tests in kvm package #138

Closed bobuhiro11 closed 1 year ago

bobuhiro11 commented 1 year ago

In cdd468358729 ("Merge pull request #135 from bobuhiro11/add_travis_retry"), repeated tests against the kvm package occasionally fail. On my machine it fails 8 times out of 100.

ubuntu2004thinkpad:~/gokvm$  \
for i in `seq 100`; do 
  sudo env "PATH=$PATH" go test ./kvm/...  -count=1 -p=1 2>&1 >/dev/null
  echo -n $?
done

# 0 means success, 1 means faillure.
0000000000000001100100000000000000000000000001000000000001010000000010000000100000000000000000000000

Although the failing test cases were varied, the message was all the same: "strings: illegal use of non-zero builder copied by value."

--- FAIL: TestGetSetSRegs2 (0.00s)
panic: strings: illegal use of non-zero Builder copied by value [recovered]
        panic: strings: illegal use of non-zero Builder copied by value

goroutine 40 [running]:
testing.tRunner.func1.2({0x515780, 0x568db0})
        /home/bobuhiro11/.goenv/versions/1.19.0/src/testing/testing.go:1396 +0x24e
testing.tRunner.func1()
        /home/bobuhiro11/.goenv/versions/1.19.0/src/testing/testing.go:1399 +0x39f
panic({0x515780, 0x568db0})
        /home/bobuhiro11/.goenv/versions/1.19.0/src/runtime/panic.go:884 +0x212
strings.(*Builder).copyCheck(...)
        /home/bobuhiro11/.goenv/versions/1.19.0/src/strings/builder.go:42
strings.(*Builder).WriteString(...)
        /home/bobuhiro11/.goenv/versions/1.19.0/src/strings/builder.go:123
testing.(*common).decorate(0x28?, {0xc0002294d0, 0x28}, 0x1000000000010?)
        /home/bobuhiro11/.goenv/versions/1.19.0/src/testing/testing.go:670 +0x6f8
testing.(*common).logDepth(0xc000136b60, {0xc0002294d0, 0x28}, 0x3)
        /home/bobuhiro11/.goenv/versions/1.19.0/src/testing/testing.go:907 +0x1f5
testing.(*common).log(...)
        /home/bobuhiro11/.goenv/versions/1.19.0/src/testing/testing.go:876
testing.(*common).Skipf(0xc000136b60, {0x53fbd6?, 0x2?}, {0x0?, 0x0?, 0x0?})
        /home/bobuhiro11/.goenv/versions/1.19.0/src/testing/testing.go:968 +0x5a
github.com/bobuhiro11/gokvm/kvm_test.TestGetSetSRegs2(0xc000136b60)
        /home/bobuhiro11/gokvm/kvm/kvm_test.go:1316 +0x2a7
testing.tRunner(0xc000136b60, 0x543e98)
        /home/bobuhiro11/.goenv/versions/1.19.0/src/testing/testing.go:1446 +0x10b
created by testing.(*T).Run
        /home/bobuhiro11/.goenv/versions/1.19.0/src/testing/testing.go:1493 +0x35f