[Toybox] diff not passing tests?

Rob Landley rob at landley.net
Wed Jul 27 14:54:34 PDT 2022


On 7/27/22 11:05, enh wrote:
> trying to take the fix for killall, but it looks like diff is broken?

Sigh, "make tests" doesn't run the diff.tests because it's in pending and the
test hasn't got +x on it...

> -- diff
> /system/bin/sh: /data/local/tmp/toybox-tests/runtest.sh[231]: syntax error:
> unexpected operator/operand '=~'

Ah, bash introduced =~ long enough ago for the 7 year rule, but right: you
aren't using #!/bin/bash in your test setup.

> PASS: diff unknown argument
> PASS: diff missing
> PASS: diff - -
> PASS: diff simple
> PASS: diff -r
> PASS: diff --strip-trailing-cr off
> PASS: diff --strip-trailing-cr on
> PASS: diff line format
> FAIL: diff line format empty
> echo -ne '' | "/system/bin/diff" --unchanged-line-format= --old-line-format=D%l
> --new-line-format=A%l aa bb
> --- expected 2022-07-27 15:42:10.739996975 +0000
> +++ actual 2022-07-27 15:42:10.763996975 +0000
> @@ -1 +1,2 @@
> -D2A3
> \ No newline at end of file
> +--old-line-format=D12
> +A3
> \ No newline at end of file

Heh, interesting. This works:

$ ./diff <(echo -e '1\n2') <(echo -e '1\n3') --unchanged-line-format=U%l
--old-line-format=D%l --new-line-format=A%l
U1D2A3

But actually making the "aa" and "bb" files and sticking them at the end does
not? Hmmm... (Gimme a couple hours for dinner, I'll try to fix it this evening.)

Rob


More information about the Toybox mailing list