Message ID | 27c7813c0fe81455b675611b9e11fee6ee2a79e9.1584625896.git.congdanhqx@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fix test failure with busybox | expand |
On Thu, Mar 19, 2020 at 09:00:04PM +0700, Đoàn Trần Công Danh wrote: > Alpine Linux's default unzip(1) doesn't support `-a`. > > Skip those tests on that platform. Makes sense. One minor nit: > +test_lazy_prereq UNZIP_CONVERT ' > + ( > + mkdir unzip-convert && > + cd unzip-convert && > + "$GIT_UNZIP" -a "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip > + ) > +' Lazy prereqs are already evaluated in a throw-away directory, so you can drop the subshell and mkdir/cd. -Peff
On 2020-03-19 12:03:10-0400, Jeff King <peff@peff.net> wrote: > On Thu, Mar 19, 2020 at 09:00:04PM +0700, Đoàn Trần Công Danh wrote: > > > Alpine Linux's default unzip(1) doesn't support `-a`. > > > > Skip those tests on that platform. > > Makes sense. One minor nit: > > > +test_lazy_prereq UNZIP_CONVERT ' > > + ( > > + mkdir unzip-convert && > > + cd unzip-convert && > > + "$GIT_UNZIP" -a "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip > > + ) > > +' > > Lazy prereqs are already evaluated in a throw-away directory, so you can > drop the subshell and mkdir/cd. I was trying to keep it consistent with UNZIP_SYMLINKS above it. Maybe, it's worth to clean it, too.
On Fri, Mar 20, 2020 at 07:39:21AM +0700, Danh Doan wrote: > > > +test_lazy_prereq UNZIP_CONVERT ' > > > + ( > > > + mkdir unzip-convert && > > > + cd unzip-convert && > > > + "$GIT_UNZIP" -a "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip > > > + ) > > > +' > > > > Lazy prereqs are already evaluated in a throw-away directory, so you can > > drop the subshell and mkdir/cd. > > I was trying to keep it consistent with UNZIP_SYMLINKS above it. > Maybe, it's worth to clean it, too. Ah, sorry, I should have looked at more context. I think it would be worth cleaning up the existing one. -Peff
diff --git a/t/t5003-archive-zip.sh b/t/t5003-archive-zip.sh index 106eddbd85..78fb4bf323 100755 --- a/t/t5003-archive-zip.sh +++ b/t/t5003-archive-zip.sh @@ -15,6 +15,14 @@ test_lazy_prereq UNZIP_SYMLINKS ' ) ' +test_lazy_prereq UNZIP_CONVERT ' + ( + mkdir unzip-convert && + cd unzip-convert && + "$GIT_UNZIP" -a "$TEST_DIRECTORY"/t5003/infozip-symlinks.zip + ) +' + check_zip() { zipfile=$1.zip listfile=$1.lst @@ -39,33 +47,33 @@ check_zip() { extracted=${dir_with_prefix}a original=a - test_expect_success UNZIP " extract ZIP archive with EOL conversion" ' + test_expect_success UNZIP_CONVERT " extract ZIP archive with EOL conversion" ' (mkdir $dir && cd $dir && "$GIT_UNZIP" -a ../$zipfile) ' - test_expect_success UNZIP " validate that text files are converted" " + test_expect_success UNZIP_CONVERT " validate that text files are converted" " test_cmp_bin $extracted/text.cr $extracted/text.crlf && test_cmp_bin $extracted/text.cr $extracted/text.lf " - test_expect_success UNZIP " validate that binary files are unchanged" " + test_expect_success UNZIP_CONVERT " validate that binary files are unchanged" " test_cmp_bin $original/binary.cr $extracted/binary.cr && test_cmp_bin $original/binary.crlf $extracted/binary.crlf && test_cmp_bin $original/binary.lf $extracted/binary.lf " - test_expect_success UNZIP " validate that diff files are converted" " + test_expect_success UNZIP_CONVERT " validate that diff files are converted" " test_cmp_bin $extracted/diff.cr $extracted/diff.crlf && test_cmp_bin $extracted/diff.cr $extracted/diff.lf " - test_expect_success UNZIP " validate that -diff files are unchanged" " + test_expect_success UNZIP_CONVERT " validate that -diff files are unchanged" " test_cmp_bin $original/nodiff.cr $extracted/nodiff.cr && test_cmp_bin $original/nodiff.crlf $extracted/nodiff.crlf && test_cmp_bin $original/nodiff.lf $extracted/nodiff.lf " - test_expect_success UNZIP " validate that custom diff is unchanged " " + test_expect_success UNZIP_CONVERT " validate that custom diff is unchanged " " test_cmp_bin $original/custom.cr $extracted/custom.cr && test_cmp_bin $original/custom.crlf $extracted/custom.crlf && test_cmp_bin $original/custom.lf $extracted/custom.lf
Alpine Linux's default unzip(1) doesn't support `-a`. Skip those tests on that platform. Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> --- t/t5003-archive-zip.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)