xref: /illumos-gate/usr/src/test/nvme-tests/cmd/destructive.ksh (revision f5f0964ce91892f7482efc86903b0ec7c7b6ba66)
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 2025 Oxide Computer Company
16#
17#
18
19#
20# Run destructive user tests after verification that the device is
21# usable.
22#
23
24#
25# Environment sanitization.
26#
27export LC_ALL=C.UTF-8
28export LD_PRELOAD=libumem.so
29export UMEM_DEBUG=default
30unalias -a
31set -o pipefail
32
33de_arg0=$(basename $0)
34de_root="$(dirname $0)/.."
35de_rundir="$de_root/runfiles"
36de_file="destruct.run"
37de_runfile="$de_rundir/$de_file"
38de_runner="/opt/test-runner/bin/run"
39de_check="$de_root/tests/libnvme/check-destruct.64"
40
41
42if (( $# == 0 )); then
43	fatal "missing required device name"
44fi
45
46export NVME_TEST_DEVICE=$1
47if ! $de_check; then
48	exit 1
49fi
50
51$de_runner -c "$de_runfile"
52