helper/stub: write ready byte late
All checks were successful
Test / Create distribution (push) Successful in 27s
Test / Sandbox (race detector) (push) Successful in 41s
Test / Sandbox (push) Successful in 41s
Test / Hakurei (push) Successful in 44s
Test / Hakurei (race detector) (push) Successful in 44s
Test / Hpkg (push) Successful in 42s
Test / Flake checks (push) Successful in 1m30s
All checks were successful
Test / Create distribution (push) Successful in 27s
Test / Sandbox (race detector) (push) Successful in 41s
Test / Sandbox (push) Successful in 41s
Test / Hakurei (push) Successful in 44s
Test / Hakurei (race detector) (push) Successful in 44s
Test / Hpkg (push) Successful in 42s
Test / Flake checks (push) Successful in 1m30s
Hopefully eliminates spurious failures. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
763ab27e09
commit
a14b6535a6
@ -68,39 +68,35 @@ func genericStub(argsFile, statFile *os.File) {
|
||||
}
|
||||
}
|
||||
|
||||
// simulate status pipe behaviour
|
||||
if statFile != nil {
|
||||
// simulate status pipe behaviour
|
||||
var epoll int
|
||||
if fd, err := syscall.EpollCreate1(0); err != nil {
|
||||
panic("cannot open epoll fd: " + err.Error())
|
||||
} else {
|
||||
defer func() {
|
||||
if err = syscall.Close(fd); err != nil {
|
||||
panic("cannot close epoll fd: " + err.Error())
|
||||
}
|
||||
}()
|
||||
epoll = fd
|
||||
}
|
||||
if err := syscall.EpollCtl(epoll, syscall.EPOLL_CTL_ADD, int(statFile.Fd()), &syscall.EpollEvent{}); err != nil {
|
||||
panic("cannot add status pipe to epoll: " + err.Error())
|
||||
}
|
||||
|
||||
if _, err := statFile.Write([]byte{'x'}); err != nil {
|
||||
panic("cannot write to status pipe: " + err.Error())
|
||||
}
|
||||
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
// wait for status pipe close
|
||||
var epoll int
|
||||
if fd, err := syscall.EpollCreate1(0); err != nil {
|
||||
panic("cannot open epoll fd: " + err.Error())
|
||||
} else {
|
||||
defer func() {
|
||||
if err = syscall.Close(fd); err != nil {
|
||||
panic("cannot close epoll fd: " + err.Error())
|
||||
}
|
||||
}()
|
||||
epoll = fd
|
||||
}
|
||||
if err := syscall.EpollCtl(epoll, syscall.EPOLL_CTL_ADD, int(statFile.Fd()), &syscall.EpollEvent{}); err != nil {
|
||||
panic("cannot add status pipe to epoll: " + err.Error())
|
||||
}
|
||||
events := make([]syscall.EpollEvent, 1)
|
||||
if _, err := syscall.EpollWait(epoll, events, -1); err != nil {
|
||||
panic("cannot poll status pipe: " + err.Error())
|
||||
}
|
||||
if events[0].Events != syscall.EPOLLERR {
|
||||
panic(strconv.Itoa(int(events[0].Events)))
|
||||
// wait for status pipe close
|
||||
events := make([]syscall.EpollEvent, 1)
|
||||
if _, err := syscall.EpollWait(epoll, events, -1); err != nil {
|
||||
panic("cannot poll status pipe: " + err.Error())
|
||||
}
|
||||
if events[0].Events != syscall.EPOLLERR {
|
||||
panic(strconv.Itoa(int(events[0].Events)))
|
||||
|
||||
}
|
||||
close(done)
|
||||
}()
|
||||
<-done
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user