btrfs-progs: tests: Add new test case for file extent false alerts
[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 }
67
68 # main()
69 if ! [ -f configure.ac ]; then
70         echo "Please run me from the top directory"
71         exit 1
72 fi
73
74 verdict=
75 conf=
76 build_make_targets
77
78 conf='--disable-documentation'
79 build_make_targets
80
81 conf='--disable-backtrace'
82 build_make_targets
83
84 conf='--disable-convert'
85 build_make_targets
86
87 echo "---------------------------------------------------"
88 echo "$verdict"