1# SPDX-License-Identifier: BSD-3-Clause 2# Copyright (C) 2020 Intel Corporation 3# All rights reserved. 4# 5 6source $rootdir/scripts/common.sh 7source $rootdir/test/common/autotest_common.sh 8 9rpc_py=$rootdir/scripts/rpc.py 10 11function clear_nvme() { 12 mapfile -t bdf < <(get_first_nvme_bdf) 13 14 # Clear metadata on NVMe device 15 $rootdir/scripts/setup.sh reset 16 17 name=$(get_nvme_name_from_bdf "${bdf[0]}") 18 mountpoints=$(lsblk /dev/$name --output MOUNTPOINT -n | wc -w) 19 if [ "$mountpoints" != "0" ]; then 20 exit 1 21 fi 22 dd if=/dev/zero of=/dev/$name bs=1M count=1000 oflag=direct 23 $rootdir/scripts/setup.sh 24} 25