xref: /spdk/test/nvme/cmb/cmb_copy.sh (revision eb53c23236cccb6b698b7ca70ee783da1c574b5f)
1#!/usr/bin/env bash
2#  SPDX-License-Identifier: BSD-3-Clause
3#  Copyright (C) 2020 Intel Corporation
4#  All rights reserved.
5#
6
7testdir=$(readlink -f "$(dirname "$0")")
8rootdir=$(readlink -f "$testdir/../../../")
9source "$rootdir/test/common/autotest_common.sh"
10
11nvmes=("$@") all_nvmes=${#nvmes[@]}
12
13# We need 2 ctrls at minimum
14((all_nvmes >= 2))
15
16# Let each ctrl to have its CMB copied to the other device.
17while ((--all_nvmes >= 0)); do
18	read_nvme=${nvmes[all_nvmes]}
19	for nvme_idx in "${!nvmes[@]}"; do
20		[[ ${nvmes[nvme_idx]} == "$read_nvme" ]] && continue
21		"$rootdir/build/examples/cmb_copy" \
22			-r "$read_nvme-1-0-1" \
23			-w "${nvmes[nvme_idx]}-1-0-1" \
24			-c "$read_nvme"
25	done
26done
27