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

Re: [PATCH 3/6] t5000: factor out check_tar

From
Eric Sunshine <sunshine@sunshineco.com>
Date
May 20, 2013, 19:54 UTC
Message-ID
<CAPig+cSPV08=LcQ4vziE5+HmN3LtBVp7F4mb83--Mub_e2A7qw@mail.gmail.com>
In-Reply-To
<1369043909-59207-4-git-send-email-rene.scharfe@lsrfire.ath.cx>

On Mon, May 20, 2013 at 5:58 AM, René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:

Show 23 quoted lines
> Create a helper function that extracts a tar archive and checks its
> contents, modelled after check_zip in t5003.
>
> Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
> ---
>  t/t5000-tar-tree.sh | 35 ++++++++++++++++++++++-------------
>  1 file changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
> index 41cd609..8337a1f 100755
> --- a/t/t5000-tar-tree.sh
> +++ b/t/t5000-tar-tree.sh
> @@ -30,6 +30,26 @@ GUNZIP=${GUNZIP:-gzip -d}
>
>  SUBSTFORMAT=%H%n
>
> +check_tar() {
> +       tarfile=$1.tar
> +       listfile=$1.lst
> +       dir=$1
> +       dir_with_prefix=$dir/$2
> +
> +       test_expect_success ' extract tar archive' '
s/' extract/'extract/
> +               (mkdir $dir && cd $dir && "$TAR" xf -) <$tarfile
> +       '
> +
> +       test_expect_success ' validate filenames' '
s/' validate/'validate/
Show 5 quoted lines
> +               (cd ${dir_with_prefix}a && find .) | sort >$listfile &&
> +               test_cmp a.lst $listfile
> +       '
> +
> +       test_expect_success ' validate file contents' '
s/' validate/'validate/
Show 43 quoted lines
> +               diff -r a ${dir_with_prefix}a
> +       '
> +}
> +
>  test_expect_success \
>      'populate workdir' \
>      'mkdir a &&
> @@ -81,6 +101,8 @@ test_expect_success \
>      'git archive' \
>      'git archive HEAD >b.tar'
>
> +check_tar b
> +
>  test_expect_success \
>      'git tar-tree' \
>      'git tar-tree HEAD >b2.tar'
> @@ -125,19 +147,6 @@ test_expect_success \
>       test_cmp .git/$(git symbolic-ref HEAD) b.commitid'
>
>  test_expect_success \
> -    'extract tar archive' \
> -    '(mkdir b && cd b && "$TAR" xf -) <b.tar'
> -
> -test_expect_success \
> -    'validate filenames' \
> -    '(cd b/a && find .) | sort >b.lst &&
> -     test_cmp a.lst b.lst'
> -
> -test_expect_success \
> -    'validate file contents' \
> -    'diff -r a b/a'
> -
> -test_expect_success \
>      'git tar-tree with prefix' \
>      'git tar-tree HEAD prefix >c.tar'
>
> --
> 1.8.2.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: René ScharfeNext: René Scharfe
Message 7 of 15 in “t5000: add test for pax extended header generation”
  1. 0/6 t5000: add test for pax extended header generationRené Scharfe, May 20, 2013
  2. 1/6 t5000: integrate export-subst tests into regular testsRené Scharfe, May 20, 2013
  3. Eric SunshineMay 20, 2013
  4. René ScharfeMay 20, 2013
  5. 2/6 t5000, t5003: create directories for extracted files lazilyRené Scharfe, May 20, 2013
  6. 3/6 t5000: factor out check_tarRené Scharfe, May 20, 2013
  7. Eric SunshineMay 20, 2013
  8. René ScharfeMay 20, 2013
  9. 4/6 t5000: use check_tar for prefix testRené Scharfe, May 20, 2013
  10. 5/6 t5000: simplify tar-tree testsRené Scharfe, May 20, 2013
  11. 6/6 t5000: test long filenamesRené Scharfe, May 20, 2013
  12. Eric SunshineMay 20, 2013
  13. (unknown)Marty Landman, May 20, 2013
  14. René ScharfeMay 20, 2013
  15. Junio C HamanoMay 20, 2013

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.