mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Adopt pyzfs from ClusterHQ
This commit introduces several changes: * Update LICENSE and project information * Give a good PEP8 talk to existing Python source code * Add RPM/DEB packaging for pyzfs * Fix some outstanding issues with the existing pyzfs code caused by changes in the ABI since the last time the code was updated * Integrate pyzfs Python unittest with the ZFS Test Suite * Add missing libzfs_core functions: lzc_change_key, lzc_channel_program, lzc_channel_program_nosync, lzc_load_key, lzc_receive_one, lzc_receive_resumable, lzc_receive_with_cmdprops, lzc_receive_with_header, lzc_reopen, lzc_send_resume, lzc_sync, lzc_unload_key, lzc_remap Note: this commit slightly changes zfs_ioc_unload_key() ABI. This allow to differentiate the case where we tried to unload a key on a non-existing dataset (ENOENT) from the situation where a dataset has no key loaded: this is consistent with the "change" case where trying to zfs_ioc_change_key() from a dataset with no key results in EACCES. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes #7230
This commit is contained in:
committed by
Brian Behlendorf
parent
6abf922574
commit
85ce3f4fd1
@@ -31,6 +31,7 @@ SUBDIRS = \
|
||||
large_files \
|
||||
largest_pool \
|
||||
libzfs \
|
||||
pyzfs \
|
||||
link_count \
|
||||
migration \
|
||||
mmap \
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pyzfs
|
||||
|
||||
dist_pkgdata_SCRIPTS = \
|
||||
pyzfs_unittest.ksh
|
||||
@@ -0,0 +1,52 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright 2018, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Verify the libzfs_core Python test suite can be run successfully
|
||||
#
|
||||
# STRATEGY:
|
||||
# 1. Run the nvlist and libzfs_core Python unittest
|
||||
# 2. Verify the exit code is 0 (no errors)
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
# 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)'
|
||||
if [ $? -eq 1 ]
|
||||
then
|
||||
log_unsupported "libzfs_core not found by Python"
|
||||
fi
|
||||
|
||||
log_assert "Verify the nvlist and libzfs_core Python unittest run successfully"
|
||||
|
||||
# NOTE: don't use log_must() here because it makes output unreadable
|
||||
python -m unittest --verbose \
|
||||
libzfs_core.test.test_nvlist.TestNVList \
|
||||
libzfs_core.test.test_libzfs_core.ZFSTest
|
||||
if [ $? -ne 0 ]; then
|
||||
log_fail "Python unittest completed with errors"
|
||||
fi
|
||||
|
||||
log_pass "Python unittest completed without errors"
|
||||
Reference in New Issue
Block a user