go x/build,os/signal: TestDetectNohup和TestNohup在替换的darwin LUCI构建器上失败,

tf7tbtn2  于 4个月前  发布在  Go
关注(0)|答案(7)|浏览(65)

目前,LUCI正在为darwin构建器使用临时借用的Mac。它们将被macOS虚拟机替换。在新机器人上,os/signalTestDetectNohupTestNohup会出现故障,如下所示:

=== RUN   TestDetectNohup
    signal_test.go:323: ran test with -check_sighup_ignored under nohup and it failed: expected success.
        Error: exit status 127
        Output:
        nohup: can't detach from console: Inappropriate ioctl for device
--- FAIL: TestDetectNohup (0.02s)
=== RUN   TestNohup/nohup-2
=== RUN   TestNohup/nohup-1
    signal_test.go:503: ran test with -send_uncaught_sighup=1 under nohup and it failed: expected success.
        Error: exit status 127
        Output:
        nohup: can't detach from console: Inappropriate ioctl for device
--- FAIL: TestNohup/nohup-1 (0.01s)
    signal_test.go:503: ran test with -send_uncaught_sighup=2 under nohup and it failed: expected success.
        Error: exit status 127
        Output:
        nohup: can't detach from console: Inappropriate ioctl for device
--- FAIL: TestNohup/nohup-2 (0.01s)
--- FAIL: TestNohup (0.02s)

我以前遇到过这个问题,但并不真正理解发生了什么。
我认为这与新机器人上运行的swarming bot在launchd下的方式有关。使用类似的服务,相同的故障也可以重现:
/Library/LaunchDaemons/test.plist :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>Label</key>
        <string>org.golang.build.test</string>
        <key>ProgramArguments</key>
        <array>
            <string>/tmp/test.sh</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>KeepAlive</key>
        <true/>
        <key>StandardOutPath</key>
        <string>/tmp/test.log</string>
        <key>StandardErrorPath</key>
        <string>/tmp/test.log</string>
    </dict>
</plist>

/tmp/test.sh :

#!/bin/bash
/bin/echo foo
nohup /bin/echo bar
$ sudo launchctl load /Library/LaunchDaemons/test.plist
$ sudo cat /tmp/test.log
foo
nohup: can't detach from console: Inappropriate ioctl for device

我认为这与不同类型的launchd服务的不同执行上下文有关。我的工作理论是,nohup想要进入“后台”引导命名空间,但这种服务没有“后台”引导命名空间。
我相信使用“预登录launchd代理”或“每个用户的launchd代理”(我认为现有的临时Mac使用后者)应该可以正常工作,但到目前为止,我一直没有成功地将它们可靠地转换为其中一种服务类型。由于这是一个相当小的问题,我目前只是将其记录下来,以便完成这次迁移的其他部分。

km0tfn4u

km0tfn4u1#

https://go.dev/cl/538698提到了这个问题:os/signal: skip nohup tests on darwin builders

xnifntxz

xnifntxz2#

@gopherbot Please backport to 1.20 and 1.21. This test needs to avoid failures on release branches as well.

umuewwlo

umuewwlo3#

回溯问题已打开:#63910(适用于1.20版本),#63911(适用于1.21版本)。
请记住,根据https://go.dev/wiki/MinorReleases,一旦将补丁提交到主分支,就立即创建cherry-pick CL。

l3zydbqr

l3zydbqr4#

https://go.dev/cl/546376提到了这个问题:[release-branch.go1.20] os/signal: skip nohup tests on darwin builders

uidvcgyl

uidvcgyl5#

https://go.dev/cl/546022提到了这个问题:[release-branch.go1.21] os/signal: skip nohup tests on darwin builders

cnjp1d6j

cnjp1d6j6#

这个问题是否等待解决?

bxgwgixi

bxgwgixi7#

我们应该修复构建者,以便这个测试能够实际运行,并且跳过可以被恢复。

相关问题