summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-10-06 17:35:33 +0200
committerDavid Sterba <dsterba@suse.com>2016-10-10 09:46:51 +0200
commitba253d4ea58a618acc6e2f65446cfd3d20652234 (patch)
tree24aac88403174ad01553e196dc88310a06eaea5c
parentbb5bcb8a4a2792eb9aa4683be58da1a030786198 (diff)
btrfs-progs: tests: add script to help build coverage
Signed-off-by: David Sterba <dsterba@suse.com>
-rwxr-xr-xtests/build-tests.sh88
1 files changed, 88 insertions, 0 deletions
diff --git a/tests/build-tests.sh b/tests/build-tests.sh
new file mode 100755
index 00000000..04e3fd19
--- /dev/null
+++ b/tests/build-tests.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+# test various compilation options
+# - 32bit, 64bit
+# - dynamic, static
+# - various configure options
+#
+# Arguments: anything will be passed to 'make', eg. define CC, D, V
+#
+# Requirements for full coverage:
+# - static version of all libs
+# - 32bit/64bit libraries, also the static variants
+
+make=make
+opts="-j16 $@"
+
+conf=
+target=
+
+function die() {
+ echo "ERROR: $@"
+ exit 1
+}
+
+function check_result() {
+ local ret
+ local str
+
+ ret=$1
+
+ str="RESULT of target($target) conf($conf): "
+ case $ret in
+ 0) str="$str OK";;
+ *) str="$str FAIL";;
+ esac
+ echo "$str"
+ verdict="$verdict
+$str"
+}
+
+function buildme() {
+ make clean-all
+
+ ./autogen.sh && configure "$conf" || die "configure not working with: $@"
+ $make clean
+ $make $opts $target
+ check_result "$?"
+ echo "VERDICT: $verdict"
+}
+
+function build_make_targets() {
+ # defaults
+ target=
+ buildme
+ # defaults, static
+ target=static
+ buildme
+ # defaults, 32bit
+ target="EXTRA_CFLAGS=-m32"
+ buildme
+ # defaults, 64bit
+ target="EXTRA_CFLAGS=-m64"
+ buildme
+ # defaults, library
+ target="library-test"
+ buildme
+}
+
+# main()
+if ! [ -f configure.ac ]; then
+ echo "Please run me from the top directory"
+ exit 1
+fi
+
+verdict=
+conf=
+build_make_targets
+
+conf='--disable-documentation'
+build_make_targets
+
+conf='--disable-backtrace'
+build_make_targets
+
+conf='--disable-convert'
+build_make_targets
+
+echo "---------------------------------------------------"
+echo "$verdict"