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 14INSTALL_DIR=$test_root/install 15mkdir -p $INSTALL_DIR 16 17if [ -z "$EXTERNAL_MAKE_HUGEMEM" ]; then 18 EXTERNAL_MAKE_HUGEMEM=$HUGEMEM 19fi 20 21sudo HUGEMEM="$EXTERNAL_MAKE_HUGEMEM" $SPDK_DIR/scripts/setup.sh 22 23if [ -n "$SPDK_RUN_EXTERNAL_DPDK" ]; then 24 WITH_DPDK="--with-dpdk=$SPDK_RUN_EXTERNAL_DPDK" 25fi 26if [[ -e $SPDK_DIR/mk/config.mk ]]; then 27 make -C $SPDK_DIR clean 28fi 29$SPDK_DIR/configure --with-shared --without-ocf --disable-asan $WITH_DPDK 30make -C $SPDK_DIR -j$(nproc) 31make -C $SPDK_DIR DESTDIR=$INSTALL_DIR install -j$(nproc) 32 33export SPDK_HEADER_DIR="$INSTALL_DIR/usr/local/include" 34export SPDK_LIB_DIR="$INSTALL_DIR/usr/local/lib" 35export DPDK_LIB_DIR="$INSTALL_DIR/usr/local/lib" 36export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$test_root/passthru" 37export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$test_root/accel" 38export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$SPDK_LIB_DIR" 39_sudo="sudo -E --preserve-env=PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH" 40 41# Make just the application linked against individual SPDK shared libraries. 42run_test "external_make_accel_module_shared" make -C $test_root accel_module_shared 43run_test "external_run_accel_module_shared" $_sudo $test_root/accel/module \ 44 --json $test_root/accel/module.json 45 46make -C $test_root clean 47 48# Make just the application linked against individual SPDK shared libraries. 49run_test "external_make_accel_driver_shared" make -C $test_root accel_driver_shared 50run_test "external_run_accel_driver_shared" $_sudo $test_root/accel/driver \ 51 --json $test_root/accel/driver.json 52 53make -C $test_root clean 54 55# The default target is to make both the app and bdev and link them against the combined SPDK shared library libspdk.so. 56run_test "external_make_hello_bdev_shared_combo" make -C $test_root hello_world_bdev_shared_combo 57run_test "external_run_hello_bdev_shared_combo" $_sudo $test_root/hello_world/hello_bdev \ 58 --json $test_root/hello_world/bdev_external.json -b TestPT 59 60make -C $test_root clean 61 62# Make just the application linked against the combined SPDK shared library libspdk.so. 63run_test "external_make_hello_no_bdev_shared_combo" make -C $test_root hello_world_no_bdev_shared_combo 64run_test "external_run_hello_no_bdev_shared_combo" $_sudo $test_root/hello_world/hello_bdev \ 65 --json $test_root/hello_world/bdev.json -b Malloc0 66 67make -C $test_root clean 68 69# Make both the application and bdev against individual SPDK shared libraries. 70run_test "external_make_hello_bdev_shared_iso" make -C $test_root hello_world_bdev_shared_iso 71run_test "external_run_hello_bdev_shared_iso" $_sudo $test_root/hello_world/hello_bdev \ 72 --json $test_root/hello_world/bdev_external.json -b TestPT 73 74make -C $test_root clean 75 76# Make just the application linked against individual SPDK shared libraries. 77run_test "external_make_hello_no_bdev_shared_iso" make -C $test_root hello_world_no_bdev_shared_iso 78run_test "external_run_hello_no_bdev_shared_iso" $_sudo $test_root/hello_world/hello_bdev \ 79 --json $test_root/hello_world/bdev.json -b Malloc0 80 81# Make the basic NVMe driver linked against individual shared SPDK libraries. 82run_test "external_make_nvme_shared" make -C $test_root nvme_shared 83run_test "external_run_nvme_shared" $_sudo $test_root/nvme/identify.sh 84 85make -C $test_root clean 86 87make -C $SPDK_DIR clean 88rm -rf $INSTALL_DIR 89$SPDK_DIR/configure --without-shared --without-ocf --disable-asan $WITH_DPDK 90make -C $SPDK_DIR -j$(nproc) 91make -C $SPDK_DIR DESTDIR=$INSTALL_DIR install -j$(nproc) 92 93# Make just the application linked against individual SPDK archives. 94run_test "external_make_accel_module_static" make -C $test_root accel_module_static 95run_test "external_run_accel_module_static" $_sudo $test_root/accel/module \ 96 --json $test_root/accel/module.json 97 98make -C $test_root clean 99 100# Make just the application linked against individual SPDK archives. 101run_test "external_make_accel_driver_static" make -C $test_root accel_driver_static 102run_test "external_run_accel_driver_static" $_sudo $test_root/accel/driver \ 103 --json $test_root/accel/driver.json 104 105make -C $test_root clean 106 107# Make both the application and bdev against individual SPDK archives. 108run_test "external_make_hello_bdev_static" make -C $test_root hello_world_bdev_static 109run_test "external_run_hello_bdev_static" $_sudo $test_root/hello_world/hello_bdev \ 110 --json $test_root/hello_world/bdev_external.json -b TestPT 111 112make -C $test_root clean 113 114# Make just the application linked against individual SPDK archives. 115run_test "external_make_hello_no_bdev_static" make -C $test_root hello_world_no_bdev_static 116run_test "external_run_hello_no_bdev_static" $_sudo $test_root/hello_world/hello_bdev \ 117 --json $test_root/hello_world/bdev.json -b Malloc0 118 119# Make the basic NVMe driver statically linked against individual SPDK archives. 120run_test "external_make_nvme_static" make -C $test_root nvme_static 121run_test "external_run_nvme_static" $_sudo $test_root/nvme/identify.sh 122 123make -C $test_root clean 124make -C $SPDK_DIR -j$(nproc) clean 125rm -rf $INSTALL_DIR 126 127sudo HUGEMEM="$HUGEMEM" $SPDK_DIR/scripts/setup.sh reset 128