]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
travis-ci: run in bash, with the "unofficial strict mode"
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 28 Nov 2016 13:03:46 +0000 (13:03 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 29 Nov 2016 12:36:38 +0000 (12:36 +0000)
set -u forces us to set all variables that we use (for example with the
${foo:=bar} syntax to take an existing value or set a default), or use the
${foo:-bar} syntax to make it explicit that the variable might be unset.

set -o pipefail (which is a bash feature) detects failure in non-last
elements of a pipeline.

Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=98889

tools/ci-build.sh

index 7b3b55feb1d0008f3841b9096838866ec3143089..d85b28f0dc6ae361cc9949732b890527b4143f2a 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 # Copyright © 2015-2016 Collabora Ltd.
 #
 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-set -e
+set -euo pipefail
 set -x
 
-if [ -z "$ci_variant" ]; then
-    ci_variant=production
-fi
-
-if [ -z "$ci_host" ]; then
-    ci_host=native
-fi
-
-if [ -z "$ci_buildsys" ]; then
-    ci_buildsys=autotools
-fi
-
-if [ -z "$ci_parallel" ]; then
-    ci_parallel=1
-fi
-
-ci_test=yes
-ci_test_fatal=yes
+NULL=
+: "${ci_buildsys:=autotools}"
+: "${ci_host:=native}"
+: "${ci_parallel:=1}"
+: "${ci_sudo:=no}"
+: "${ci_test:=yes}"
+: "${ci_test_fatal:=yes}"
+: "${ci_variant:=production}"
 
 NOCONFIGURE=1 ./autogen.sh