xref: /freebsd/sys/contrib/openzfs/tests/zfs-tests/tests/functional/pyzfs/pyzfs_unittest.ksh.in (revision 61145dc2b94f12f6a47344fb9aac702321880e43)
1#!/bin/ksh -p
2# SPDX-License-Identifier: CDDL-1.0
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9# A full copy of the text of the CDDL should have accompanied this
10# source.  A copy of the CDDL is also available via the Internet at
11# http://www.illumos.org/license/CDDL.
12#
13
14#
15# Copyright 2018, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
16#
17
18. $STF_SUITE/include/libtest.shlib
19
20if [ -n "$ASAN_OPTIONS" ]; then
21	export LD_PRELOAD=$(ldd "$(command -v zfs)" | awk '/libasan\.so/ {print $3}')
22	# ASan reports leaks in CPython 3.10
23	ASAN_OPTIONS="$ASAN_OPTIONS:detect_leaks=false"
24fi
25
26#
27# DESCRIPTION:
28#	Verify the libzfs_core Python test suite can be run successfully
29#
30# STRATEGY:
31#	1. Run the nvlist and libzfs_core Python unittest
32#	2. Verify the exit code is 0 (no errors)
33#
34
35verify_runnable "global"
36log_assert "Verify the nvlist and libzfs_core Python unittest run successfully"
37
38# log_must buffers stderr, which interacts badly with
39# no-output timeouts on CI runners
40@PYTHON@ -m unittest --verbose \
41	libzfs_core.test.test_nvlist.TestNVList \
42	libzfs_core.test.test_libzfs_core.ZFSTest ||
43	log_fail "Python unittest completed with errors"
44
45log_pass "Python unittest completed without errors"
46