[Toybox] [PATCH] chmod.test: make the tests a bit more robust.

enh enh at google.com
Wed Dec 16 14:39:22 PST 2020


On Wed, Dec 16, 2020 at 1:24 PM Rob Landley <rob at landley.net> wrote:

> On 12/15/20 12:59 PM, enh via Toybox wrote:
> >
> > If a chmod test fails it can leave files/directories in a state
> > that causes successive runs to suffer bogus failures, and that `make
> > clean` can't clean up without manual intervention.
>
> I thought I'd taught toybox rm -rf to chmod directories it couldn't delete
> and
> try again, but I guess the host rm isn't doing that? How about:
>
> diff --git a/Makefile b/Makefile
> index 21d3359f..52602d25 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -63,6 +63,7 @@ root_clean:
>         @echo root cleaned
>
>  clean::
> +       @chmod -fR 700 generated || true
>         @rm -rf toybox generated change .singleconfig*
>         @echo cleaned
>
>
> While doing that, apparently host chmod -f on a directory that doesn't
> currently
> exist returns an error (which would make your && not continue and recreate
> it).
> rm -f thingy is happen if thingy doesn't already exist, but chmod -f isn't.
>

i should have said "only tested on macOS".

the reason i changed the test but not `make clean` was that i thought
repeatedly running `make test_foo` (without intervening calls to `make
clean`) was more likely to be the usual path. but maybe that's an argument
for `make tests` and `make test_foo` forcibly removing generated/testdir as
if they were at least that part of `make clean`?


> > Also, macOS seems to disallow +s in /tmp (but not otherwise), so
> > allow those tests to be skipped. This is why I was seeing macOS
> > test failures locally (because I pretty much always work on toybox
> > in /tmp) that we weren't seeing on the github CI runs (which
> > presumably don't run in /tmp).
> >
> > With this, all the tests are passing locally for me on macOS again.
> Needing to repeat skipnot before each line is awkward, lemme stare at it
> this
> evening...
>

i started with a bash `if` but decided i preferred your style of
explicitly listing every skipped test. (though i guess `if ... else <a
message about skipping all +s tests> fi` would be fine too.)


> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20201216/80031c16/attachment.htm>


More information about the Toybox mailing list