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

login
register
mail settings
Submitter phabricator
Date Nov. 28, 2018, 5:54 p.m.
Message ID <ac3e70d01d334743eec72013c8199314@localhost.localdomain>
Download mbox | patch
Permalink /patch/36824/
State Not Applicable
Headers show

Comments

phabricator - Nov. 28, 2018, 5:54 p.m.
durin42 updated this revision to Diff 12615.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5269?vs=12612&id=12615

REVISION DETAIL
  https://phab.mercurial-scm.org/D5269

AFFECTED FILES
  tests/test-fuzz-targets.t

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
Yuya Nishihara - Nov. 29, 2018, 12:09 p.m.
> +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.
phabricator - Nov. 29, 2018, 12:10 p.m.
yuja added a comment.


  > +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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5269

To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

diff --git a/tests/test-fuzz-targets.t b/tests/test-fuzz-targets.t
--- a/tests/test-fuzz-targets.t
+++ b/tests/test-fuzz-targets.t
@@ -2,11 +2,21 @@ 
 
   $ cd $TESTDIR/../contrib/fuzz
 
+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.
+
+  $ GMAKE=`which gmake`
+  $ if [ -n "$GMAKE" -a -x $GMAKE ] ; then
+  >     MAKE=$GMAKE
+  > else
+  >     MAKE=make
+  > fi
+
 #if clang-libfuzzer
-  $ make -s clean all
+  $ $MAKE -s clean all
 #endif
 #if no-clang-libfuzzer clang-6.0
-  $ make -s clean all CC=clang-6.0 CXX=clang++-6.0
+  $ $MAKE -s clean all CC=clang-6.0 CXX=clang++-6.0
 #endif
 #if no-clang-libfuzzer no-clang-6.0
   $ exit 80