Python3: replace distutils with sysconfig

- `distutils` module is long time deprecated and already deleted
  from the CPython mainline.

- To remain compatible with Debian/Ubuntu Python3 packaging style,
  try
  `distutils.sysconfig.get_python_path(0,0)`
  first with fallback on
  `sysconfig.get_path('purelib')`

- pyzfs_unittest suite is run unconditionally as a part of ZTS.

- Add pyzfs_unittest suite to sanity tests.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: szubersk <szuberskidamian@gmail.com>
Closes #12833 
Closes #13280 
Closes #14177
This commit is contained in:
Damian Szuberski
2022-11-29 05:39:41 +10:00
committed by GitHub
parent 5f45e3f699
commit 387109364e
5 changed files with 26 additions and 56 deletions
+4
View File
@@ -624,3 +624,7 @@ tags = ['functional', 'zvol', 'zvol_swap']
[tests/functional/zpool_influxdb]
tests = ['zpool_influxdb']
tags = ['functional', 'zpool_influxdb']
[tests/functional/pyzfs]
tests = ['pyzfs_unittest']
tags = ['functional', 'pyzfs']
-9
View File
@@ -61,14 +61,6 @@ known_reason = 'Known issue'
#
exec_reason = 'Test user execute permissions required for utilities'
#
# Some tests require a minimum python version of 3.6 and will be skipped when
# the default system version is too old. There may also be tests which require
# additional python modules be installed, for example python3-cffi is required
# by the pyzfs tests.
#
python_deps_reason = 'Python modules missing: python3-cffi'
#
# Some tests require that the kernel supports renameat2 syscall.
#
@@ -232,7 +224,6 @@ maybe = {
'io/mmap': ['SKIP', fio_reason],
'largest_pool/largest_pool_001_pos': ['FAIL', known_reason],
'mmp/mmp_on_uberblocks': ['FAIL', known_reason],
'pyzfs/pyzfs_unittest': ['SKIP', python_deps_reason],
'pool_checkpoint/checkpoint_discard_busy': ['FAIL', 11946],
'projectquota/setup': ['SKIP', exec_reason],
'removal/removal_condense_export': ['FAIL', known_reason],
@@ -18,6 +18,8 @@
if [ -n "$ASAN_OPTIONS" ]; then
export LD_PRELOAD=$(ldd "$(command -v zfs)" | awk '/libasan\.so/ {print $3}')
# ASan reports leaks in CPython 3.10
ASAN_OPTIONS="$ASAN_OPTIONS:detect_leaks=false"
fi
#
@@ -30,20 +32,6 @@ fi
#
verify_runnable "global"
# Verify that the required dependencies for testing are installed.
@PYTHON@ -c "import cffi" 2>/dev/null ||
log_unsupported "python3-cffi not found by Python"
# We don't just try to "import libzfs_core" because we want to skip these tests
# only if pyzfs was not installed due to missing, build-time, dependencies; if
# we cannot load "libzfs_core" due to other reasons, for instance an API/ABI
# mismatch, we want to report it.
@PYTHON@ -c '
import pkgutil, sys
sys.exit(pkgutil.find_loader("libzfs_core") is None)' ||
log_unsupported "libzfs_core not found by Python"
log_assert "Verify the nvlist and libzfs_core Python unittest run successfully"
# log_must buffers stderr, which interacts badly with