xref: /illumos-gate/usr/src/test/nvme-tests/cmd/unit.ksh (revision 533affcbc7fc4d0c8132976ea454aaa715fe2307)
1*533affcbSRobert Mustacchi#!/usr/bin/ksh
2*533affcbSRobert Mustacchi
3*533affcbSRobert Mustacchi#
4*533affcbSRobert Mustacchi# This file and its contents are supplied under the terms of the
5*533affcbSRobert Mustacchi# Common Development and Distribution License ("CDDL"), version 1.0.
6*533affcbSRobert Mustacchi# You may only use this file in accordance with the terms of version
7*533affcbSRobert Mustacchi# 1.0 of the CDDL.
8*533affcbSRobert Mustacchi#
9*533affcbSRobert Mustacchi# A full copy of the text of the CDDL should have accompanied this
10*533affcbSRobert Mustacchi# source.  A copy of the CDDL is also available via the Internet at
11*533affcbSRobert Mustacchi# http://www.illumos.org/license/CDDL.
12*533affcbSRobert Mustacchi#
13*533affcbSRobert Mustacchi
14*533affcbSRobert Mustacchi#
15*533affcbSRobert Mustacchi# Copyright 2024 Oxide Computer Company
16*533affcbSRobert Mustacchi#
17*533affcbSRobert Mustacchi
18*533affcbSRobert Mustacchi#
19*533affcbSRobert Mustacchi# Run the NVMe unit tests.
20*533affcbSRobert Mustacchi#
21*533affcbSRobert Mustacchi
22*533affcbSRobert Mustacchi#
23*533affcbSRobert Mustacchi# Standardize the environment and add debugging features.
24*533affcbSRobert Mustacchi#
25*533affcbSRobert Mustacchiexport LC_ALL=C.UTF-8
26*533affcbSRobert Mustacchiexport LD_PRELOAD=libumem.so
27*533affcbSRobert Mustacchiexport UMEM_DEBUG=default
28*533affcbSRobert Mustacchiunalias -a
29*533affcbSRobert Mustacchiset -o pipefail
30*533affcbSRobert Mustacchi
31*533affcbSRobert Mustacchiun_arg0=$(basename $0)
32*533affcbSRobert Mustacchiun_rundir="$(dirname $0)/../runfiles"
33*533affcbSRobert Mustacchiun_file="unit.run"
34*533affcbSRobert Mustacchiun_runfile="$un_rundir/$un_file"
35*533affcbSRobert Mustacchiun_runner="/opt/test-runner/bin/run"
36*533affcbSRobert Mustacchi
37*533affcbSRobert Mustacchifunction fatal
38*533affcbSRobert Mustacchi{
39*533affcbSRobert Mustacchi        typeset msg="$*"
40*533affcbSRobert Mustacchi        [[ -z "$msg" ]] && msg="failed"
41*533affcbSRobert Mustacchi        echo "$un_arg0: $msg" >&2
42*533affcbSRobert Mustacchi        exit 1
43*533affcbSRobert Mustacchi}
44*533affcbSRobert Mustacchi
45*533affcbSRobert Mustacchi
46*533affcbSRobert Mustacchi[[ -f "$un_runfile" ]] || fatal "could not find runfile $un_runfile"
47*533affcbSRobert Mustacchi$un_runner -c "$un_runfile"
48