diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-10-31 10:19:55 +0200 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-31 10:19:55 +0200 | 
| commit | 5f112356149689f8da385442447606f1c2c5cc9e (patch) | |
| tree | ecb5e5f230f0e74990ae96ae21aa1d713f4a5422 | |
| parent | 7c1034087e025a07214b0dcaaa9e9ab06c13a4dd (diff) | |
| parent | b4dc01b3ded25b68e08f82ae455e89c086385dc3 (diff) | |
Merge pull request #17296 from LabNConsulting/liambrady/core-rlimit-respect-hard-limit
tests: respect RLIMIT_CORE hard limit
| -rwxr-xr-x | tests/topotests/conftest.py | 11 | 
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/topotests/conftest.py b/tests/topotests/conftest.py index 44536e945e..dafd19c283 100755 --- a/tests/topotests/conftest.py +++ b/tests/topotests/conftest.py @@ -522,9 +522,14 @@ def pytest_configure(config):          is_xdist = True          is_worker = True -    resource.setrlimit( -        resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY) -    ) +    try: +        resource.setrlimit( +            resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY) +        ) +    except ValueError: +        # The hard limit cannot be raised. Raise the soft limit to previous hard limit +        core_rlimits = resource.getrlimit(resource.RLIMIT_CORE) +        resource.setrlimit(resource.RLIMIT_CORE, (core_rlimits[1], core_rlimits[1]))      # -----------------------------------------------------      # Set some defaults for the pytest.ini [pytest] section      # ---------------------------------------------------  | 
