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