[Toybox] [PATCH] tests.tar: fix tests for macOS.

Rob Landley rob at landley.net
Tue Aug 30 04:28:24 PDT 2022


On 8/29/22 19:22, enh via Toybox wrote:
> ping? i saw you added another tar test, but let me know your thoughts on this
> before i rebase and fix the new test...

Sorry, under the weather all weekend (and today). Pascal's Apology probably
applies to some of the emails I've sent, except instead of them being long due
to lack of time they're long due to lack of focus...

Applied. I wanted to clean it up to not be testing for darwin 13 separate times
and haven't worked out how yet, but can do so later. (I need some sort of group
skip mechanic, ala "optional".  Which I note is only still used in
tests/sort.test since I yanked most command sub-options, so I should probably
revisit that too. A simple shell "if test; then ... fi" doesn't say "skipped"
for the tests it skipped, and saying SKIPNEXT=5 instead of =1 and having it
count down seems a bit brittle vs START/STOP marker...)

Also, the hashes changing when anything differs is frustrating. I wanted to be
sure I was creating binary identical tarballs, and I am, but... is there a
better way to test that? (WITHOUT having the output each thing's comparing
against be 20 lines of hex dump... Maybe just a few tests can be hashes and the
rest can be tar -tv or something? Skipping half the tests entirely and calling
that "compliance" is frustrating. Yes the important thing is that it not fail,
but passing a test by sabotaging the test is not ideal. Hmmm...)

What _are_ the different permissions for a symlink on mac? Could you hack
something like this into your test (with VERBOSE=all and the darwin skipnots
commented out) and run it on mac and send me the saved tarballs? I'd like to
know what I'm up against...

--- a/tests/tar.test
+++ b/tests/tar.test
@@ -21,9 +21,12 @@ TAR='tar c --owner root --group sys --mtime @1234567890'

 # Different tars add variable trailing NUL padding (1024 bytes is just minimum)
 # so look at first N 512-byte frames when analyzing header content.
+CHOCULA=1
 function SUM()
 {
   tee save.dat | head -c $(($1*512)) | sha1sum | sed "s/ .*//"
+  while [ -e "save.$CHOCULA" ]; do CHOCULA=$((CHOCULA+1)); done
+  mv save.dat save.$CHOCULA
 }

 function LST()

Rob

P.S. Because SUM() gets run in a subshell so changes to CHOCULA get discarded no
matter how you try to export them.

P.P.S Pascal's apology again. Didn't say I was recovered, I'm just trying not to
fall behind...


More information about the Toybox mailing list