From 5df65fb6a1a37900bc1c70e76b2df464539a1713 Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Sun, 28 Feb 2016 12:14:16 +0000 Subject: [PATCH] fix path descending from root --- urchin | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/urchin b/urchin index 85dc0fe..054bb55 100755 --- a/urchin +++ b/urchin @@ -79,11 +79,10 @@ indent() { recurse() { set -e - root="$1" - requested_path="$2" - potential_test="$3" - shell_for_sh_tests="$4" - TEST_SHELL="$5" + requested_path="$1" + potential_test="$(fullpath "$2")" + shell_for_sh_tests="$3" + TEST_SHELL="$4" for ignore in setup_dir teardown_dir setup teardown; do if test "$potential_test" = $ignore; then @@ -91,17 +90,14 @@ recurse() { fi done - pwd - echo $potential_test - fullpath "$potential_test" - echo $requested_path - if ! fullpath "$requested_path" | - grep "^$(fullpath "$potential_test")" > /dev/null; then - if fullpath "$requested_path" |grep Command > /dev/null; then - echo "echo '$(fullpath "$potential_test")' | -grep '^$(fullpath "$requested_path")' > /dev/null" -fi - return + if echo "$requested_path" | grep "^$potential_test" > /dev/null || + echo "$potential_test" | grep "^$requested_path" > /dev/null; then + echo Considering $potential_test + else + if echo "$potential_test" | grep Command; then + echo $potential_test + fi + return 0 fi if test $(echo "$potential_test" | wc -l) -ne 1; then @@ -123,8 +119,8 @@ fi urchin_source setup set +e - recurse "$root" "$requested_path" \ - "${test}" "$shell_for_sh_tests" "$TEST_SHELL" + recurse "$requested_path" "$test" "$shell_for_sh_tests" "$TEST_SHELL" + exit_code=$? set -e @@ -412,13 +408,11 @@ if basename "$(fullpath "$root")" | start=$(date +%s) set +e - # 1 urchin root - # 2 test file or folder to run - # 3 urchin root again (this changes later) - # 4 shell to invoke test scripts with - # 5 TEST_SHELL - recurse "$root" "$(fullpath "$1")" \ - "$root" "$shell_for_sh_tests" "$TEST_SHELL" + # 1 test file or folder to run + # 2 urchin root + # 3 shell to invoke test scripts with + # 4 TEST_SHELL + recurse "$(fullpath "$1")" "$root" "$shell_for_sh_tests" "$TEST_SHELL" exit_code=$? set -e