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

Re: [PATCH] test-lib: stricter unzip(1) check

From
Jeff King <peff@peff.net>
Date
Jul 18, 2016, 23:41 UTC
Message-ID
<20160718234121.GA26152@sigill.intra.peff.net>
In-Reply-To
<xmqqshv6ivfk.fsf@gitster.mtv.corp.google.com>
On Mon, Jul 18, 2016 at 12:43:27PM -0700, Junio C Hamano wrote:
Show 12 quoted lines
> -- >8 --
> test: check "unzip" and "unzip -a"
> 
> Different platforms have implementations "unzip" that behave
> differently.  Most of the tests we use GIT_UNZIP we only care about
> the command to be able to extract from *.zip archive, but one test
> in t5003 wants it to also be able to grok the "-a" option.
> 
> Prepare a sample zip file that has a single text file in it, and try
> extracting its contents to see GIT_UNZIP is usable. when setting
> UNZIP prerequisite.  Similarly, set UNZIP_AUTOTEXT prerequisite by
> running GIT_UNZIP with the "-a" option.

I like the direction here, modulo the problems with "-a" that Eric pointed out. Maybe "zip -l" would be a better approach.

One nit:
Show 8 quoted lines
> +test_lazy_prereq UNZIP_AUTOTEXT '
> +	(
> +		mkdir unzip-autotext &&
> +		cd unzip-autotext
> +		"$GIT_UNZIP" -a "$TEST_DIRECTORY"/t5003/infozip-text.zip &&
> +		test -f text
> +	)
> +'

I don't think we need the extra directory or the subshell here. test_lazy_prereq takes care of that for us.

> diff --git a/t/t5003/infozip-text.zip b/t/t5003/infozip-text.zip
> new file mode 100644
> index 0000000..a019acb
> Binary files /dev/null and b/t/t5003/infozip-text.zip differ
Couldn't apply this locally without --binary, of course. :)
-Peff
Previous: Junio C Hamano
Message 14 of 14 in “test-lib: stricter unzip(1) check”
  1. test-lib: stricter unzip(1) checkEric Wong, Jul 18, 2016
  2. Jeff KingJul 18, 2016
  3. Johannes SchindelinJul 18, 2016
  4. Junio C HamanoJul 18, 2016
  5. Jeff KingJul 18, 2016
  6. Junio C HamanoJul 18, 2016
  7. Johannes SchindelinJul 19, 2016
  8. Junio C HamanoJul 19, 2016
  9. Junio C HamanoJul 18, 2016
  10. Eric WongJul 18, 2016
  11. Junio C HamanoJul 18, 2016
  12. Eric WongJul 18, 2016
  13. Junio C HamanoJul 18, 2016
  14. Jeff KingJul 18, 2016

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.