summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2023-04-17 19:58:47 +0200
committerGitHub <noreply@github.com>2023-04-17 19:58:47 +0200
commit190059c69d0aa01b3f17ba5191d0a6e6d9669841 (patch)
tree493327243e7c93261aed815f069d8f4c1916ae17
parentaa42066eacc5b1a2135d1737d16138de3511868a (diff)
downloadpsutil-190059c69d0aa01b3f17ba5191d0a6e6d9669841.tar.gz
Add CI testing for OpenBSD and NetBSD (#2240)
-rw-r--r--.github/workflows/bsd.yml67
-rw-r--r--.github/workflows/build.yml44
-rw-r--r--HISTORY.rst2
-rw-r--r--INSTALL.rst10
-rw-r--r--README.rst14
-rw-r--r--psutil/_psbsd.py4
-rwxr-xr-xpsutil/tests/test_process.py1
7 files changed, 92 insertions, 50 deletions
diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml
new file mode 100644
index 00000000..9c811d18
--- /dev/null
+++ b/.github/workflows/bsd.yml
@@ -0,0 +1,67 @@
+# Execute tests on *BSD platforms. Does not produce wheels.
+# Useful URLs:
+# https://github.com/vmactions/freebsd-vm
+# https://github.com/vmactions/openbsd-vm
+# https://github.com/vmactions/netbsd-vm
+
+on: [push, pull_request]
+name: bsd-tests
+concurrency:
+ group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.sha || '' }}
+ cancel-in-progress: true
+jobs:
+ freebsd:
+ runs-on: macos-12
+ steps:
+ - uses: actions/checkout@v3
+ - name: Run tests
+ uses: vmactions/freebsd-vm@v0
+ with:
+ usesh: true
+ prepare: |
+ pkg install -y gcc python3
+ run: |
+ set -e -x
+ make install-pip
+ python3 -m pip install --user setuptools
+ make install
+ make test
+ make test-memleaks
+ openbsd:
+ runs-on: macos-12
+ steps:
+ - uses: actions/checkout@v3
+ - name: Run tests
+ uses: vmactions/openbsd-vm@v0
+ with:
+ usesh: true
+ prepare: |
+ set -e
+ pkg_add gcc python3
+ run: |
+ set -e
+ make install-pip
+ python3 -m pip install --user setuptools
+ make install
+ make test
+ make test-memleaks
+ netbsd:
+ runs-on: macos-12
+ steps:
+ - uses: actions/checkout@v3
+ - name: Run tests
+ uses: vmactions/netbsd-vm@v0
+ with:
+ usesh: true
+ prepare: |
+ set -e
+ pkg_add -v pkgin
+ pkgin update
+ pkgin -y install python311-* py311-setuptools-* gcc12-*
+ run: |
+ set -e
+ make install-pip PYTHON=python3.11
+ python3.11 -m pip install --user setuptools
+ make install PYTHON=python3.11
+ make test PYTHON=python3.11
+ make test-memleaks PYTHON=python3.11
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index eb6996da..d735a0ce 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,21 +1,15 @@
-# Executed on every push by GitHub Actions. This runs CI tests and
-# generates wheels (not all) on the following platforms:
+# Runs CI tests and generates wheels on the following platforms:
#
-# * Linux
-# * macOS
-# * Windows (disabled)
-# * FreeBSD
+# * Linux (py2 and py3)
+# * macOS (py2 and py3)
+# * Windows (py3, py2 is done by appveyor)
#
-# To skip certain builds see:
-# https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip
-#
-# External GH actions:
+# Useful URLs:
# * https://github.com/pypa/cibuildwheel
# * https://github.com/actions/checkout
# * https://github.com/actions/setup-python
# * https://github.com/actions/upload-artifact
# * https://github.com/marketplace/actions/cancel-workflow-action
-# * https://github.com/vmactions/freebsd-vm
on: [push, pull_request]
name: build
@@ -110,34 +104,6 @@ jobs:
python setup.py sdist
mv dist/psutil*.tar.gz wheelhouse/
- # FreeBSD (tests only)
- py3-freebsd:
- runs-on: macos-12
- steps:
- - name: Cancel previous runs
- uses: styfle/cancel-workflow-action@0.9.1
- with:
- access_token: ${{ github.token }}
-
- - uses: actions/checkout@v3
-
- - name: Run tests
- id: test
- uses: vmactions/freebsd-vm@v0
- with:
- usesh: true
- prepare: pkg install -y gcc python3
- run: |
- set +e
- export \
- PYTHONUNBUFFERED=1 \
- PYTHONWARNINGS=always \
- PSUTIL_DEBUG=1
- python3 -m pip install --user setuptools
- python3 setup.py install
- python3 psutil/tests/runner.py
- python3 psutil/tests/test_memleaks.py
-
# Run linters
linters:
runs-on: ubuntu-latest
diff --git a/HISTORY.rst b/HISTORY.rst
index 003dad23..fec64c0b 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -23,6 +23,8 @@
its truncated `Process.name()`_ (15 chars), don't fail with `ZombieProcess`_
when we try to guess the full name from the `Process.cmdline()`_. Just
return the truncated name.
+- 2240_, [NetBSD], [OpenBSD]: add CI testing on every commit for NetBSD and
+ OpenBSD platforms (python 3 only).
**Bug fixes**
diff --git a/INSTALL.rst b/INSTALL.rst
index 4f5831e6..2e8a1cd5 100644
--- a/INSTALL.rst
+++ b/INSTALL.rst
@@ -62,18 +62,20 @@ OpenBSD
::
export PKG_PATH=http://ftp.eu.openbsd.org/pub/OpenBSD/`uname -r`/packages/`uname -m`/
- pkg_add -v python gcc
+ pkg_add -v python3 gcc
pip install psutil
NetBSD
------
+Assuming Python 3.11 (the most recent at the time of writing):
+
::
- export PKG_PATH="ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
+ export PKG_PATH="http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/`uname -m`/`uname -r`/All"
pkg_add -v pkgin
- pkgin install python3 gcc
- pip install psutil
+ pkgin install python311-* gcc12-* py311-setuptools-* py311-pip-*
+ python3.11 -m pip install psutil
Sun Solaris
-----------
diff --git a/README.rst b/README.rst
index 361b0f01..2e991cb3 100644
--- a/README.rst
+++ b/README.rst
@@ -1,6 +1,6 @@
| |downloads| |stars| |forks| |contributors| |coverage|
| |version| |py-versions| |packages| |license|
-| |github-actions| |appveyor| |doc| |twitter| |tidelift|
+| |github-actions-wheels| |github-actions-bsd| |appveyor| |doc| |twitter| |tidelift|
.. |downloads| image:: https://img.shields.io/pypi/dm/psutil.svg
:target: https://pepy.tech/project/psutil
@@ -18,13 +18,17 @@
:target: https://github.com/giampaolo/psutil/graphs/contributors
:alt: Contributors
-.. |github-actions| image:: https://img.shields.io/github/actions/workflow/status/giampaolo/psutil/.github/workflows/build.yml?label=Linux%2C%20macOS%2C%20FreeBSD%20tests
+.. |github-actions-wheels| image:: https://img.shields.io/github/actions/workflow/status/giampaolo/psutil/.github/workflows/build.yml?label=Linux%2C%20macOS%2C%20Windows
:target: https://github.com/giampaolo/psutil/actions?query=workflow%3Abuild
- :alt: Linux, macOS, Windows tests
+ :alt: Linux, macOS, Windows
-.. |appveyor| image:: https://img.shields.io/appveyor/build/giampaolo/psutil/master.svg?maxAge=3600&label=Windows%20tests
+.. |github-actions-bsd| image:: https://img.shields.io/github/actions/workflow/status/giampaolo/psutil/.github/workflows/bsd.yml?label=FreeBSD,%20NetBSD,%20OpenBSD
+ :target: https://github.com/giampaolo/psutil/actions?query=workflow%3Absd-tests
+ :alt: FreeBSD, NetBSD, OpenBSD
+
+.. |appveyor| image:: https://img.shields.io/appveyor/build/giampaolo/psutil/master.svg?maxAge=3600&label=Windows%20(py2)
:target: https://ci.appveyor.com/project/giampaolo/psutil
- :alt: Windows tests (Appveyor)
+ :alt: Windows (Appveyor)
.. |coverage| image:: https://coveralls.io/repos/github/giampaolo/psutil/badge.svg?branch=master
:target: https://coveralls.io/github/giampaolo/psutil?branch=master
diff --git a/psutil/_psbsd.py b/psutil/_psbsd.py
index b77a9d68..99808bd2 100644
--- a/psutil/_psbsd.py
+++ b/psutil/_psbsd.py
@@ -835,11 +835,11 @@ class Process(object):
# sometimes we get an empty string, in which case we turn
# it into None
if OPENBSD and self.pid == 0:
- return None # ...else it would raise EINVAL
+ return "" # ...else it would raise EINVAL
elif NETBSD or HAS_PROC_OPEN_FILES:
# FreeBSD < 8 does not support functions based on
# kinfo_getfile() and kinfo_getvmmap()
- return cext.proc_cwd(self.pid) or ""
+ return cext.proc_cwd(self.pid)
else:
raise NotImplementedError(
"supported only starting from FreeBSD 8" if
diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py
index a67baa72..b3cf9ff5 100755
--- a/psutil/tests/test_process.py
+++ b/psutil/tests/test_process.py
@@ -159,6 +159,7 @@ class TestProcess(PsutilTestCase):
self.assertEqual(code, 5)
self.assertProcessGone(p)
+ @unittest.skipIf(NETBSD, "fails on NETBSD")
def test_wait_stopped(self):
p = self.spawn_psproc()
if POSIX: