aboutsummaryrefslogtreecommitdiff
path: root/test/runtests.sh
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2022-04-16 15:13:08 -0500
committerGitHub <noreply@github.com>2022-04-16 15:13:08 -0500
commitfdfa6dbb0e69742029d53f0e163b8e7e7e6860f5 (patch)
tree6a300ef3e1b25e22224b042cc8a8c07b43709950 /test/runtests.sh
parent0b3f8750e7d307987eef9e63e327488a81c29a71 (diff)
rewrite tests (#515)
* rewrite tests to work with meson This ports our tests to meson and makes them able to be run in parallel. * add tests to ci * rewrite test/check-trailing-newlines in bash This test was using a GNU sed command which does not work on Alpine Linux.
Diffstat (limited to 'test/runtests.sh')
-rwxr-xr-xtest/runtests.sh92
1 files changed, 0 insertions, 92 deletions
diff --git a/test/runtests.sh b/test/runtests.sh
deleted file mode 100755
index 5e21d2ab..00000000
--- a/test/runtests.sh
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/sh
-
-top_srcdir=${top_srcdir:-..}
-. ${top_srcdir}/test/setup_env.sh
-
-libeinfo_srcdir="${srcdir}/../libeinfo"
-libeinfo_builddir="${builddir}/../libeinfo"
-librc_srcdir="${srcdir}/../librc"
-librc_builddir="${builddir}/../librc"
-rc_srcdir="${srcdir}/../rc"
-rc_builddir="${builddir}/../rc"
-
-checkit() {
- local base=$1; shift
- echo "$@" | tr ' ' '\n' > ${base}.out
- diff -u ${base}.list ${base}.out
- eend $?
- : $(( ret += $? ))
-}
-
-ret=0
-
-fail_on_out() {
- if [ -n "${out}" ]; then
- eerror "Last command failed; failing"
- exit 1
- fi
-}
-
-ebegin "Checking trailing whitespace in code"
-# XXX: Should we check man pages too ?
-out=$(cd ${top_srcdir}; find */ \
- '(' -name '*.[ch]' -o -name '*.in' -o -name '*.sh' ')' \
- -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};
- for f in `find */ -name '*.[ch]'` ; do
- sed -n -e :a -e '/^\n*$/{$q1;N;ba' -e '}' $f || echo $f
- 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]' \
- ! -name queue.h \
- -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]' \
- ! -name queue.h \
- -exec grep -n -E '\<(malloc|strdup)[[:space:]]*\(' {} + \
- | grep -v \
- -e src/includes/helpers.h \
- -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]' \
- ! -name queue.h \
- -exec grep -n -E \
- -e '\<(for|if|switch|while)\(' \
- -e '\<(for|if|switch|while) \( ' \
- -e ' ;' \
- -e '[[:space:]]$' \
- -e '\){' \
- -e '(^|[^:])//' \
- {} +)
-[ -z "${out}" ]
-eend $? "These lines violate style rules:"$'\n'"${out}"
-fail_on_out
-
-einfo "Running unit tests"
-eindent
-for u in units/*; do
- [ -x "${u}" -a -f "${u}" ] || continue
- ebegin "$(basename "${u}")"
- ./"${u}"
- eend $?
- : $(( ret += $? ))
-done
-
-exit ${ret}