[ccache] [PATH]: test: elide which stderr

Eric Bavier ericbavier at openmailbox.org
Fri Sep 23 04:41:45 UTC 2016


Hello ccache devs,

While running ccache's test suite via `make check` I get output from
'which':

-----
test/main
PASSED: 473 assertions, 92 tests, 10 suites
CC='gcc -std=gnu99' ./test.sh
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 's'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 't'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 'd'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- '='
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 'g'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 'n'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 'u'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- '9'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- '9'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 's'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 't'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 'd'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- '='
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 'g'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 'n'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- 'u'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- '9'
/gnu/store/kv2yzj8km44s45yifvlvibay4j8jba6y-which-2.21/bin/which: invalid option -- '9'
Compiler:         gcc -std=gnu99 (/gnu/store/frrj3bfbmg5vrd0flh9cf8j64h7cr2v4-gcc-4.9.3/bin/gcc)
Compiler version: gcc (GCC) 4.9.3

Running test suite base...
-----

This is because CC='gcc -std=gnu99' and test.sh ends up invoking
$(which gcc -std=gnu99).  The output seems harmless, and 'which' ends
up finding the right compiler path.  I think the following patch could
help:

--- ccache-3.3.1/test.sh.orig	2016-09-07 14:22:01.000000000 -0500
+++ ccache-3.3.1/test.sh	2016-09-22 23:27:43.773024946 -0500
@@ -3380,11 +3380,11 @@
 input_charset
 "
 
-compiler_location=$(which $COMPILER)
+compiler_location=$(which $COMPILER 2>/dev/null)
 if [ "$compiler_location" = "$COMPILER" ]; then
     echo "Compiler:         $COMPILER"
 else
-    echo "Compiler:         $COMPILER ($(which $COMPILER))"
+    echo "Compiler:         $COMPILER ($compiler_location)"
 fi
 echo "Compiler version: $($COMPILER --version | head -n 1)"
 echo


I hope it's helpful.  Thanks,
`~Eric Bavier



More information about the ccache mailing list