tests: sniff for /usr/local/bin/gmake and use it in test-fuzz-targets.t
ClosedPublic

Authored by durin42 on Nov 14 2018, 10:13 AM.

Details

Summary

This isn't as robust as it probably should be, but for now it'll get
the job done on the buildbots.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
durin42 created this revision.Nov 14 2018, 10:13 AM
yuja added a subscriber: yuja.Sat, Nov 17, 9:56 PM

(resend)

> + $ if [ -x /usr/local/bin/gmake ] ; then
> + > MAKE=gmake

Isn't this assuming that /usr/local/bin is in $PATH? IOW, shouldn't this
assignment be:

	MAKE=/usr/local/bin/gmake

Perhaps, type or which can be used instead. gmake should be in PATH
if it's supposed to be used.

https://stackoverflow.com/a/39983421/10435339

durin42 updated this revision to Diff 12612.Tue, Nov 27, 11:12 AM

Updated. Note that this and its child should go on *stable*, since otherwise the test is broken on FreeBSD 11.2 there.

yuja added a comment.Wed, Nov 28, 6:30 AM

+ $ GMAKE=which gmake
+ $ if [ -x $GMAKE ] ; then

Need to check whether "$GMAKE" is empty or not. And which gmake may
fail with 1.

durin42 updated this revision to Diff 12615.Wed, Nov 28, 12:54 PM
yuja added a comment.Thu, Nov 29, 7:10 AM

+which(1) could exit nonzero, but that's fine because we'll still end
+up without a valid executable, so we don't need to check $? here.

True, but the exit code is printed as [1].

+ $ GMAKE=which gmake
+ $ if [ -n "$GMAKE" -a -x $GMAKE ] ; then
+ > MAKE=$GMAKE

Can you try this?

if which gmake >/dev/null 2>&1; then
    MAKE=gmake
else
    MAKE=make
fi

If which gmake exits with 0, MAKE=gmake should work.

durin42 updated this revision to Diff 12657.Thu, Nov 29, 4:38 PM
This revision was automatically updated to reflect the committed changes.