Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoodsend committed Oct 12, 2024
1 parent 96bae3b commit 9aaf700
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 27 deletions.
128 changes: 105 additions & 23 deletions .github/workflows/test-vagrant.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,115 @@
---
name: VMs

on:
workflow_dispatch:
inputs:
variants:
default: freebsd openbsd netbsd solaris dragonflybsd omnios
debug:

env:
test_code: |
set -e
export FORCE_COLOR=1
. /tmp/env/bin/activate
pip install -Uq setuptools pip
pip install -qe . -r tests/requirements.txt
pip install -q psutil || true
pip freeze
CC=gcc ./test
python stdlib/availability.py
ls packaging/contains-slugs/dist/
CC=clang ./test
jobs:
parse-parameters:
freebsd:
runs-on: ubuntu-latest
if: contains(inputs.variants, 'freebsd')
steps:
- uses: actions/checkout@v4
- uses: vmactions/freebsd-vm@v1
with:
usesh: true
run: |
pkg install -y python311 py311-sqlite3 gcc
python3.11 -m venv /tmp/env
${{ env.test_code }}
- uses: neilpang/debugger-action@master
if: failure() && inputs.debug

openbsd:
runs-on: ubuntu-latest
if: contains(inputs.variants, 'openbsd')
steps:
- id: parse
shell: python
run: |
import re, json
variants = re.findall(r"\w+", "${{ github.event.inputs.variants }}")
variants = variants or ["freebsd", "openbsd", "netbsd"]
print("::set-output name=variants::" + json.dumps(variants))
outputs:
variants: ${{ steps.parse.outputs.variants }}

test:
needs: parse-parameters
strategy:
fail-fast: false
matrix:
variant: ${{ fromJson(needs.parse-parameters.outputs.variants) }}
runs-on: macos-12
- uses: actions/checkout@v4
- uses: vmactions/openbsd-vm@v1
with:
usesh: true
run: |
pkg_add python3 gcc%11
ln /usr/local/bin/egcc /usr/local/bin/gcc
python3 -m venv /tmp/env
${{ env.test_code }}
- uses: neilpang/debugger-action@master
if: failure() && inputs.debug

netbsd:
runs-on: ubuntu-latest
if: contains(inputs.variants, 'netbsd')
steps:
- uses: actions/checkout@v4
- uses: vmactions/netbsd-vm@v1
with:
usesh: true
run: |
/usr/sbin/pkg_add python312 clang
python3.12 -m venv /tmp/env
${{ env.test_code }}
- uses: neilpang/debugger-action@master
if: failure() && inputs.debug

dragonflybsd:
runs-on: ubuntu-latest
if: contains(inputs.variants, 'dragonflybsd')
steps:
- uses: actions/checkout@v4
- uses: vmactions/dragonflybsd-vm@v1
with:
usesh: true
run: |
pkg install -y py311-sqlite3 clang-mesa
ln /usr/local/bin/clang-mesa /usr/local/bin/clang
python3.11 -m venv /tmp/env
${{ env.test_code }}
- uses: neilpang/debugger-action@master
if: failure() && inputs.debug

solaris:
runs-on: ubuntu-latest
if: contains(inputs.variants, 'solaris')
steps:
- uses: actions/checkout@v4
- uses: vmactions/solaris-vm@v1
with:
usesh: true
run: |
pkg install runtime/python-39 developer/gcc developer/llvm/clang
python3.9 -m venv /tmp/env
${{ env.test_code }}
- uses: neilpang/debugger-action@master
if: failure() && inputs.debug

omnios:
runs-on: ubuntu-latest
if: contains(inputs.variants, 'omnios')
steps:
- uses: actions/checkout@v4
- run: echo ${{ needs.parse-parameters.outputs.variants }}
- run: vagrant up ${{ matrix.variant }}
- run: vagrant ssh ${{ matrix.variant }} -- ./test
- run: vagrant ssh ${{ matrix.variant }} -- python stdlib/availability.py
- uses: vmactions/omnios-vm@v1
with:
usesh: true
run: |
pkg install developer/gcc13 ooce/developer/clang-18
python -m venv /tmp/env
${{ env.test_code }}
- uses: neilpang/debugger-action@master
if: failure() && inputs.debug
6 changes: 3 additions & 3 deletions tests/test_pointers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def test_strided():

# Maximum amount of memory-use increase. Should be almost zero if not zero.
# Certainly much less than MEM_BLOCK_SIZE.
MEM_LEAK_TOL = MEM_BLOCK_SIZE // 100
MEM_LEAK_TOL = MEM_BLOCK_SIZE // 10


def leaks(f, tol=None, n=1):
def leaks(f, tol=None, n=100):
"""
Test if a function leaks memory.
Expand All @@ -74,7 +74,7 @@ def leaks(f, tol=None, n=1):
new = p.memory_info().vms
out = new - old
if tol is not None:
assert out <= tol
assert out <= tol
return out


Expand Down
2 changes: 1 addition & 1 deletion tests/test_slugs.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def test_remake():
# This will happen only on Windows.
assert path in str(ex)

if platform.system() in ("FreeBSD", "NetBSD"):
if platform.system() in ("FreeBSD", "NetBSD", "DragonFly"):
# dlclose() seems to complain no matter what I do with it.
stdlib.dlerror.restype = ctypes.c_char_p
# This fails with an unhelpful b"Service unavailable".
Expand Down

0 comments on commit 9aaf700

Please sign in to comment.