qa: Ignore lsof warnings on NetBSD

On NetBSD, `lsof` can produce the following warnings:
1. "created device cache file: ..." - usually happens in a CI
environment.
2. "compiled for NetBSD release 10.0; this is 10.1." or similar - when
the `lsof` binary package is installed on a point release.

This change suppresses both warnings printed to stderr and fixes the
affected tests.
This commit is contained in:
Hennadii Stepanov
2026-06-26 16:57:05 +01:00
parent 70352fda03
commit 5d01aa4772

View File

@@ -100,7 +100,8 @@ def get_bind_addrs(pid):
import re
import subprocess
output = subprocess.check_output(["lsof",
*(["-Di"] if sys.platform.startswith("freebsd") else []), # Ignore device cache to avoid stderr warnings.
*(["-Di"] if sys.platform.startswith(("freebsd", "netbsd")) else []), # Ignore device cache to avoid stderr warnings.
*(["-w"] if sys.platform.startswith("netbsd") else []), # Ignore point release mismatch warnings.
"-nP", # Keep hosts and ports numeric.
"-a", # Require all filters to match.
"-p", str(pid), # Limit results to the target pid.