diff options
author | loli10K <[email protected]> | 2018-03-18 09:34:45 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-05-01 10:33:35 -0700 |
commit | 85ce3f4fd114cf3c7a77feb07b397d43b90d11c7 (patch) | |
tree | 44e954831ea4375a3cabc1c4615ac3e6738d8a1e /tests | |
parent | 6abf922574f39ad597ae122fa43d2fa811970720 (diff) |
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 <[email protected]>
Signed-off-by: loli10K <[email protected]>
Closes #7230
Diffstat (limited to 'tests')
-rw-r--r-- | tests/runfiles/linux.run | 6 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/Makefile.am | 1 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/pyzfs/Makefile.am | 4 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/pyzfs/pyzfs_unittest.ksh | 52 |
4 files changed, 63 insertions, 0 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index bebb207fc..6dc4df96c 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -646,6 +646,12 @@ tests = ['projectid_001_pos', 'projectid_002_pos', 'projectid_003_pos', 'projecttree_001_pos', 'projecttree_002_pos', 'projecttree_003_neg' ] tags = ['functional', 'projectquota'] +[tests/functional/pyzfs] +tests = ['pyzfs_unittest'] +pre = +post = +tags = ['functional', 'pyzfs'] + [tests/functional/quota] tests = ['quota_001_pos', 'quota_002_pos', 'quota_003_pos', 'quota_004_pos', 'quota_005_pos', 'quota_006_neg'] diff --git a/tests/zfs-tests/tests/functional/Makefile.am b/tests/zfs-tests/tests/functional/Makefile.am index 6388f2d0f..396124986 100644 --- a/tests/zfs-tests/tests/functional/Makefile.am +++ b/tests/zfs-tests/tests/functional/Makefile.am @@ -31,6 +31,7 @@ SUBDIRS = \ large_files \ largest_pool \ libzfs \ + pyzfs \ link_count \ migration \ mmap \ diff --git a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am b/tests/zfs-tests/tests/functional/pyzfs/Makefile.am new file mode 100644 index 000000000..61cb3d074 --- /dev/null +++ b/tests/zfs-tests/tests/functional/pyzfs/Makefile.am @@ -0,0 +1,4 @@ +pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pyzfs + +dist_pkgdata_SCRIPTS = \ + pyzfs_unittest.ksh diff --git a/tests/zfs-tests/tests/functional/pyzfs/pyzfs_unittest.ksh b/tests/zfs-tests/tests/functional/pyzfs/pyzfs_unittest.ksh new file mode 100755 index 000000000..07f7aee4a --- /dev/null +++ b/tests/zfs-tests/tests/functional/pyzfs/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 <[email protected]>. 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" |