[Toybox] [PATCH] Add the gzip/gunzip/zcat tests I wrote for toolbox gzip/gunzip/zcat.

Rob Landley rob at landley.net
Wed Apr 26 14:43:26 PDT 2017


On 04/24/2017 03:43 PM, enh wrote:
> Bringing the zlib-based gzip/gunzip/zcat over to toybox is a problem for
> another day,

Blah, I should take this one.

I have deflate decompression side implemented already (and working at
one point, although I just tested "make zcat" and got a bad crc
decompressing the musl-1.1.16.gz tarball). I have the first 1/3 or so of
compression side implemented and somewhere around here is a version
that's about 2/3 through. I stopped at "where do dictionary resets
happen" and basically go the answer "nobody seems to agree, just do it
every 250k". (Which means my gzip and other gzip won't necessarily
produce the same binary, but it should extract the same. There's
actually a format hitch you can do sticking in gratuitous resets to
allow parallel decompression, it's a bit like mp4 streaming mode
sticking in extra keyframes, only noticeably cheaper. :)

Adding zlib mode to that is basically the same plumbing as
toys/*/md5sum.c does for libcrypto.

Lemme try to find a chunk of time to devote to that...

> but at least the tests are easy...
> 
> (These tests pass with TEST_HOST and on the toolbox versions, but the
> toybox toys are in pending and very broken.)

The problem is this is just testing that gzip and gunzip reverse each
other. If they share infrastructure and screw something up the same way,
what have you proved? Also you can't test gunzip without gzip being present.

For bzip I added a tests/files/bzcat (and already had a lot of
tests/files/blkid/*.bz2). I'd like to have at least a couple canned .gz
files for reference under tests/files.

I'll try to take a closer look at this later...

Rob


More information about the Toybox mailing list