Btrfs progs v4.10.2
[btrfs-progs-unstable/devel.git] / tests / build-tests.sh
blob4dc8744e232667deba5253124ea734bd0f1d561d
1 #!/bin/sh
2 # test various compilation options
3 # - 32bit, 64bit
4 # - dynamic, static
5 # - various configure options
7 # Arguments: anything will be passed to 'make', eg. define CC, D, V
9 # Requirements for full coverage:
10 # - static version of all libs
11 # - 32bit/64bit libraries, also the static variants
13 make=make
14 opts="-j16 $@"
16 conf=
17 target=
19 function die() {
20 echo "ERROR: $@"
21 exit 1
24 function check_result() {
25 local ret
26 local str
28 ret=$1
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"
40 function buildme() {
41 make clean-all
43 ./autogen.sh && configure "$conf" || die "configure not working with: $@"
44 $make clean
45 $make $opts $target
46 check_result "$?"
47 echo "VERDICT: $verdict"
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
71 # main()
72 if ! [ -f configure.ac ]; then
73 echo "Please run me from the top directory"
74 exit 1
77 verdict=
78 conf=
79 build_make_targets
81 conf='--disable-documentation'
82 build_make_targets
84 conf='--disable-backtrace'
85 build_make_targets
87 conf='--disable-convert'
88 build_make_targets
90 echo "---------------------------------------------------"
91 echo "$verdict"