]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/env bash |
2 | ||
3 | set -e | |
4 | ||
9f95a23c TL |
5 | # If the configuration of tests is not provided, no tests will be carried out. |
6 | if [[ ! -f $1 ]]; then | |
7 | echo "ERROR: SPDK test configuration not specified" | |
8 | exit 1 | |
9 | fi | |
10 | ||
11 | source "$1" | |
12 | ||
7c673cae | 13 | rootdir=$(readlink -f $(dirname $0)) |
11fdf7f2 | 14 | source "$rootdir/test/common/autotest_common.sh" |
7c673cae FG |
15 | |
16 | out=$PWD | |
17 | ||
18 | umask 022 | |
19 | ||
20 | cd $rootdir | |
21 | ||
22 | date -u | |
23 | git describe --tags | |
24 | ||
9f95a23c TL |
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" | |
34 | fi | |
35 | ||
7c673cae FG |
36 | ./configure $config_params |
37 | ||
11fdf7f2 TL |
38 | # Print some test system info out for the log |
39 | echo "** START ** Info for Hostname: $HOSTNAME" | |
40 | uname -a | |
41 | $MAKE cc_version | |
42 | $MAKE cxx_version | |
43 | echo "** END ** Info for Hostname: $HOSTNAME" | |
44 | ||
45 | timing_enter autobuild | |
46 | ||
7c673cae | 47 | timing_enter check_format |
11fdf7f2 TL |
48 | if [ $SPDK_RUN_CHECK_FORMAT -eq 1 ]; then |
49 | ./scripts/check_format.sh | |
50 | fi | |
7c673cae FG |
51 | timing_exit check_format |
52 | ||
7c673cae | 53 | scanbuild='' |
11fdf7f2 TL |
54 | make_timing_label='make' |
55 | if [ $SPDK_RUN_SCANBUILD -eq 1 ] && hash scan-build; then | |
7c673cae | 56 | scanbuild="scan-build -o $out/scan-build-tmp --status-bugs" |
11fdf7f2 TL |
57 | make_timing_label='scanbuild_make' |
58 | report_test_completion "scanbuild" | |
59 | ||
7c673cae FG |
60 | fi |
61 | ||
11fdf7f2 TL |
62 | if [ $SPDK_RUN_VALGRIND -eq 1 ]; then |
63 | report_test_completion "valgrind" | |
64 | fi | |
65 | ||
66 | if [ $SPDK_RUN_ASAN -eq 1 ]; then | |
67 | report_test_completion "asan" | |
68 | fi | |
69 | ||
70 | if [ $SPDK_RUN_UBSAN -eq 1 ]; then | |
71 | report_test_completion "ubsan" | |
72 | fi | |
7c673cae | 73 | |
11fdf7f2 TL |
74 | echo $scanbuild |
75 | ||
76 | timing_enter "$make_timing_label" | |
9f95a23c TL |
77 | |
78 | $MAKE $MAKEFLAGS clean | |
79 | if [ $SPDK_BUILD_SHARED_OBJECT -eq 1 ]; then | |
80 | ./configure $config_params --with-shared | |
81 | $MAKE $MAKEFLAGS | |
82 | $MAKE $MAKEFLAGS clean | |
83 | report_test_completion "shared_object_build" | |
84 | fi | |
85 | ||
7c673cae | 86 | fail=0 |
11fdf7f2 | 87 | ./configure $config_params |
7c673cae FG |
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 | |
95 | fi | |
96 | exit 1 | |
97 | else | |
98 | rm -rf $out/scan-build-tmp | |
99 | fi | |
11fdf7f2 TL |
100 | timing_exit "$make_timing_label" |
101 | ||
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:" | |
9f95a23c | 106 | git status --porcelain --ignore-submodules |
11fdf7f2 TL |
107 | exit 1 |
108 | fi | |
109 | timing_exit generated_files_check | |
7c673cae FG |
110 | |
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. | |
11fdf7f2 | 114 | timing_enter dependency_check |
7c673cae FG |
115 | STAT1=`stat examples/nvme/identify/identify` |
116 | sleep 1 | |
117 | touch lib/nvme/nvme_internal.h | |
118 | $MAKE $MAKEFLAGS | |
119 | STAT2=`stat examples/nvme/identify/identify` | |
120 | ||
121 | if [ "$STAT1" == "$STAT2" ]; then | |
122 | echo "Header dependency check failed" | |
123 | exit 1 | |
124 | fi | |
11fdf7f2 | 125 | timing_exit dependency_check |
7c673cae | 126 | |
11fdf7f2 TL |
127 | # Test 'make install' |
128 | timing_enter make_install | |
129 | rm -rf /tmp/spdk | |
130 | mkdir /tmp/spdk | |
131 | $MAKE $MAKEFLAGS install DESTDIR=/tmp/spdk prefix=/usr | |
11fdf7f2 | 132 | timing_exit make_install |
7c673cae | 133 | |
9f95a23c TL |
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 | |
140 | ls -lR /tmp/spdk | |
141 | rm -rf /tmp/spdk | |
142 | echo "Make uninstall failed" | |
143 | exit 1 | |
144 | else | |
145 | rm -rf /tmp/spdk | |
146 | fi | |
147 | timing_exit make_uninstall | |
148 | ||
7c673cae | 149 | timing_enter doxygen |
11fdf7f2 TL |
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!" | |
155 | exit 1 | |
156 | fi | |
157 | if hash pdflatex 2>/dev/null; then | |
158 | $MAKE -C "$rootdir"/doc/output/latex --no-print-directory $MAKEFLAGS &>> "$out"/doxygen.log | |
159 | fi | |
7c673cae FG |
160 | mkdir -p "$out"/doc |
161 | mv "$rootdir"/doc/output/html "$out"/doc | |
11fdf7f2 TL |
162 | if [ -f "$rootdir"/doc/output/latex/refman.pdf ]; then |
163 | mv "$rootdir"/doc/output/latex/refman.pdf "$out"/doc/spdk.pdf | |
164 | fi | |
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 | |
168 | fi | |
7c673cae FG |
169 | rm -rf "$rootdir"/doc/output |
170 | fi | |
171 | timing_exit doxygen | |
172 | ||
173 | timing_exit autobuild |