1#!/usr/bin/env bash 2# SPDX-License-Identifier: BSD-3-Clause 3# Copyright (C) 2020 Intel Corporation 4# All rights reserved. 5# 6test_root=$(readlink -f $(dirname $0)) 7rootdir="$test_root/../.." 8 9source "$rootdir/test/common/autotest_common.sh" 10 11set -e 12SPDK_DIR=$1 13 14if [ -z "$EXTERNAL_MAKE_HUGEMEM" ]; then 15 EXTERNAL_MAKE_HUGEMEM=$HUGEMEM 16fi 17 18sudo HUGEMEM="$EXTERNAL_MAKE_HUGEMEM" $SPDK_DIR/scripts/setup.sh 19 20if [ -n "$SPDK_RUN_EXTERNAL_DPDK" ]; then 21 WITH_DPDK="--with-dpdk=$SPDK_RUN_EXTERNAL_DPDK" 22fi 23if [[ -e $SPDK_DIR/mk/config.mk ]]; then 24 make -C $SPDK_DIR clean 25fi 26$SPDK_DIR/configure --with-shared --without-ocf --disable-asan $WITH_DPDK 27make -C $SPDK_DIR -j$(nproc) 28 29export SPDK_HEADER_DIR="$SPDK_DIR/include" 30export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$test_root/passthru" 31export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$test_root/accel" 32_sudo="sudo -E --preserve-env=PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH" 33 34# Make just the application linked against individual SPDK shared libraries. 35run_test "external_make_accel_module_shared" make -C $test_root accel_module_shared 36run_test "external_run_accel_module_shared" $_sudo $test_root/accel/module \ 37 --json $test_root/accel/module.json 38 39make -C $test_root clean 40 41# Make just the application linked against individual SPDK shared libraries. 42run_test "external_make_accel_driver_shared" make -C $test_root accel_driver_shared 43run_test "external_run_accel_driver_shared" $_sudo $test_root/accel/driver \ 44 --json $test_root/accel/driver.json 45 46make -C $test_root clean 47 48# The default target is to make both the app and bdev and link them against the combined SPDK shared library libspdk.so. 49run_test "external_make_hello_bdev_shared_combo" make -C $test_root hello_world_bdev_shared_combo 50run_test "external_run_hello_bdev_shared_combo" $_sudo $test_root/hello_world/hello_bdev \ 51 --json $test_root/hello_world/bdev_external.json -b TestPT 52 53make -C $test_root clean 54 55# Make just the application linked against the combined SPDK shared library libspdk.so. 56run_test "external_make_hello_no_bdev_shared_combo" make -C $test_root hello_world_no_bdev_shared_combo 57run_test "external_run_hello_no_bdev_shared_combo" $_sudo $test_root/hello_world/hello_bdev \ 58 --json $test_root/hello_world/bdev.json -b Malloc0 59 60make -C $test_root clean 61 62# Make both the application and bdev against individual SPDK shared libraries. 63run_test "external_make_hello_bdev_shared_iso" make -C $test_root hello_world_bdev_shared_iso 64run_test "external_run_hello_bdev_shared_iso" $_sudo $test_root/hello_world/hello_bdev \ 65 --json $test_root/hello_world/bdev_external.json -b TestPT 66 67make -C $test_root clean 68 69# Make just the application linked against individual SPDK shared libraries. 70run_test "external_make_hello_no_bdev_shared_iso" make -C $test_root hello_world_no_bdev_shared_iso 71run_test "external_run_hello_no_bdev_shared_iso" $_sudo $test_root/hello_world/hello_bdev \ 72 --json $test_root/hello_world/bdev.json -b Malloc0 73 74# Make the basic NVMe driver linked against individual shared SPDK libraries. 75run_test "external_make_nvme_shared" make -C $test_root nvme_shared 76run_test "external_run_nvme_shared" $_sudo $test_root/nvme/identify.sh 77 78make -C $test_root clean 79 80make -C $SPDK_DIR clean 81$SPDK_DIR/configure --without-shared --without-ocf --disable-asan $WITH_DPDK 82make -C $SPDK_DIR -j$(nproc) 83 84# Make just the application linked against individual SPDK archives. 85run_test "external_make_accel_module_static" make -C $test_root accel_module_static 86run_test "external_run_accel_module_static" $_sudo $test_root/accel/module \ 87 --json $test_root/accel/module.json 88 89make -C $test_root clean 90 91# Make just the application linked against individual SPDK archives. 92run_test "external_make_accel_driver_static" make -C $test_root accel_driver_static 93run_test "external_run_accel_driver_static" $_sudo $test_root/accel/driver \ 94 --json $test_root/accel/driver.json 95 96make -C $test_root clean 97 98# Make both the application and bdev against individual SPDK archives. 99run_test "external_make_hello_bdev_static" make -C $test_root hello_world_bdev_static 100run_test "external_run_hello_bdev_static" $_sudo $test_root/hello_world/hello_bdev \ 101 --json $test_root/hello_world/bdev_external.json -b TestPT 102 103make -C $test_root clean 104 105# Make just the application linked against individual SPDK archives. 106run_test "external_make_hello_no_bdev_static" make -C $test_root hello_world_no_bdev_static 107run_test "external_run_hello_no_bdev_static" $_sudo $test_root/hello_world/hello_bdev \ 108 --json $test_root/hello_world/bdev.json -b Malloc0 109 110# Make the basic NVMe driver statically linked against individual SPDK archives. 111run_test "external_make_nvme_static" make -C $test_root nvme_static 112run_test "external_run_nvme_static" $_sudo $test_root/nvme/identify.sh 113 114make -C $test_root clean 115make -C $SPDK_DIR -j$(nproc) clean 116 117sudo HUGEMEM="$HUGEMEM" $SPDK_DIR/scripts/setup.sh reset 118