xref: /spdk/test/blobstore/blobstore.sh (revision eb53c23236cccb6b698b7ca70ee783da1c574b5f)
1835e5bc2SHailiang Wang#!/usr/bin/env bash
2*eb53c232Spaul luse#  SPDX-License-Identifier: BSD-3-Clause
3*eb53c232Spaul luse#  Copyright (C) 2017 Intel Corporation
4*eb53c232Spaul luse#  All rights reserved.
5*eb53c232Spaul luse#
6fb9c4ee6SKarol LateckiSYSTEM=$(uname -s)
7835e5bc2SHailiang Wangif [ $SYSTEM = "FreeBSD" ]; then
8835e5bc2SHailiang Wang	echo "blobstore.sh cannot run on FreeBSD currently."
9835e5bc2SHailiang Wang	exit 0
10835e5bc2SHailiang Wangfi
11835e5bc2SHailiang Wang
12835e5bc2SHailiang Wangtestdir=$(readlink -f $(dirname $0))
13835e5bc2SHailiang Wangrootdir=$(readlink -f $testdir/../..)
14c9e5d2a6SSeth Howellsource $rootdir/test/common/autotest_common.sh
15835e5bc2SHailiang Wang
16835e5bc2SHailiang Wang# Nvme0 target configuration
17a70a338fSMichal Berger"$rootdir/scripts/gen_nvme.sh" --json-with-subsystems -n 1 > "$testdir/blobcli.json"
18835e5bc2SHailiang Wang
19a0e22e13Spaul luse# generate random data file for import/export diff
20a0e22e13Spaul lusedd if=/dev/urandom of=$testdir/test.pattern bs=1M count=1
21835e5bc2SHailiang Wang
22844c8ec3SMichal Berger(cd $testdir \
236a41e84cSWANGHAILIANG	&& $SPDK_EXAMPLE_DIR/blobcli -j $testdir/blobcli.json -b Nvme0n1 -T $testdir/test.bs > $testdir/btest.out)
24a0e22e13Spaul luse
25a0e22e13Spaul luse# the test script will import the test pattern generated by dd and then export
26a0e22e13Spaul luse# it to a file so we can compare and confirm basic read and write
27a0e22e13Spaul luse$rootdir/test/app/match/match -v $testdir/btest.out.match
28a0e22e13Spaul lusediff $testdir/test.pattern $testdir/test.pattern.blob
29a0e22e13Spaul luse
30a0e22e13Spaul luserm -rf $testdir/btest.out
316a41e84cSWANGHAILIANGrm -rf $testdir/blobcli.json
32a0e22e13Spaul luserm -rf $testdir/*.blob
33a0e22e13Spaul luserm -rf $testdir/test.pattern
34