HOST_CCACHE_DIRS="/usr/lib/ccache/bin
/usr/lib/ccache"
for HOST_CCACHE_DIR in $HOST_CCACHE_DIRS; do
- PATH=$(echo -n $PATH | awk -v RS=: -v ORS=: '$0 != "'$HOST_CCACHE_DIR'"' | sed 's/:$//')
+ PATH="$(echo "$PATH:" | awk -v RS=: -v ORS=: '$0 != "'$HOST_CCACHE_DIR'"' | sed 's/:*$//')"
done
export PATH
cat >compiler.sh <<EOF
#!/bin/sh
-export CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+export CCACHE_DISABLE
exec $COMPILER "\$@"
# A comment
EOF
cat >compiler.sh <<EOF
#!/bin/sh
-export CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+export CCACHE_DISABLE
exec $COMPILER "\$@"
EOF
chmod +x compiler.sh
cat >compiler.sh <<EOF
#!/bin/sh
-export CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+export CCACHE_DISABLE
exec $COMPILER "\$@"
EOF
chmod +x compiler.sh
cat >compiler.sh <<EOF
#!/bin/sh
-export CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+export CCACHE_DISABLE
exec $COMPILER "\$@"
EOF
chmod +x compiler.sh
cat >compiler.sh <<EOF
#!/bin/sh
-export CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+export CCACHE_DISABLE
exec $COMPILER "\$@"
EOF
chmod +x compiler.sh
cat >compiler.sh <<EOF
#!/bin/sh
-export CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+export CCACHE_DISABLE
exec $COMPILER "\$@"
EOF
chmod +x compiler.sh
cat >buggy-cpp <<EOF
#!/bin/sh
-export CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+CCACHE_DISABLE=1 # If $COMPILER happens to be a ccache symlink...
+export CCACHE_DISABLE
if echo "\$*" | grep -- -D >/dev/null; then
$COMPILER "\$@"
else
elif $COMPILER_TYPE_CLANG; then
cpp_flag="-frewrite-includes"
fi
- cpp_flag+=" -DBAZ=3"
+ cpp_flag="$cpp_flag -DBAZ=3"
# -------------------------------------------------------------------------
TEST "Base case"
expect_stat 'cache miss' 1
expect_equal_files test.d expected.d
- find $CCACHE_DIR -name '*.d' -delete
+ find $CCACHE_DIR -name '*.d' -exec rm '{}' +
# Missing file -> consider the cached result broken.
$CCACHE_COMPILE -c -MD test.c