per Intel policy to include file commit date using git cmd below. The policy does not apply to non-Intel (C) notices. git log --follow -C90% --format=%ad --date default <file> | tail -1 and then pull just the year from the result. Intel copyrights were not added to files where Intel either had no contribution ot the contribution lacked substance (ie license header updates, formatting changes, etc) For intel copyrights added, --follow and -C95% were used. Signed-off-by: paul luse <paul.e.luse@intel.com> Change-Id: I2ef86976095b88a9bf5b1003e59f3943cd6bbe4c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15209 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
116 lines
2.4 KiB
Bash
Executable File
116 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
# Copyright (C) 2020 Intel Corporation
|
|
# All rights reserved.
|
|
#
|
|
testdir=$(readlink -f "$(dirname "$0")")
|
|
rootdir=$(readlink -f "$testdir/../../")
|
|
source "$testdir/common.sh"
|
|
|
|
nvmes=("$@")
|
|
|
|
offset_magic() {
|
|
local magic_check
|
|
local offsets offset
|
|
|
|
offsets=(16 64) # * bs
|
|
|
|
for offset in "${offsets[@]}"; do
|
|
"${DD_APP[@]}" \
|
|
--ib="$bdev0" \
|
|
--ob="$bdev1" \
|
|
--count="$count" \
|
|
--seek="$offset" \
|
|
--bs="$bs" \
|
|
--json <(gen_conf)
|
|
|
|
"${DD_APP[@]}" \
|
|
--ib="$bdev1" \
|
|
--of="$test_file1" \
|
|
--count=1 \
|
|
--skip="$offset" \
|
|
--bs="$bs" \
|
|
--json <(gen_conf)
|
|
|
|
read -rn${#magic} magic_check < "$test_file1"
|
|
[[ $magic_check == "$magic" ]]
|
|
done
|
|
}
|
|
|
|
cleanup() {
|
|
# Zero up to 64M on input|output bdev
|
|
clear_nvme "$bdev0" "" $((0x400000 + ${#magic}))
|
|
clear_nvme "$bdev1" "" $((0x400000 + ${#magic}))
|
|
rm -f "$test_file0" "$test_file1" "$aio1"
|
|
}
|
|
|
|
trap "cleanup" EXIT
|
|
|
|
bs=$((1024 << 10))
|
|
|
|
if ((${#nvmes[@]} > 1)); then
|
|
nvme0=Nvme0 bdev0=Nvme0n1 nvme0_pci=${nvmes[0]} # input bdev
|
|
nvme1=Nvme1 bdev1=Nvme1n1 nvme1_pci=${nvmes[1]} # output bdev
|
|
|
|
declare -A method_bdev_nvme_attach_controller_0=(
|
|
["name"]=$nvme0
|
|
["traddr"]=$nvme0_pci
|
|
["trtype"]=pcie
|
|
)
|
|
declare -A method_bdev_nvme_attach_controller_1=(
|
|
["name"]=$nvme1
|
|
["traddr"]=$nvme1_pci
|
|
["trtype"]=pcie
|
|
)
|
|
else
|
|
# Use AIO to compensate lack of actual hardware
|
|
nvme0=Nvme0 bdev0=Nvme0n1 nvme0_pci=${nvmes[0]} # input bdev
|
|
aio1=$SPDK_TEST_STORAGE/aio1 bdev1=aio1 # output bdev
|
|
|
|
declare -A method_bdev_nvme_attach_controller_1=(
|
|
["name"]=$nvme0
|
|
["traddr"]=$nvme0_pci
|
|
["trtype"]=pcie
|
|
)
|
|
declare -A method_bdev_aio_create_0=(
|
|
["name"]=$bdev1
|
|
["filename"]=$aio1
|
|
["block_size"]=4096
|
|
)
|
|
|
|
# 256MB AIO file
|
|
"${DD_APP[@]}" \
|
|
--if=/dev/zero \
|
|
--of="$aio1" \
|
|
--bs="$bs" \
|
|
--count=256
|
|
fi
|
|
|
|
test_file0=$SPDK_TEST_STORAGE/dd.dump0
|
|
test_file1=$SPDK_TEST_STORAGE/dd.dump1
|
|
|
|
magic="This Is Our Magic, find it"
|
|
echo "$magic" > "$test_file0"
|
|
|
|
# Make the file a bit bigger (~64MB)
|
|
run_test "dd_inflate_file" \
|
|
"${DD_APP[@]}" \
|
|
--if=/dev/zero \
|
|
--of="$test_file0" \
|
|
--oflag=append \
|
|
--bs="$bs" \
|
|
--count=64
|
|
|
|
test_file0_size=$(wc -c < "$test_file0")
|
|
|
|
# Now, copy it over to first nvme with default bs (4k)
|
|
run_test "dd_copy_to_out_bdev" \
|
|
"${DD_APP[@]}" \
|
|
--if="$test_file0" \
|
|
--ob="$bdev0" \
|
|
--json <(gen_conf)
|
|
|
|
count=$(((test_file0_size / bs) + 1))
|
|
|
|
run_test "dd_offset_magic" offset_magic
|