aboutsummaryrefslogtreecommitdiff
path: root/performance-test
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2015-08-06 12:13:36 +0300
committerDavid Bremner <david@tethera.net>2015-08-07 21:56:39 +0200
commit02a2eeb427d6b424029f6e5e5ddad4c6ec987741 (patch)
treeabdc66ca743a1f21c70238e4c118a51d08c253f1 /performance-test
parentaf3eba97fde00d6bc922df87732b3d28f717f120 (diff)
test: make script exit (1) if it "fails" to source (.) a file
The files (test) scripts source (with builtin command `.`) provides information which the scripts depend, and without the `source` to succeed allowing script to continue may lead to dangerous situations (e.g. rm -rf "${undefined_variable}"/*). At the end of all source (.) lines construct ' || exit 1' was added; In our case the script script will exit if it cannot find (or read) the file to be sourced. Additionally script would also exits if the last command of the sourced file exited nonzero.
Diffstat (limited to 'performance-test')
-rwxr-xr-xperformance-test/M00-new.sh2
-rwxr-xr-xperformance-test/M01-dump-restore.sh2
-rwxr-xr-xperformance-test/T00-new.sh2
-rwxr-xr-xperformance-test/T01-dump-restore.sh2
-rwxr-xr-xperformance-test/T02-tag.sh2
-rw-r--r--performance-test/perf-test-lib.sh4
6 files changed, 7 insertions, 7 deletions
diff --git a/performance-test/M00-new.sh b/performance-test/M00-new.sh
index 99c3f520..a040a97e 100755
--- a/performance-test/M00-new.sh
+++ b/performance-test/M00-new.sh
@@ -2,7 +2,7 @@
test_description='notmuch new'
-. ./perf-test-lib.sh
+. ./perf-test-lib.sh || exit 1
# ensure initial 'notmuch new' is run by memory_start
uncache_database
diff --git a/performance-test/M01-dump-restore.sh b/performance-test/M01-dump-restore.sh
index be5894a6..8fea9824 100755
--- a/performance-test/M01-dump-restore.sh
+++ b/performance-test/M01-dump-restore.sh
@@ -2,7 +2,7 @@
test_description='dump and restore'
-. ./perf-test-lib.sh
+. ./perf-test-lib.sh || exit 1
memory_start
diff --git a/performance-test/T00-new.sh b/performance-test/T00-new.sh
index 553bb8b6..b9f21158 100755
--- a/performance-test/T00-new.sh
+++ b/performance-test/T00-new.sh
@@ -2,7 +2,7 @@
test_description='notmuch new'
-. ./perf-test-lib.sh
+. ./perf-test-lib.sh || exit 1
uncache_database
diff --git a/performance-test/T01-dump-restore.sh b/performance-test/T01-dump-restore.sh
index b2ff9400..9cfd5cd6 100755
--- a/performance-test/T01-dump-restore.sh
+++ b/performance-test/T01-dump-restore.sh
@@ -2,7 +2,7 @@
test_description='dump and restore'
-. ./perf-test-lib.sh
+. ./perf-test-lib.sh || exit 1
time_start
diff --git a/performance-test/T02-tag.sh b/performance-test/T02-tag.sh
index 78cecccc..dacb50b8 100755
--- a/performance-test/T02-tag.sh
+++ b/performance-test/T02-tag.sh
@@ -2,7 +2,7 @@
test_description='tagging'
-. ./perf-test-lib.sh
+. ./perf-test-lib.sh || exit 1
time_start
diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh
index 88601fc7..00d2f1c6 100644
--- a/performance-test/perf-test-lib.sh
+++ b/performance-test/perf-test-lib.sh
@@ -1,4 +1,4 @@
-. ./version.sh
+. ./version.sh || exit 1
corpus_size=large
@@ -25,7 +25,7 @@ do
echo "error: unknown performance test option '$1'" >&2; exit 1 ;;
esac
done
-. ../test/test-lib-common.sh
+. ../test/test-lib-common.sh || exit 1
set -e