aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAustin English <austinenglish@gmail.com>2018-10-19 14:59:23 -0500
committerMike Frysinger <vapier@gmail.com>2018-11-27 21:22:29 -0500
commite96f7d5658950ddee68e54fba4b6321b9a6a2ed8 (patch)
tree91eb32f917d2773e3ee9eb9bc4265e6d8977855c /src/test
parent28b73fc524096d5b2205fea25943410725d6227f (diff)
src/tests/runtests.sh: add a FATAL_CHECKS variable to make whitespace/etc. fatal
Diffstat (limited to 'src/test')
-rwxr-xr-xsrc/test/runtests.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/runtests.sh b/src/test/runtests.sh
index 1736dd55..81edac2b 100755
--- a/src/test/runtests.sh
+++ b/src/test/runtests.sh
@@ -20,6 +20,16 @@ checkit() {
ret=0
+fail_on_out() {
+ # If FATAL_CHECKS is set, then fail when $out has output:
+ if [ -n "${FATAL_CHECKS}" ]; then
+ if [ -n "${out}" ]; then
+ eerror "Last command failed and FATAL_CHECKS is set; failing"
+ exit 1
+ fi
+ fi
+}
+
ebegin "Checking exported symbols in libeinfo.so (data)"
checkit einfo.data $(
readelf -Ws ${libeinfo_builddir}/libeinfo.so \
@@ -74,6 +84,7 @@ out=$(cd ${top_srcdir}; find */ \
-exec grep -n -E '[[:space:]]+$' {} +)
[ -z "${out}" ]
eend $? "Trailing whitespace needs to be deleted:"$'\n'"${out}"
+fail_on_out
ebegin "Checking trailing newlines in code"
out=$(cd ${top_srcdir};
@@ -82,6 +93,7 @@ out=$(cd ${top_srcdir};
done)
[ -z "${out}" ]
eend $? "Trailing newlines need to be deleted:"$'\n'"${out}"
+fail_on_out
ebegin "Checking for obsolete functions"
out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
@@ -89,6 +101,7 @@ out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
-exec grep -n -E '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' {} +)
[ -z "${out}" ]
eend $? "Avoid these obsolete functions:"$'\n'"${out}"
+fail_on_out
ebegin "Checking for x* func usage"
out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
@@ -99,6 +112,7 @@ out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
-e src/libeinfo/libeinfo.c)
[ -z "${out}" ]
eend $? "These need to be using the x* variant:"$'\n'"${out}"
+fail_on_out
ebegin "Checking spacing style"
out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
@@ -113,6 +127,7 @@ out=$(cd ${top_srcdir}; find src -name '*.[ch]' \
{} +)
[ -z "${out}" ]
eend $? "These lines violate style rules:"$'\n'"${out}"
+fail_on_out
einfo "Running unit tests"
eindent