File: build-tests.sh

package info (click to toggle)
btrfs-progs 6.17.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,612 kB
  • sloc: ansic: 127,282; sh: 7,915; python: 1,384; makefile: 900; asm: 296
file content (169 lines) | stat: -rwxr-xr-x 2,866 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/bin/bash
# Usage: $0 [--ccache] [make options]
#
# Test various compilation options:
# - native arch
# - dynamic, static
# - various configure options
#
# Arguments:
# - (first argument) --ccache - enable ccache for build which can speed up
#    rebuilding same files if the options do not affect them, the ccache will
#    be created in the toplevel git directory
# - anything else will be passed to 'make', eg. define CC, D, V
#
# Requirements for full coverage:
# - static version of all libs

die() {
	echo "ERROR: $@"
	exit 1
}

check_result() {
	local ret
	local str

	ret=$1

	str="RESULT of target($target) conf($conf) CFLAGS($CFLAGS): "
	case $ret in
		0) str="$str OK";;
		*) str="$str FAIL";;
	esac
	echo "$str"
	verdict="$verdict
$str"
}

buildme() {
	buildme_common
	buildme_common --enable-experimental
}

buildme_common() {
	echo "::group::$CFLAGS configure $conf $@"
	make clean-all
	./autogen.sh && CFLAGS="$CFLAGS" ./configure "$conf" $1 || die "configure not working with: $@"
	$make clean
	$make $opts $target
	check_result "$?"
	echo "VERDICT: $verdict"
	echo "::endgroup::"
}

buildme_cflags() {
	CFLAGS="$1"
	buildme
	CFLAGS=''
}

build_make_targets() {
	# defaults
	target=
	buildme
	# defaults, static
	target=static
	buildme
	# defaults, busybox
	target='btrfs.box btrfs.box.static'
	buildme
	# defaults, library
	target="library-test"
	buildme
	# defaults, static library
	target="library-test.static"
	buildme
}

# main()
if ! [ -f configure.ac ]; then
	echo "Please run me from the top directory"
	exit 1
fi

if [ "$1" = "--ccache" ]; then
	shift
	ccache=true
	export CCACHE_DIR=`pwd`/.ccache
	mkdir -p -- "$CCACHE_DIR"
	PATH="/usr/lib64/ccache:$PATH"
	echo "Enable ccache at CCACHE_DIR=$CCACHE_DIR"
	ccache -s
fi

make=make
jobs=16
opts="-j${jobs} $@"
verdict=
target=
export CLFAGS
CFLAGS=

conf=
build_make_targets

conf='--disable-documentation'
build_make_targets

conf='--disable-backtrace'
build_make_targets

conf='--disable-convert'
build_make_targets

conf='--disable-zoned'
build_make_targets

conf='--disable-libudev'
build_make_targets

conf='--disable-python'
build_make_targets

conf='--disable-zstd'
build_make_targets

conf='--disable-lzo'
build_make_targets

conf='--with-convert=ext2'
build_make_targets

conf='--with-crypto=libgcrypt'
build_make_targets

conf='--with-crypto=libsodium'
build_make_targets

conf='--with-crypto=libkcapi'
build_make_targets

conf='--with-crypto=botan'
build_make_targets

conf='--with-crypto=openssl'
build_make_targets

# Old architectures
conf='--with-crypto=builtin'
buildme_cflags '-march=core2'

conf='--with-crypto=builtin'
buildme_cflags '-march=x86-64-v3'

# debugging builds, just the default targets
target='D=1'
buildme

target='D=asan'
buildme

target='D=tsan'
buildme

target='D=ubsan'
buildme

echo "---------------------------------------------------"
echo "$verdict"