1#!/usr/bin/ksh
2
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 2024 Oxide Computer Company
16#
17
18#
19# Run the NVMe unit tests.
20#
21
22#
23# Standardize the environment and add debugging features.
24#
25export LC_ALL=C.UTF-8
26export LD_PRELOAD=libumem.so
27export UMEM_DEBUG=default
28unalias -a
29set -o pipefail
30
31un_arg0=$(basename $0)
32un_rundir="$(dirname $0)/../runfiles"
33un_file="unit.run"
34un_runfile="$un_rundir/$un_file"
35un_runner="/opt/test-runner/bin/run"
36
37function fatal
38{
39        typeset msg="$*"
40        [[ -z "$msg" ]] && msg="failed"
41        echo "$un_arg0: $msg" >&2
42        exit 1
43}
44
45
46[[ -f "$un_runfile" ]] || fatal "could not find runfile $un_runfile"
47$un_runner -c "$un_runfile"
48