resetting manifest requested domain to floor
[platform/upstream/btrfs-progs.git] / tests / build-tests.sh
1 #!/bin/sh
2 # test various compilation options
3 # - 32bit, 64bit
4 # - dynamic, static
5 # - various configure options
6 #
7 # Arguments: anything will be passed to 'make', eg. define CC, D, V
8 #
9 # Requirements for full coverage:
10 # - static version of all libs
11 # - 32bit/64bit libraries, also the static variants
12
13 make=make
14 opts="-j16 $@"
15
16 conf=
17 target=
18
19 function die() {
20         echo "ERROR: $@"
21         exit 1
22 }
23
24 function check_result() {
25         local ret
26         local str
27
28         ret=$1
29
30         str="RESULT of target($target) conf($conf): "
31         case $ret in
32                 0) str="$str OK";;
33                 *) str="$str FAIL";;
34         esac
35         echo "$str"
36         verdict="$verdict
37 $str"
38 }
39
40 function buildme() {
41         make clean-all
42
43         ./autogen.sh && configure "$conf" || die "configure not working with: $@"
44         $make clean
45         $make $opts $target
46         check_result "$?"
47         echo "VERDICT: $verdict"
48 }
49
50 function build_make_targets() {
51         # defaults
52         target=
53         buildme
54         # defaults, static
55         target=static
56         buildme
57         # defaults, 32bit
58         target="EXTRA_CFLAGS=-m32"
59         buildme
60         # defaults, 64bit
61         target="EXTRA_CFLAGS=-m64"
62         buildme
63         # defaults, library
64         target="library-test"
65         buildme
66         # defaults, static library
67         target="library-test.static"
68         buildme
69 }
70
71 # main()
72 if ! [ -f configure.ac ]; then
73         echo "Please run me from the top directory"
74         exit 1
75 fi
76
77 verdict=
78 conf=
79 build_make_targets
80
81 conf='--disable-documentation'
82 build_make_targets
83
84 conf='--disable-backtrace'
85 build_make_targets
86
87 conf='--disable-convert'
88 build_make_targets
89
90 conf='--with-convert=ext2'
91 build_make_targets
92
93 conf='--with-convert=ext2,reiserfs'
94 build_make_targets
95
96 conf='--enable-zstd'
97 build_make_targets
98
99 # debugging builds, just the default targets
100 target='D=1'
101 buildme
102
103 target='D=asan'
104 buildme
105
106 target='D=tsan'
107 buildme
108
109 target='D=ubsan'
110 buildme
111
112 echo "---------------------------------------------------"
113 echo "$verdict"