From d394ae0902824bcfd27b83dd97d5550465c08ee0 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 27 Feb 2018 15:32:21 -0800 Subject: [PATCH] Enable "set -euo pipefail" in all bash scripts. This enables "set -e", "set -u", and "set -o pipefail", which catch common errors. --- check-rustfmt.sh | 3 ++- cranelift/format-all.sh | 4 +--- cranelift/publish-all.sh | 2 +- cranelift/test-all.sh | 4 +--- lib/cretonne/meta/check.sh | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/check-rustfmt.sh b/check-rustfmt.sh index 483a45396a..1983493342 100755 --- a/check-rustfmt.sh +++ b/check-rustfmt.sh @@ -1,5 +1,6 @@ #!/bin/bash -# +set -euo pipefail + # Usage: check-rustfmt.sh [--install] # # Check that the desired version of rustfmt is installed. diff --git a/cranelift/format-all.sh b/cranelift/format-all.sh index 6ccac9c289..a99da7db09 100755 --- a/cranelift/format-all.sh +++ b/cranelift/format-all.sh @@ -1,10 +1,8 @@ #!/bin/bash +set -euo pipefail # Format all sources using rustfmt. -# Exit immediately on errors. -set -e - cd $(dirname "$0") # Make sure we can find rustfmt. diff --git a/cranelift/publish-all.sh b/cranelift/publish-all.sh index 144aa519f8..1826287213 100755 --- a/cranelift/publish-all.sh +++ b/cranelift/publish-all.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -e +set -euo pipefail cd $(dirname "$0") topdir=$(pwd) diff --git a/cranelift/test-all.sh b/cranelift/test-all.sh index a5b2e92066..6a9291d82e 100755 --- a/cranelift/test-all.sh +++ b/cranelift/test-all.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -euo pipefail # This is the top-level test script: # @@ -10,9 +11,6 @@ # # All tests run by this script should be passing at all times. -# Exit immediately on errors. -set -e - # Repository top-level directory. cd $(dirname "$0") topdir=$(pwd) diff --git a/lib/cretonne/meta/check.sh b/lib/cretonne/meta/check.sh index 655092e6cb..aa0e88ce1e 100755 --- a/lib/cretonne/meta/check.sh +++ b/lib/cretonne/meta/check.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -e +set -euo pipefail cd $(dirname "$0") runif() {