]>
Commit | Line | Data |
---|---|---|
85ce3f4f | 1 | #!/bin/ksh -p |
2 | # | |
3 | # This file and its contents are supplied under the terms of the | |
4 | # Common Development and Distribution License ("CDDL"), version 1.0. | |
5 | # You may only use this file in accordance with the terms of version | |
6 | # 1.0 of the CDDL. | |
7 | # | |
8 | # A full copy of the text of the CDDL should have accompanied this | |
9 | # source. A copy of the CDDL is also available via the Internet at | |
10 | # http://www.illumos.org/license/CDDL. | |
11 | # | |
12 | ||
13 | # | |
14 | # Copyright 2018, loli10K <ezomori.nozomu@gmail.com>. All rights reserved. | |
15 | # | |
16 | ||
17 | . $STF_SUITE/include/libtest.shlib | |
18 | ||
19 | # | |
20 | # DESCRIPTION: | |
21 | # Verify the libzfs_core Python test suite can be run successfully | |
22 | # | |
23 | # STRATEGY: | |
24 | # 1. Run the nvlist and libzfs_core Python unittest | |
25 | # 2. Verify the exit code is 0 (no errors) | |
26 | # | |
27 | ||
28 | verify_runnable "global" | |
29 | ||
e4a3297a | 30 | # Verify that the required dependencies for testing are installed. |
6e72a5b9 | 31 | @PYTHON@ -c "import cffi" 2>/dev/null |
e4a3297a | 32 | if [ $? -eq 1 ]; then |
8a7c4efd | 33 | log_unsupported "python3-cffi not found by Python" |
e4a3297a BB |
34 | fi |
35 | ||
85ce3f4f | 36 | # We don't just try to "import libzfs_core" because we want to skip these tests |
37 | # only if pyzfs was not installed due to missing, build-time, dependencies; if | |
38 | # we cannot load "libzfs_core" due to other reasons, for instance an API/ABI | |
39 | # mismatch, we want to report it. | |
6e72a5b9 | 40 | @PYTHON@ -c ' |
85ce3f4f | 41 | import pkgutil, sys |
42 | sys.exit(pkgutil.find_loader("libzfs_core") is None)' | |
e4a3297a | 43 | if [ $? -eq 1 ]; then |
85ce3f4f | 44 | log_unsupported "libzfs_core not found by Python" |
45 | fi | |
46 | ||
47 | log_assert "Verify the nvlist and libzfs_core Python unittest run successfully" | |
48 | ||
49 | # NOTE: don't use log_must() here because it makes output unreadable | |
6e72a5b9 | 50 | @PYTHON@ -m unittest --verbose \ |
85ce3f4f | 51 | libzfs_core.test.test_nvlist.TestNVList \ |
52 | libzfs_core.test.test_libzfs_core.ZFSTest | |
53 | if [ $? -ne 0 ]; then | |
54 | log_fail "Python unittest completed with errors" | |
55 | fi | |
56 | ||
57 | log_pass "Python unittest completed without errors" |