more urchin_root

This commit is contained in:
Thomas Levine 2016-02-27 14:45:37 +00:00
parent c9af70b947
commit 54b9e5887d
3 changed files with 12 additions and 4 deletions

View File

@ -0,0 +1,3 @@
#!/bin/sh
#!/bin/sh
../../urchin --root .testsuite/a/b/c/testcase

View File

@ -0,0 +1,2 @@
#!/bin/sh
../../urchin --root .testsuite/a/not-a-file

11
urchin
View File

@ -19,10 +19,13 @@ VERSION=0.0.6
urchin_root() {
(
set -e
if test -f "$1"; then
set -- $(dirname "$1")
fi
if test -d "$1"/.urchin; then
if ! test -e "$1"; then
echo "$1: No such file or directory">&2
exit 1
elif test -f "$1"; then
urchin_root $(dirname "$1")
elif test -d "$1"/.urchin; then
echo "$1"
elif test "$(readlink -f $1)" = /; then
guess=$(readlink -f "$1"|sed s+\(/tests?/\).*+/tests/+)