Merge pull request #1070 from gaul/bash/nounset

Prohibit pipeline failures
This commit is contained in:
Takeshi Nakatani 2019-07-07 15:10:53 +09:00 committed by GitHub
commit 3161bf4608
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 6 deletions

View File

@ -38,6 +38,8 @@
# eg: VALGRIND="--tool=memcheck --leak-check=full" ./small-integration-test.sh
set -o errexit
set -o pipefail
S3FS=../src/s3fs
# Allow these defaulted values to be overridden

View File

@ -1,6 +1,7 @@
#!/bin/bash
set -o errexit
set -o pipefail
source test-utils.sh
@ -290,7 +291,10 @@ function test_remove_nonempty_directory {
describe "Testing removing a non-empty directory"
mk_test_dir
touch "${TEST_DIR}/file"
rmdir "${TEST_DIR}" 2>&1 | grep -q "Directory not empty"
(
set +o pipefail
rmdir "${TEST_DIR}" 2>&1 | grep -q "Directory not empty"
)
rm "${TEST_DIR}/file"
rm_test_dir
}
@ -365,11 +369,14 @@ function test_multipart_copy {
function test_special_characters {
describe "Testing special characters ..."
ls 'special' 2>&1 | grep -q 'No such file or directory'
ls 'special?' 2>&1 | grep -q 'No such file or directory'
ls 'special*' 2>&1 | grep -q 'No such file or directory'
ls 'special~' 2>&1 | grep -q 'No such file or directory'
ls 'specialµ' 2>&1 | grep -q 'No such file or directory'
(
set +o pipefail
ls 'special' 2>&1 | grep -q 'No such file or directory'
ls 'special?' 2>&1 | grep -q 'No such file or directory'
ls 'special*' 2>&1 | grep -q 'No such file or directory'
ls 'special~' 2>&1 | grep -q 'No such file or directory'
ls 'specialµ' 2>&1 | grep -q 'No such file or directory'
)
}
function test_symlink {

View File

@ -5,6 +5,7 @@
#
set -o errexit
set -o pipefail
# Require root
REQUIRE_ROOT=require-root.sh

View File

@ -3,6 +3,7 @@
#### Test utils
set -o errexit
set -o pipefail
# Configuration
TEST_TEXT="HELLO WORLD"