diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/run | 11 | ||||
-rw-r--r-- | test/suites/base.bash | 25 | ||||
-rw-r--r-- | test/suites/cpp1.bash | 2 | ||||
-rw-r--r-- | test/suites/debug_prefix_map.bash | 2 | ||||
-rw-r--r-- | test/suites/direct.bash | 2 | ||||
-rw-r--r-- | test/suites/hardlink.bash | 3 | ||||
-rw-r--r-- | test/suites/masquerading.bash | 9 |
7 files changed, 38 insertions, 16 deletions
@@ -166,6 +166,11 @@ expect_equal_object_files() { test_failed "Please install elfutils to get eu-elfcmp" fi eu-elfcmp -q "$1" "$2" + elif $HOST_OS_FREEBSD && $COMPILER_TYPE_CLANG; then + elfdump -a -w "$1".dump "$1" + elfdump -a -w "$2".dump "$2" + # these were the elfdump fields that seemed to differ (empirically) + diff -I e_shoff -I sh_size -I st_name "$1".dump "$2".dump > /dev/null else cmp -s "$1" "$2" fi @@ -313,7 +318,7 @@ fi 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 @@ -334,6 +339,7 @@ COMPILER_USES_MINGW=false HOST_OS_APPLE=false HOST_OS_LINUX=false +HOST_OS_FREEBSD=false HOST_OS_WINDOWS=false compiler_version="`$COMPILER --version 2>&1 | head -1`" @@ -369,6 +375,9 @@ case $(uname -s) in *Linux*) HOST_OS_LINUX=true ;; + *FreeBSD*) + HOST_OS_FREEBSD=true + ;; esac if $HOST_OS_WINDOWS; then diff --git a/test/suites/base.bash b/test/suites/base.bash index 307100e8..cbfee846 100644 --- a/test/suites/base.bash +++ b/test/suites/base.bash @@ -298,8 +298,8 @@ base_tests() { # ------------------------------------------------------------------------- TEST "CCACHE_EXTRAFILES" - echo a >a - echo b >b + echo "a" >a + echo "b" >b $CCACHE_COMPILE -c test1.c expect_stat 'cache hit (preprocessed)' 0 @@ -495,7 +495,8 @@ 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 "\$@" # A comment EOF @@ -523,7 +524,8 @@ 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 @@ -546,7 +548,8 @@ 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 @@ -569,7 +572,8 @@ 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 @@ -595,7 +599,8 @@ 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 @@ -628,7 +633,8 @@ 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 @@ -787,7 +793,8 @@ EOF 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 diff --git a/test/suites/cpp1.bash b/test/suites/cpp1.bash index 965d4667..6655778d 100644 --- a/test/suites/cpp1.bash +++ b/test/suites/cpp1.bash @@ -33,7 +33,7 @@ SUITE_cpp1() { elif $COMPILER_TYPE_CLANG; then cpp_flag="-frewrite-includes" fi - cpp_flag+=" -DBAZ=3" + cpp_flag="$cpp_flag -DBAZ=3" # ------------------------------------------------------------------------- TEST "Base case" diff --git a/test/suites/debug_prefix_map.bash b/test/suites/debug_prefix_map.bash index 25cc36ff..d00e6547 100644 --- a/test/suites/debug_prefix_map.bash +++ b/test/suites/debug_prefix_map.bash @@ -23,6 +23,8 @@ EOF objdump_cmd() { if $HOST_OS_APPLE; then xcrun dwarfdump -r0 $1 + elif $HOST_OS_FREEBSD; then + objdump -W $1 else objdump -g $1 fi diff --git a/test/suites/direct.bash b/test/suites/direct.bash index 085029c0..f12d6c48 100644 --- a/test/suites/direct.bash +++ b/test/suites/direct.bash @@ -448,7 +448,7 @@ EOF 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 diff --git a/test/suites/hardlink.bash b/test/suites/hardlink.bash index 8e7e8b0d..f4f969e3 100644 --- a/test/suites/hardlink.bash +++ b/test/suites/hardlink.bash @@ -25,7 +25,8 @@ SUITE_hardlink() { expect_stat 'files in cache' 1 expect_equal_object_files reference_test1.o test1.o - local obj_in_cache=$(find $CCACHE_DIR -name '*.o') + local obj_in_cache + obj_in_cache=$(find $CCACHE_DIR -name '*.o') if [ ! $obj_in_cache -ef test1.o ]; then test_failed "Object file not hard-linked to cached object file" fi diff --git a/test/suites/masquerading.bash b/test/suites/masquerading.bash index 0b42eef3..fbbb78f2 100644 --- a/test/suites/masquerading.bash +++ b/test/suites/masquerading.bash @@ -1,13 +1,16 @@ SUITE_masquerading_PROBE() { - local compiler_binary=$(echo $COMPILER | cut -d' ' -f1) + local compiler_binary + compiler_binary=$(echo $COMPILER | cut -d' ' -f1) if [ "$(dirname $compiler_binary)" != . ]; then echo "compiler ($compiler_binary) not taken from PATH" fi } SUITE_masquerading_SETUP() { - local compiler_binary=$(echo $COMPILER | cut -d' ' -f1) - local compiler_args=$(echo $COMPILER | cut -s -d' ' -f2-) + local compiler_binary + compiler_binary=$(echo $COMPILER | cut -d' ' -f1) + local compiler_args + compiler_args=$(echo $COMPILER | cut -s -d' ' -f2-) ln -s "$CCACHE" $compiler_binary CCACHE_COMPILE="./$compiler_binary $compiler_args" |