half-way implementation of error on no found tests

This commit is contained in:
Thomas Levine 2016-03-02 21:46:11 +00:00
parent 918bf31ec5
commit f2305648b7
14 changed files with 16 additions and 19 deletions

View File

@ -0,0 +1,3 @@
#!/bin/sh
../../../urchin $testdir
test 1 -eq $?

View File

@ -0,0 +1,4 @@
tmp=$(mktemp -d)
export testdir=$tmp/tests
mkdir -p $testdir
touch $testdir/.urchin

View File

@ -0,0 +1,2 @@
#!/bin/sh
../../../urchin $testdir 2>&1 | grep -i 'no.*found'

View File

@ -0,0 +1 @@
rm -R $tmp

View File

@ -1,14 +0,0 @@
#!/bin/sh
set -e
tmp=$(mktemp -d)
testdir=$tmp/tests
mkdir -p $testdir
set +e
../../urchin -n -t $testdir
e=$?
set -e
rm -R $tmp
exit $e

11
urchin
View File

@ -56,10 +56,6 @@ if [ -n "${ZSH_VERSION}" ]; then
fi
# Make sure that CDPATH isn't set, as it causes `cd` to behave unpredictably -
# notably, it can produce output.
unset CDPATH
# All temporary files go here
urchin_tmp=$(mktemp -d)
> "${urchin_tmp}/log"
@ -146,7 +142,7 @@ recurse() {
if [ -d "${potential_test}" ]; then
(
cd -- "${potential_test}" > /dev/null
cd -- "${potential_test}"
if test -f setup_dir; then . ./setup_dir; fi
for test in *; do
@ -568,6 +564,11 @@ main() {
recurse "$(fullpath "${1}")" "${root}" "${cycle_shell}" "${TEST_SHELL}" || :
finish=$(date +%s)
test $(cat "${urchin_tmp}"/log | wc -l) -gt 0 || {
echo 'No tests found' > /dev/stderr
urchin_exit 1
}
report_outcome "${root}" "${tap_format}" "${urchin_tmp}"/log "${start}" \
"${finish}"
urchin_exit "${?}"