diff options
author | George Koehler <xkernigh@netscape.net> | 2018-05-25 16:59:54 -0400 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2018-05-29 02:14:52 +0200 |
commit | 64906b07557acf828806f1d1f7c67a2ca05cf103 (patch) | |
tree | cd7eff42fba02989ebe95cf4604164efcc04bf7e /mesonbuild/mtest.py | |
parent | cc3e0bc4690886485e880b673ea16989f820b90d (diff) | |
download | meson-64906b07557acf828806f1d1f7c67a2ca05cf103.zip meson-64906b07557acf828806f1d1f7c67a2ca05cf103.tar.gz meson-64906b07557acf828806f1d1f7c67a2ca05cf103.tar.bz2 |
Don't call getpgid() when killing a test.
OpenBSD's getpgid(2) fails with EPERM (PermissionError) because the
test is in a different session: https://man.openbsd.org/getpgid
Use p.pid as the process group ID, because setsid() created a process
group with the same ID as the process. See setsid(2) manuals:
- FreeBSD: https://www.freebsd.org/cgi/man.cgi?query=setsid
- illumos: https://illumos.org/man/setsid
- Linux: http://man7.org/linux/man-pages/man2/setsid.2.html
This change fixes 'manual tests/8 timeout' on OpenBSD. To verify this
change, one must run the manual test. For example,
$ cd 'manual tests/8 timeout'
$ meson build
$ ninja -C build test
It should report that the test timed out, and not show
PermissionError.
Fixes https://github.com/mesonbuild/meson/issues/3569
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r-- | mesonbuild/mtest.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 110a94e..9dd4cbd 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -304,7 +304,8 @@ class SingleTestRunner: subprocess.call(['taskkill', '/F', '/T', '/PID', str(p.pid)]) else: try: - os.killpg(os.getpgid(p.pid), signal.SIGKILL) + # Kill the process group that setsid() created. + os.killpg(p.pid, signal.SIGKILL) except ProcessLookupError: # Sometimes (e.g. with Wine) this happens. # There's nothing we can do (maybe the process |