aboutsummaryrefslogtreecommitdiff
blob: 50f10c7164e9c2962440d5a2f9841219b3c22dad (plain)
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
#!/bin/bash -e

. "${0%/*}"/lib.sh

# We have to do this by hand rather than use the coverity addon because of
# matrix explosion: https://github.com/travis-ci/travis-ci/issues/1975
# We also do it by hand because when we're throttled, the addon will exit
# the build immediately and skip the main script!
coverity_scan() {
	local reason
	[[ ${TRAVIS_JOB_NUMBER} != *.1 ]] && reason="not first build job"
	[[ -n ${TRAVIS_TAG} ]] && reason="git tag"
	[[ ${TRAVIS_PULL_REQUEST} == "true" ]] && reason="pull request"
	if [[ -n ${reason} ]] ; then
		echo "Skipping coverity scan due to: ${reason}"
		return
	fi

	export COVERITY_SCAN_PROJECT_NAME="${TRAVIS_REPO_SLUG}"
	export COVERITY_SCAN_NOTIFICATION_EMAIL="grobian@gentoo.org"
	export COVERITY_SCAN_BUILD_COMMAND="make -j${ncpus}"
	export COVERITY_SCAN_BUILD_COMMAND_PREPEND="git clean -q -x -d -f; git checkout -f"
	export COVERITY_SCAN_BRANCH_PATTERN="master"

	curl -s "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" | bash || :
}

main() {
	# For local deps like blake2b.
	export CPPFLAGS="-I${PWD}/../sysroot"
	export LDFLAGS="-L${PWD}/../sysroot"

	# ignore timestamps which git doesn't preserve
	# disable openmp because Clang's libomp isn't installed
	DEFARGS="--disable-maintainer-mode --disable-openmp"

	do_run() {
		v ./configure ${*}

		# Standard optimized build.
		m V=1
		m check
		m clean
	}

	do_run ${DEFARGS}
	do_run ${DEFARGS} --enable-qmanifest --enable-qtegrity
	do_run ${DEFARGS} --disable-qmanifest --enable-qtegrity
	do_run ${DEFARGS} --enable-qmanifest --disable-qtegrity
	do_run ${DEFARGS} --disable-qmanifest --disable-qtegrity

	if [[ ${TRAVIS_OS_NAME} == linux ]] ; then
		do_run CFLAGS=-g Q_RUN_WITH_VALGRIND=1 \
			${DEFARGS} --enable-qmanifest --enable-qtegrity
	fi

	# LSan needs sudo, which we don't use at the moment
	# Debug build w/ASAN and such enabled.
	#m debug
	#m check

	# Do scans last as they like to dirty the tree and some tests
	# expect a clean tree (like code style checks).
	v --fold="coverity_scan" coverity_scan
}
main "$@"