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

2016-09-25 Thread Joel Rosdahl
Hi Eric,

On 23 September 2016 at 06:41, Eric Bavier  wrote:
> While running ccache's test suite via `make check` I get output from
> 'which': [...]

Thanks for the report and suggestion!

I made an alternative fix like this (which also should work with
various shells' builtin "which" implementations):

--- a/test.sh
+++ b/test.sh
@@ -3380,11 +3380,11 @@ upgrade
 input_charset
 "

-compiler_location=$(which $COMPILER)
+compiler_location=$(which $(echo "$COMPILER" | awk '{print $1}'))
 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

-- Joel

___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache


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

2016-09-22 Thread Eric Bavier
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.0 -0500
+++ ccache-3.3.1/test.sh2016-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

___
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache