diff --git a/autobuild.sh b/autobuild.sh index 9fd887e3a..51c80b93c 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -14,6 +14,16 @@ cd $rootdir date -u git describe --tags +if [ "$SPDK_TEST_OCF" -eq 1 ]; then + # We compile OCF sources ourselves + # They don't need to be checked with scanbuild and code coverage is not applicable + # So we precompile OCF now for further use as standalone static library + ./configure $(echo $config_params | sed 's/--enable-coverage//g') + CC=gcc CCAR=ar $MAKE $MAKEFLAGS -C lib/bdev/ocf/env exportlib O=$rootdir/build/ocf.a + # Set config to use precompiled library + config_params="$config_params --with-ocf=/$rootdir/build/ocf.a" +fi + ./configure $config_params # Print some test system info out for the log diff --git a/autotest.sh b/autotest.sh index 7fe3c3947..c37fdef67 100755 --- a/autotest.sh +++ b/autotest.sh @@ -192,6 +192,10 @@ if [ $SPDK_TEST_RBD -eq 1 ]; then run_test suite ./test/spdkcli/rbd.sh fi +if [ $SPDK_TEST_OCF -eq 1 ]; then + run_test suite ./test/ocf/ocf.sh +fi + run_test suite ./test/json_config/json_config.sh timing_enter cleanup diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index 0fad11fe8..3f257e4b9 100644 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -61,6 +61,7 @@ fi : ${SPDK_RUN_INSTALLED_DPDK=1}; export SPDK_RUN_INSTALLED_DPDK : ${SPDK_TEST_CRYPTO=1}; export SPDK_TEST_CRYPTO : ${SPDK_TEST_FTL=0}; export SPDK_TEST_FTL +: ${SPDK_TEST_OCF=1}; export SPDK_TEST_OCF if [ -z "$DEPENDENCY_DIR" ]; then export DEPENDENCY_DIR=/home/sys_sgsw @@ -88,6 +89,10 @@ if [ $SPDK_TEST_CRYPTO -eq 1 ]; then config_params+=' --with-crypto' fi +if [ $SPDK_TEST_OCF -eq 1 ]; then + config_params+=" --with-ocf=/usr/src/ocf" +fi + export UBSAN_OPTIONS='halt_on_error=1:print_stacktrace=1:abort_on_error=1' # On Linux systems, override the default HUGEMEM in scripts/setup.sh to diff --git a/test/ocf/integrity/fio-mallocs.sh b/test/ocf/integrity/fio-mallocs.sh new file mode 100755 index 000000000..0563475e3 --- /dev/null +++ b/test/ocf/integrity/fio-mallocs.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +curdir=$(dirname $(readlink -f "$BASH_SOURCE")) +rootdir=$(readlink -f $curdir/../../..) +plugindir=$rootdir/examples/bdev/fio_plugin + +source $rootdir/test/common/autotest_common.sh + +function fio_verify(){ + LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio $curdir/test.fio --aux-path=/tmp/ --ioengine=spdk_bdev $@ +} + +fio_verify --filename=MalCache1:MalCache2 --spdk_conf=$curdir/mallocs.conf diff --git a/test/ocf/integrity/mallocs.conf b/test/ocf/integrity/mallocs.conf new file mode 100644 index 000000000..a26acc6e2 --- /dev/null +++ b/test/ocf/integrity/mallocs.conf @@ -0,0 +1,9 @@ + +[Malloc] + NumberOfLuns 4 + LunSizeInMB 300 + BlockSize 512 + +[OCF] + OCF MalCache1 wt Malloc0 Malloc1 + OCF MalCache2 pt Malloc2 Malloc3 diff --git a/test/ocf/integrity/test.fio b/test/ocf/integrity/test.fio new file mode 100644 index 000000000..d2f84382c --- /dev/null +++ b/test/ocf/integrity/test.fio @@ -0,0 +1,39 @@ +[global] +thread=1 +group_reporting=1 +direct=1 +norandommap=1 +time_based=1 +do_verify=1 +verify=md5 +verify_backlog=1024 +iodepth=128 +bs=4K +runtime=10 + +size=20% + +[job_1] +offset=0 +rw=randwrite +name=randwrite + +[job_2] +offset=20% +rw=randrw +name=randrw + +[job_3] +offset=40% +rw=write +name=write + +[job_4] +offset=60% +rw=rw +name=rw + +[job_5] +offset=80% +rw=randwrite +name=randwrite diff --git a/test/ocf/ocf.sh b/test/ocf/ocf.sh new file mode 100755 index 000000000..d8e3ffbce --- /dev/null +++ b/test/ocf/ocf.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +testdir=$(readlink -f $(dirname $0)) +rootdir=$(readlink -f $testdir/../..) + +source $rootdir/test/common/autotest_common.sh + +function suite() +{ + timing_enter "$@" + run_test suite "$@" + timing_exit "$@" +} + +timing_enter ocf + +suite "$testdir/integrity/fio-mallocs.sh" + +timing_exit ocf