This is an archive of the discontinued Mercurial Phabricator instance.

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
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

durin42 created this revision.Nov 14 2018, 10:13 AM
yuja added a subscriber: yuja.Nov 17 2018, 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.Nov 27 2018, 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.Nov 28 2018, 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.Nov 28 2018, 12:54 PM
yuja added a comment.Nov 29 2018, 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.Nov 29 2018, 4:38 PM
This revision was automatically updated to reflect the committed changes.