xref: /spdk/autobuild.sh (revision 3a162b19e3168db056f876f195beed09b5d1d235)
1#!/usr/bin/env bash
2#  SPDX-License-Identifier: BSD-3-Clause
3#  Copyright (C) 2015 Intel Corporation
4#  All rights reserved.
5#
6
7rootdir=$(readlink -f $(dirname $0))
8
9source "$rootdir/test/common/autobuild_common.sh"
10
11SPDK_TEST_AUTOBUILD=${SPDK_TEST_AUTOBUILD:-}
12umask 022
13cd $rootdir
14
15# Print some test system info out for the log
16date -u
17git describe --tags
18
19if [ $SPDK_RUN_ASAN -eq 1 ]; then
20	run_test "asan" echo "using asan"
21fi
22
23if [ $SPDK_RUN_UBSAN -eq 1 ]; then
24	run_test "ubsan" echo "using ubsan"
25fi
26
27if [ -n "$SPDK_TEST_NATIVE_DPDK" ]; then
28	build_native_dpdk
29fi
30
31case "$SPDK_TEST_AUTOBUILD" in
32	full)
33		$rootdir/configure $config_params
34		echo "** START ** Info for Hostname: $HOSTNAME"
35		uname -a
36		$MAKE cc_version
37		$MAKE cxx_version
38		echo "** END ** Info for Hostname: $HOSTNAME"
39		;;
40	ext | tiny | "") ;;
41	*)
42		echo "ERROR: supported values for SPDK_TEST_AUTOBUILD are 'full', 'tiny' and 'ext'"
43		exit 1
44		;;
45esac
46
47if [[ $SPDK_TEST_OCF -eq 1 ]]; then
48	ocf_precompile
49fi
50
51if [[ $SPDK_TEST_FUZZER -eq 1 ]]; then
52	llvm_precompile
53fi
54
55if [[ -n $SPDK_TEST_AUTOBUILD ]]; then
56	autobuild_test_suite
57elif [[ $SPDK_TEST_UNITTEST -eq 1 ]]; then
58	unittest_build
59elif [[ $SPDK_TEST_SCANBUILD -eq 1 ]]; then
60	scanbuild_make
61else
62	if [[ $SPDK_TEST_FUZZER -eq 1 ]]; then
63		# if we are testing nvmf fuzz with llvm lib, --with-shared will cause lib link fail
64		$rootdir/configure $config_params
65	else
66		# if we aren't testing the unittests, build with shared objects.
67		$rootdir/configure $config_params --with-shared
68	fi
69	# shellcheck disable=SC2031
70	run_test "make" $MAKE $MAKEFLAGS
71fi
72