~autumnull/haredo-devel

4 3

[BUG] `haredo test` doesn't seems to return non-zero on failure

Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Details
Message ID
<Y91PGtcWsdRp6ISf@cloudsdale.the-delta.net.eu.org>
DKIM signature
missing
Download raw message
For example:

>>> Test phase: dev-util/haredo-1.0.1
haredo test
haredo   bin/haredo
haredo   bin/haredo (skipped)
haredo   test/all
haredo     qbe
haredo       main.o
haredo         config.h
haredo         config.h (done)
/var/tmp/portage/dev-util/haredo-1.0.1/work/haredo-1.0.1/test/main.o.do[4]: c99: inaccessible or not found
haredo       main.o (error: exited with status 127)
haredo     qbe (done)
haredo   test/all (done)
haredo   test/all
haredo     qbe
haredo       main.o
haredo         config.h
haredo         config.h (done)
/var/tmp/portage/dev-util/haredo-1.0.1/work/haredo-1.0.1/test/main.o.do[4]: c99: inaccessible or not found
haredo       main.o (error: exited with status 127)
haredo     qbe (done)
haredo   test/all (done)
haredo   test/clean-gen
haredo     clean
haredo     clean (done)
haredo   test/clean-gen (done)
haredo   test/should-fail
haredo   test/should-fail (error: exited with status 1)
haredo   test/unwriteable
haredo   test/unwriteable (done)
haredo test (done)
>>> Completed testing dev-util/haredo-1.0.1
Details
Message ID
<CQ94W3D1A8YZ.EG0YH4438JZB@eiger>
In-Reply-To
<Y91PGtcWsdRp6ISf@cloudsdale.the-delta.net.eu.org> (view parent)
DKIM signature
missing
Download raw message
I think the issue here is that a nonzero exit status can either mean
"this haredo invocation shouldn't cause anything to be rebuilt" or "this
haredo invocation errored out". Not really sure what the right way to
distinguish between the two is.
Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Details
Message ID
<Y91Tm/4R/nANR2eT@cloudsdale.the-delta.net.eu.org>
In-Reply-To
<CQ94W3D1A8YZ.EG0YH4438JZB@eiger> (view parent)
DKIM signature
missing
Download raw message
[2023-02-03 18:20:04+0000] Ember Sawady:
>I think the issue here is that a nonzero exit status can either mean
>"this haredo invocation shouldn't cause anything to be rebuilt" or "this
>haredo invocation errored out". Not really sure what the right way to
>distinguish between the two is.

That seems quite weird… at least coming with a make(1) mindset/bias I feel
like it should be done like so:

- 0 means success / done / no need to rebuild
- !0 means failure / could be rebuilt

Should be noted that make(1) can make use of child processes, including itself.
Details
Message ID
<e8ef0ba1-7e6b-e683-c198-231aa2d03cba@posteo.net>
In-Reply-To
<Y91Tm/4R/nANR2eT@cloudsdale.the-delta.net.eu.org> (view parent)
DKIM signature
missing
Download raw message
> I think the issue here is that a nonzero exit status can either mean
> "this haredo invocation shouldn't cause anything to be rebuilt" or "this
> haredo invocation errored out". Not really sure what the right way to
> distinguish between the two is.
Yeah ecs you're right but i've just had a thought -- we could try using
status codes like normal for "should/shouldn't be rebuilt" but try using
*signals* for errors in scripts?

I only have a vague understanding of this but the hare stdlib lets you
distinguish between a signal and an exit code of a child process.

> That seems quite weird… at least coming with a make(1) mindset/bias I
> feel like it should be done like so:
> - 0 means success / done / no need to rebuild
> - !0 means failure / could be rebuilt
The reason that success = rebuild is so that you can just write e.g.

if haredo targets...
then
	# build
fi

which is seems simpler and marginally more intuitive to me than negating
it. But yeah you're right that the cluttering of "did this succeed" with
"does this need rebuilding" is a genuine shortcoming of haredo (at the
moment).
Details
Message ID
<7cc076a5-00d7-045c-978a-3026fbc8ef9c@posteo.net>
In-Reply-To
<e8ef0ba1-7e6b-e683-c198-231aa2d03cba@posteo.net> (view parent)
DKIM signature
missing
Download raw message
This is now fixed in Haredo 1.0.2.

The specific new behavior is that haredo will return an error code if
any of its descendant .do scripts fails. Thank Ember for the patch :)

~Autumn
Reply to thread Export thread (mbox)