git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC/PATCH] Windows tests: let $TRASH_DIRECTORY point to native Windows path

From
Duy Nguyen <pclouds@gmail.com>
Date
Aug 27, 2014, 13:08 UTC
Message-ID
<CACsJy8CDZCkQNSfu7HMvfv6++fjr9V6KvhFmgqBQMyd4qnqMtg@mail.gmail.com>
In-Reply-To
<53D7F97B.7060607@gmail.com>
Ping...
On Wed, Jul 30, 2014 at 2:43 AM, Karsten Blees <karsten.blees@gmail.com> wrote:
Show 105 quoted lines
> MSYS programs typically understand native Windows paths (e.g C:/git), but
> native Windows programs (including MinGW) don't understand MSYS paths (e.g.
> /c/git).
>
> On Windows, set TRASH_DIRECTORY to the absolute native path so that it can
> be used more easily in tests.
>
> MSYS 'tar -f' interprets everything before ':' as hostname, not as drive
> letter. Change respective tests to use stdin / stdout instead of '-f'. Also
> use $TAR from GIT-BUILD-OPTIONS rather than hardcoded tar.
>
> Signed-off-by: Karsten Blees <blees@dcon.de>
> ---
>
> Am 25.07.2014 14:30, schrieb Duy Nguyen:
>> On Wed, Jul 23, 2014 at 9:17 PM, Karsten Blees <karsten.blees@gmail.com> wrote:
>>> With the version in pu, three tests fail. t7001 is fixed with a newer 'cp'.
>>> The other two are unrelated (introduced by nd/multiple-work-trees topic).
>>>
>>> * t1501-worktree: failed 1
>>>   As of 5bbcb072 "setup.c: support multi-checkout repo setup"
>>>   Using $TRASH_DIRECTORY doesn't work on Windows.
>>>
>>> * t2026-prune-linked-checkouts: failed 1
>>>   As of 404a45f1 "prune: strategies for linked checkouts"
>>>   Dito.
>>
>> I need your help here. Would saving $(pwd) to a variable and using it
>> instead of $TRASH_DIRECTORY work? Some tests "cd" around and $(pwd)
>> may not be the same as $TRASH_DIRECTORY.
>>
>
> Yes, that would work.
>
> (Actually, you'd only need to change 'echo "$TRASH_DIR..."' in two places (both
> before cd'ing away). The other instances are parameters to non-msys programs and
> are thus automatically mangled by msys.dll.)
>
> However, I wonder why we don't set up TRASH_DIRECTORY to the native Windows path.
> I believe we'd get much fewer 'special' cases that way. Ideally, you shouldn't
> have to worry about the intricacies of MSYS path mangling when writing tests...
>
> [CCing msysgit for opinions]
>
>
>  t/t3513-revert-submodule.sh | 4 ++--
>  t/t6041-bisect-submodule.sh | 4 ++--
>  t/test-lib.sh               | 1 +
>  3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/t/t3513-revert-submodule.sh b/t/t3513-revert-submodule.sh
> index a1c4e02..4a44dd6 100755
> --- a/t/t3513-revert-submodule.sh
> +++ b/t/t3513-revert-submodule.sh
> @@ -14,11 +14,11 @@ test_description='revert can handle submodules'
>  git_revert () {
>         git status -su >expect &&
>         ls -1pR * >>expect &&
> -       tar czf "$TRASH_DIRECTORY/tmp.tgz" * &&
> +       "$TAR" cz * >"$TRASH_DIRECTORY/tmp.tgz" &&
>         git checkout "$1" &&
>         git revert HEAD &&
>         rm -rf * &&
> -       tar xzf "$TRASH_DIRECTORY/tmp.tgz" &&
> +       "$TAR" xz <"$TRASH_DIRECTORY/tmp.tgz" &&
>         git status -su >actual &&
>         ls -1pR * >>actual &&
>         test_cmp expect actual &&
> diff --git a/t/t6041-bisect-submodule.sh b/t/t6041-bisect-submodule.sh
> index c6b7aa6..0de614f 100755
> --- a/t/t6041-bisect-submodule.sh
> +++ b/t/t6041-bisect-submodule.sh
> @@ -8,7 +8,7 @@ test_description='bisect can handle submodules'
>  git_bisect () {
>         git status -su >expect &&
>         ls -1pR * >>expect &&
> -       tar czf "$TRASH_DIRECTORY/tmp.tgz" * &&
> +       "$TAR" cz * > "$TRASH_DIRECTORY/tmp.tgz" &&
>         GOOD=$(git rev-parse --verify HEAD) &&
>         git checkout "$1" &&
>         echo "foo" >bar &&
> @@ -20,7 +20,7 @@ git_bisect () {
>         git bisect start &&
>         git bisect good $GOOD &&
>         rm -rf * &&
> -       tar xzf "$TRASH_DIRECTORY/tmp.tgz" &&
> +       "$TAR" xz <"$TRASH_DIRECTORY/tmp.tgz" &&
>         git status -su >actual &&
>         ls -1pR * >>actual &&
>         test_cmp expect actual &&
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 5102340..5f6397b 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -868,6 +868,7 @@ case $(uname -s) in
>                 md5sum "$@"
>         }
>         # git sees Windows-style pwd
> +       TRASH_DIRECTORY=$(pwd -W)
>         pwd () {
>                 builtin pwd -W
>         }
> --
> 2.0.2.897.g7f80809.dirty
>
-- 
Duy
Previous: Karsten Blees
Message 19 of 19 in “What's cooking in git.git (Jul 2014, #04; Tue, 22)”
  1. Junio C HamanoJul 22, 2014
  2. Philip OakleyJul 23, 2014
  3. Junio C HamanoJul 23, 2014
  4. Philip OakleyJul 24, 2014
  5. Junio C HamanoJul 24, 2014
  6. Junio C HamanoJul 25, 2014
  7. Philip OakleyJul 28, 2014
  8. Everyday contents (was Re: What's cooking in git.git (Jul 2014, #04; Tue, 22))Junio C Hamano, Jul 30, 2014
  9. Junio C HamanoAug 5, 2014
  10. Philip OakleyAug 5, 2014
  11. Everday contents (was part of Re: What's cooking in git.git (Jul 2014, #04; Tue, 22))Philip Oakley, Aug 2, 2014
  12. Junio C HamanoAug 3, 2014
  13. Philip OakleyAug 3, 2014
  14. Junio C HamanoAug 4, 2014
  15. Karsten BleesJul 23, 2014
  16. Junio C HamanoJul 23, 2014
  17. Duy NguyenJul 25, 2014
  18. Windows tests: let $TRASH_DIRECTORY point to native Windows pathKarsten Blees, Jul 29, 2014
  19. Duy NguyenAug 27, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.