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
19if [ -n "$ASAN_OPTIONS" ]; then
20	export LD_PRELOAD=$(ldd "$(command -v zfs)" | awk '/libasan\.so/ {print $3}')
21	# ASan reports leaks in CPython 3.10
22	ASAN_OPTIONS="$ASAN_OPTIONS:detect_leaks=false"
23fi
24
25#
26# DESCRIPTION:
27#	Verify the libzfs_core Python test suite can be run successfully
28#
29# STRATEGY:
30#	1. Run the nvlist and libzfs_core Python unittest
31#	2. Verify the exit code is 0 (no errors)
32#
33
34verify_runnable "global"
35log_assert "Verify the nvlist and libzfs_core Python unittest run successfully"
36
37# log_must buffers stderr, which interacts badly with
38# no-output timeouts on CI runners
39@PYTHON@ -m unittest --verbose \
40	libzfs_core.test.test_nvlist.TestNVList \
41	libzfs_core.test.test_libzfs_core.ZFSTest ||
42	log_fail "Python unittest completed with errors"
43
44log_pass "Python unittest completed without errors"
45