xref: /spdk/test/external_code/test_make.sh (revision b30d57cdad6d2bc75cc1e4e2ebbcebcb0d98dcfa)
1#!/usr/bin/env bash
2
3test_root=$(readlink -f $(dirname $0))
4rootdir="$test_root/../.."
5
6source "$rootdir/test/common/autotest_common.sh"
7
8set -e
9SPDK_DIR=$1
10
11if [ -z "$EXTERNAL_MAKE_HUGEMEM" ]; then
12	EXTERNAL_MAKE_HUGEMEM=$HUGEMEM
13fi
14
15# Skip all pci devices. These tests don't rely on them.
16sudo PCI_ALLOWED="NONE" HUGEMEM="$EXTERNAL_MAKE_HUGEMEM" $SPDK_DIR/scripts/setup.sh
17
18make -C $SPDK_DIR clean
19$SPDK_DIR/configure --with-shared --without-isal --without-ocf --disable-asan
20make -C $SPDK_DIR -j$(nproc)
21
22export SPDK_HEADER_DIR="$SPDK_DIR/include"
23export SPDK_LIB_DIR="$SPDK_DIR/build/lib"
24export DPDK_LIB_DIR="${SPDK_RUN_EXTERNAL_DPDK:-$SPDK_DIR/dpdk/build}/lib"
25export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$SPDK_LIB_DIR:$DPDK_LIB_DIR:"$test_root/passthru"
26
27# The default target is to make both the app and bdev and link them against the combined SPDK shared library libspdk.so.
28run_test "external_make_tc1" make -C $test_root hello_world_bdev_shared_combo
29run_test "external_run_tc1" $test_root/hello_world/hello_bdev --json $test_root/hello_world/bdev_external.json -b TestPT
30
31make -C $test_root clean
32
33# Make just the application linked against the combined SPDK shared library libspdk.so.
34run_test "external_make_tc2" make -C $test_root hello_world_no_bdev_shared_combo
35run_test "external_run_tc2" $test_root/hello_world/hello_bdev --json $test_root/hello_world/bdev.json -b Malloc0
36
37make -C $test_root clean
38
39# Make both the application and bdev against individual SPDK shared libraries.
40run_test "external_make_tc3" make -C $test_root hello_world_bdev_shared_iso
41run_test "external_run_tc3" $test_root/hello_world/hello_bdev --json $test_root/hello_world/bdev_external.json -b TestPT
42
43make -C $test_root clean
44
45# Make just the application linked against individual SPDK shared libraries.
46run_test "external_make_tc4" make -C $test_root hello_world_no_bdev_shared_iso
47run_test "external_run_tc4" $test_root/hello_world/hello_bdev --json $test_root/hello_world/bdev.json -b Malloc0
48
49make -C $test_root clean
50
51make -C $SPDK_DIR clean
52$SPDK_DIR/configure --without-shared --without-isal --without-ocf --disable-asan
53make -C $SPDK_DIR -j$(nproc)
54
55# Make both the application and bdev against individual SPDK archives.
56run_test "external_make_tc5" make -C $test_root hello_world_bdev_static
57run_test "external_run_tc5" $test_root/hello_world/hello_bdev --json $test_root/hello_world/bdev_external.json -b TestPT
58
59make -C $test_root clean
60
61# Make just the application linked against individual SPDK archives.
62run_test "external_make_tc6" make -C $test_root hello_world_no_bdev_static
63run_test "external_run_tc6" $test_root/hello_world/hello_bdev --json $test_root/hello_world/bdev.json -b Malloc0
64
65make -C $test_root clean
66make -C $SPDK_DIR -j$(nproc) clean
67
68sudo PCI_ALLOWED="NONE" HUGEMEM="$HUGEMEM" $SPDK_DIR/scripts/setup.sh reset
69