5 # If the configuration of tests is not provided, no tests will be carried out.
7 echo "ERROR: SPDK test configuration not specified"
13 rootdir
=$
(readlink
-f $
(dirname $0))
14 source "$rootdir/test/common/autotest_common.sh"
25 if [ "$SPDK_TEST_OCF" -eq 1 ]; then
26 # We compile OCF sources ourselves
27 # They don't need to be checked with scanbuild and code coverage is not applicable
28 # So we precompile OCF now for further use as standalone static library
29 .
/configure $
(echo $config_params |
sed 's/--enable-coverage//g')
30 $MAKE $MAKEFLAGS include
/spdk
/config.h
31 CC
=gcc CCAR
=ar $MAKE $MAKEFLAGS -C lib
/bdev
/ocf
/env exportlib O
=$rootdir/build
/ocf.a
32 # Set config to use precompiled library
33 config_params
="$config_params --with-ocf=/$rootdir/build/ocf.a"
36 .
/configure
$config_params
38 # Print some test system info out for the log
39 echo "** START ** Info for Hostname: $HOSTNAME"
43 echo "** END ** Info for Hostname: $HOSTNAME"
45 timing_enter autobuild
47 timing_enter check_format
48 if [ $SPDK_RUN_CHECK_FORMAT -eq 1 ]; then
49 .
/scripts
/check_format.sh
51 timing_exit check_format
54 make_timing_label
='make'
55 if [ $SPDK_RUN_SCANBUILD -eq 1 ] && hash scan-build
; then
56 scanbuild
="scan-build -o $out/scan-build-tmp --status-bugs"
57 make_timing_label
='scanbuild_make'
58 report_test_completion
"scanbuild"
62 if [ $SPDK_RUN_VALGRIND -eq 1 ]; then
63 report_test_completion
"valgrind"
66 if [ $SPDK_RUN_ASAN -eq 1 ]; then
67 report_test_completion
"asan"
70 if [ $SPDK_RUN_UBSAN -eq 1 ]; then
71 report_test_completion
"ubsan"
76 timing_enter
"$make_timing_label"
78 $MAKE $MAKEFLAGS clean
79 if [ $SPDK_BUILD_SHARED_OBJECT -eq 1 ]; then
80 .
/configure
$config_params --with-shared
82 $MAKE $MAKEFLAGS clean
83 report_test_completion
"shared_object_build"
87 .
/configure
$config_params
88 time $scanbuild $MAKE $MAKEFLAGS || fail
=1
89 if [ $fail -eq 1 ]; then
90 if [ -d $out/scan-build-tmp
]; then
91 scanoutput
=$
(ls -1 $out/scan-build-tmp
/)
92 mv $out/scan-build-tmp
/$scanoutput $out/scan-build
93 rm -rf $out/scan-build-tmp
94 chmod -R a
+rX
$out/scan-build
98 rm -rf $out/scan-build-tmp
100 timing_exit
"$make_timing_label"
102 # Check for generated files that are not listed in .gitignore
103 timing_enter generated_files_check
104 if [ `git status --porcelain --ignore-submodules | wc -l` -ne 0 ]; then
105 echo "Generated files missing from .gitignore:"
106 git status
--porcelain --ignore-submodules
109 timing_exit generated_files_check
111 # Check that header file dependencies are working correctly by
112 # capturing a binary's stat data before and after touching a
113 # header file and re-making.
114 timing_enter dependency_check
115 STAT1
=`stat examples/nvme/identify/identify`
117 touch lib
/nvme
/nvme_internal.h
119 STAT2
=`stat examples/nvme/identify/identify`
121 if [ "$STAT1" == "$STAT2" ]; then
122 echo "Header dependency check failed"
125 timing_exit dependency_check
127 # Test 'make install'
128 timing_enter make_install
131 $MAKE $MAKEFLAGS install DESTDIR
=/tmp
/spdk prefix
=/usr
132 timing_exit make_install
134 # Test 'make uninstall'
135 timing_enter make_uninstall
136 # Create empty file to check if it is not deleted by target uninstall
137 touch /tmp
/spdk
/usr
/lib
/sample_xyz.a
138 $MAKE $MAKEFLAGS uninstall DESTDIR
=/tmp
/spdk prefix
=/usr
139 if [[ $
(ls -A /tmp
/spdk
/usr |
wc -l) -ne 2 ]] ||
[[ $
(ls -A /tmp
/spdk
/usr
/lib
/ |
wc -l) -ne 1 ]]; then
142 echo "Make uninstall failed"
147 timing_exit make_uninstall
150 if [ $SPDK_BUILD_DOC -eq 1 ] && hash doxygen
; then
151 $MAKE -C "$rootdir"/doc
--no-print-directory $MAKEFLAGS &> "$out"/doxygen.log
152 if [ -s "$out"/doxygen.log
]; then
153 cat "$out"/doxygen.log
154 echo "Doxygen errors found!"
157 if hash pdflatex
2>/dev
/null
; then
158 $MAKE -C "$rootdir"/doc
/output
/latex
--no-print-directory $MAKEFLAGS &>> "$out"/doxygen.log
161 mv "$rootdir"/doc
/output
/html
"$out"/doc
162 if [ -f "$rootdir"/doc
/output
/latex
/refman.pdf
]; then
163 mv "$rootdir"/doc
/output
/latex
/refman.pdf
"$out"/doc
/spdk.pdf
165 $MAKE -C "$rootdir"/doc
--no-print-directory $MAKEFLAGS clean
&>> "$out"/doxygen.log
166 if [ -s "$out"/doxygen.log
]; then
167 rm "$out"/doxygen.log
169 rm -rf "$rootdir"/doc
/output
173 timing_exit autobuild