[PATCH 2/7] test-bzr.sh, test-hg.sh: allow running from any dir

2013-11-10 Thread Richard Hansen
cd to the t/ subdirectory so that the user doesn't already have to be
in the test directory to run these test scripts.

Signed-off-by: Richard Hansen 
---
 contrib/remote-helpers/test-bzr.sh | 1 +
 contrib/remote-helpers/test-hg.sh  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/contrib/remote-helpers/test-bzr.sh 
b/contrib/remote-helpers/test-bzr.sh
index 5c50251..094062c 100755
--- a/contrib/remote-helpers/test-bzr.sh
+++ b/contrib/remote-helpers/test-bzr.sh
@@ -5,6 +5,7 @@
 
 test_description='Test remote-bzr'
 
+cd "${0%/*}"/../../t || exit 1
 . ./test-lib.sh
 
 if ! test_have_prereq PYTHON
diff --git a/contrib/remote-helpers/test-hg.sh 
b/contrib/remote-helpers/test-hg.sh
index 72f745d..dbe0eec 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -8,6 +8,7 @@
 
 test_description='Test remote-hg'
 
+cd "${0%/*}"/../../t || exit 1
 . ./test-lib.sh
 
 if ! test_have_prereq PYTHON
-- 
1.8.5.rc1.207.gc17dd22

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH 2/7] test-bzr.sh, test-hg.sh: allow running from any dir

2013-11-11 Thread Felipe Contreras
Richard Hansen wrote:
> cd to the t/ subdirectory so that the user doesn't already have to be
> in the test directory to run these test scripts.
> 
> Signed-off-by: Richard Hansen 
> ---
>  contrib/remote-helpers/test-bzr.sh | 1 +
>  contrib/remote-helpers/test-hg.sh  | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/contrib/remote-helpers/test-bzr.sh 
> b/contrib/remote-helpers/test-bzr.sh
> index 5c50251..094062c 100755
> --- a/contrib/remote-helpers/test-bzr.sh
> +++ b/contrib/remote-helpers/test-bzr.sh
> @@ -5,6 +5,7 @@
>  
>  test_description='Test remote-bzr'
>  
> +cd "${0%/*}"/../../t || exit 1

I think this should do the trick:

  test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="$(realpath ${0%/*}/../../t)"
  . "$TEST_DIRECTORY"/test-lib.sh

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/7] test-bzr.sh, test-hg.sh: allow running from any dir

2013-11-11 Thread Junio C Hamano
Felipe Contreras  writes:

> Richard Hansen wrote:
>> cd to the t/ subdirectory so that the user doesn't already have to be
>> in the test directory to run these test scripts.
>> 
>> Signed-off-by: Richard Hansen 
>> ---
>>  contrib/remote-helpers/test-bzr.sh | 1 +
>>  contrib/remote-helpers/test-hg.sh  | 1 +
>>  2 files changed, 2 insertions(+)
>> 
>> diff --git a/contrib/remote-helpers/test-bzr.sh 
>> b/contrib/remote-helpers/test-bzr.sh
>> index 5c50251..094062c 100755
>> --- a/contrib/remote-helpers/test-bzr.sh
>> +++ b/contrib/remote-helpers/test-bzr.sh
>> @@ -5,6 +5,7 @@
>>  
>>  test_description='Test remote-bzr'
>>  
>> +cd "${0%/*}"/../../t || exit 1
>
> I think this should do the trick:
>
>   test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="$(realpath ${0%/*}/../../t)"
>   . "$TEST_DIRECTORY"/test-lib.sh

Can we do that without using realpath(1)? I do not think we use it
anywhere in the main part of the project.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/7] test-bzr.sh, test-hg.sh: allow running from any dir

2013-11-11 Thread Felipe Contreras
On Mon, Nov 11, 2013 at 12:31 PM, Junio C Hamano  wrote:
> Felipe Contreras  writes:
>
>> Richard Hansen wrote:
>>> cd to the t/ subdirectory so that the user doesn't already have to be
>>> in the test directory to run these test scripts.
>>>
>>> Signed-off-by: Richard Hansen 
>>> ---
>>>  contrib/remote-helpers/test-bzr.sh | 1 +
>>>  contrib/remote-helpers/test-hg.sh  | 1 +
>>>  2 files changed, 2 insertions(+)
>>>
>>> diff --git a/contrib/remote-helpers/test-bzr.sh 
>>> b/contrib/remote-helpers/test-bzr.sh
>>> index 5c50251..094062c 100755
>>> --- a/contrib/remote-helpers/test-bzr.sh
>>> +++ b/contrib/remote-helpers/test-bzr.sh
>>> @@ -5,6 +5,7 @@
>>>
>>>  test_description='Test remote-bzr'
>>>
>>> +cd "${0%/*}"/../../t || exit 1
>>
>> I think this should do the trick:
>>
>>   test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="$(realpath ${0%/*}/../../t)"
>>   . "$TEST_DIRECTORY"/test-lib.sh
>
> Can we do that without using realpath(1)? I do not think we use it
> anywhere in the main part of the project.

Something like this, probably:

--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -26,6 +26,8 @@ then
# outside of t/, e.g. for running tests on the test library
# itself.
TEST_DIRECTORY=$(pwd)
+else
+   TEST_DIRECTORY=$(cd $TEST_DIRECTORY && pwd)
 fi
 if test -z "$TEST_OUTPUT_DIRECTORY"
 then


Then we can do:

 test -z "$TEST_DIRECTORY" && TEST_DIRECTORY="${0%/*}/../../t"
 . "$TEST_DIRECTORY"/test-lib.sh

-- 
Felipe Contreras
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html