xref: /spdk/test/blobstore/blobstore.sh (revision 60982c759db49b4f4579f16e3b24df0725ba4b94)
1#!/usr/bin/env bash
2#  SPDX-License-Identifier: BSD-3-Clause
3#  Copyright (C) 2017 Intel Corporation
4#  All rights reserved.
5#
6SYSTEM=$(uname -s)
7if [ $SYSTEM = "FreeBSD" ]; then
8	echo "blobstore.sh cannot run on FreeBSD currently."
9	exit 0
10fi
11
12testdir=$(readlink -f $(dirname $0))
13rootdir=$(readlink -f $testdir/../..)
14source $rootdir/test/common/autotest_common.sh
15
16# Nvme0 target configuration
17"$rootdir/scripts/gen_nvme.sh" --json-with-subsystems -n 1 > "$testdir/blobcli.json"
18
19# generate random data file for import/export diff
20dd if=/dev/urandom of=$testdir/test.pattern bs=1M count=1
21
22(cd $testdir \
23	&& $SPDK_EXAMPLE_DIR/blobcli -j $testdir/blobcli.json -b Nvme0n1 -T $testdir/test.bs > $testdir/btest.out)
24
25# the test script will import the test pattern generated by dd and then export
26# it to a file so we can compare and confirm basic read and write
27$rootdir/test/app/match/match -v $testdir/btest.out.match
28diff $testdir/test.pattern $testdir/test.pattern.blob
29
30rm -rf $testdir/btest.out
31rm -rf $testdir/blobcli.json
32rm -rf $testdir/*.blob
33rm -rf $testdir/test.pattern
34