1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (C) 2020 Intel Corporation 4# All rights reserved. 5# 6testdir=$(readlink -f $(dirname $0)) 7rootdir=$(readlink -f $testdir/../..) 8source $rootdir/scripts/common.sh 9source $rootdir/test/common/autotest_common.sh 10 11rpc_py=$rootdir/scripts/rpc.py 12 13bdf=$(get_first_nvme_bdf) 14 15$SPDK_BIN_DIR/spdk_tgt -m 0x3 & 16spdk_tgt_pid=$! 17trap 'kill -9 ${spdk_tgt_pid}; exit 1' SIGINT SIGTERM EXIT 18 19waitforlisten $spdk_tgt_pid 20 21$rpc_py bdev_nvme_attach_controller -b Nvme0 -t PCIe -a ${bdf} 22 23# 1) Test bdev_nvme_apply_firmware RPC 24# NOTE: We don't want to do real firmware update on CI 25 26# Make sure that used firmware file doesn't exist 27if [ -f non_existing_file ]; then 28 exit 1 29fi 30 31# a) Try to apply firmware from non existing file 32$rpc_py bdev_nvme_apply_firmware non_existing_file Nvme0n1 || rv=$? 33if [ -z "$rv" ]; then 34 exit 1 35fi 36 37$rpc_py bdev_nvme_detach_controller Nvme0 38 39trap - SIGINT SIGTERM EXIT 40killprocess $spdk_tgt_pid 41