[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master ce96452 1/2: Convenience/extra features in tes
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master ce96452 1/2: Convenience/extra features in tests/during-dev.sh |
Date: |
Wed, 4 Jul 2018 11:46:37 -0400 (EDT) |
branch: master
commit ce964524d5605d32b283eed12924b4bf0de11211
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>
Convenience/extra features in tests/during-dev.sh
Until now, this testing script (during development) would continue if there
was a problem. This was very inconvenient (makes it harder to find a
problem). With this commit, a `set -e' has been added to it from its
processing step so it aborts in case of any problem.
When calling this script, the utility name must not have the `ast'
prefix. To avoid errors in copying the files later, a test has been added
that will abort the script if the utility name starts with an `ast'.
The checks on necessary variables were typeset more clearly (things under
each other) to be more easily readable.
---
tests/during-dev.sh | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/tests/during-dev.sh b/tests/during-dev.sh
index 6421c71..7a52e82 100755
--- a/tests/during-dev.sh
+++ b/tests/during-dev.sh
@@ -89,13 +89,24 @@ options=
# RUN THE PROCEDURES
# ==================
+# Stop the script if there are any errors.
+set -e
+
+
# First, make sure the variables are set. Note that arguments and options
# are not absolutly vital! so they are not checked here. The utility will
# warn and halt if it needs them.
-if [ x"$outdir" = x ]; then echo "outdir is not set."; exit 1; fi
-if [ x$utilname = x ]; then echo "utilname is not set."; exit 1; fi
-if [ x"$numjobs" = x ]; then echo "numjobs is not set."; exit 1; fi
-if [ x"$builddir" = x ]; then echo "builddir is not set."; exit 1; fi
+if [ x"$outdir" = x ]; then echo "outdir is not set."; exit 1; fi
+if [ x"$numjobs" = x ]; then echo "numjobs is not set."; exit 1; fi
+if [ x"$utilname" = x ]; then echo "utilname is not set."; exit 1; fi
+if [ x"$builddir" = x ]; then echo "builddir is not set."; exit 1; fi
+
+
+# Make sure `utilname' doesn't start with `ast' (a common mistake).
+nameprefix="${utilname:0:3}"
+if [ x"$nameprefix" = x"ast" ]; then
+ echo "'utilname' must not start with 'ast'."; exit 1;
+fi
# If builddir is relative, then append the current directory to make it