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 13timing_enter blobstore 14 15# Nvme0 target configuration 16$rootdir/scripts/gen_nvme.sh > $testdir/blobcli.conf 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$rootdir/examples/blob/cli/blobcli -c $testdir/blobcli.conf -b Nvme0n1 -T $testdir/test.bs > $testdir/btest.out) 23 24# the tool leaves some trailing whitespaces that we need to strip out 25sed -i 's/[[:space:]]*$//' $testdir/btest.out 26 27# the test script will import the test pattern generated by dd and then export 28# it to a file so we can compare and confirm basic read and write 29$rootdir/test/app/match/match -v $testdir/btest.out.match 30diff $testdir/test.pattern $testdir/test.pattern.blob 31 32rm -rf $testdir/btest.out 33rm -rf $testdir/blobcli.conf 34rm -rf $testdir/*.blob 35rm -rf $testdir/test.pattern 36 37timing_exit blobstore 38