diff --git a/tests/usr.bin/c++/t_tsan_data_race.sh b/tests/usr.bin/c++/t_tsan_data_race.sh index 4106ad1c094f..1434c1d3d571 100644 --- a/tests/usr.bin/c++/t_tsan_data_race.sh +++ b/tests/usr.bin/c++/t_tsan_data_race.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v c++ >/dev/null 2>&1 && \ - ! echo __clang__ | c++ -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | c++ -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh b/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh index ac43c7a146ee..e85d3155ab26 100644 --- a/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh +++ b/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v c++ >/dev/null 2>&1 && \ - ! echo __clang__ | c++ -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | c++ -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh b/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh index f81765ebe28c..7dcb25f941a2 100644 --- a/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh +++ b/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v c++ >/dev/null 2>&1 && \ - ! echo __clang__ | c++ -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | c++ -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh b/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh index 125af4b1b27d..661b4dfebe21 100644 --- a/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh +++ b/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v c++ >/dev/null 2>&1 && \ - ! echo __clang__ | c++ -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | c++ -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/c++/t_tsan_signal_errno.sh b/tests/usr.bin/c++/t_tsan_signal_errno.sh index e9479664e9e5..2a8f63086e7d 100644 --- a/tests/usr.bin/c++/t_tsan_signal_errno.sh +++ b/tests/usr.bin/c++/t_tsan_signal_errno.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v c++ >/dev/null 2>&1 && \ - ! echo __clang__ | c++ -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | c++ -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/c++/t_tsan_thread_leak.sh b/tests/usr.bin/c++/t_tsan_thread_leak.sh index 8d1a2015a5c5..02d53d0bebc9 100644 --- a/tests/usr.bin/c++/t_tsan_thread_leak.sh +++ b/tests/usr.bin/c++/t_tsan_thread_leak.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v c++ >/dev/null 2>&1 && \ - ! echo __clang__ | c++ -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | c++ -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/c++/t_tsan_vptr_race.sh b/tests/usr.bin/c++/t_tsan_vptr_race.sh index 542ba280758f..08b8f69cb654 100644 --- a/tests/usr.bin/c++/t_tsan_vptr_race.sh +++ b/tests/usr.bin/c++/t_tsan_vptr_race.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v c++ >/dev/null 2>&1 && \ - ! echo __clang__ | c++ -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | c++ -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/cc/t_tsan_data_race.sh b/tests/usr.bin/cc/t_tsan_data_race.sh index 8874c8195003..7acef845dcb4 100644 --- a/tests/usr.bin/cc/t_tsan_data_race.sh +++ b/tests/usr.bin/cc/t_tsan_data_race.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v cc >/dev/null 2>&1 && \ - ! echo __clang__ | cc -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | cc -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh b/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh index 52d829d70e18..e9b354d4eac6 100644 --- a/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh +++ b/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v cc >/dev/null 2>&1 && \ - ! echo __clang__ | cc -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | cc -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh b/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh index 5c88d098bf69..cfcbee048ddc 100644 --- a/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh +++ b/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v cc >/dev/null 2>&1 && \ - ! echo __clang__ | cc -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | cc -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh b/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh index 86bded45d8ff..7e0b89a55bd5 100644 --- a/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh +++ b/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v cc >/dev/null 2>&1 && \ - ! echo __clang__ | cc -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | cc -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/cc/t_tsan_signal_errno.sh b/tests/usr.bin/cc/t_tsan_signal_errno.sh index 58dcd6a8c5be..ae67504475cf 100644 --- a/tests/usr.bin/cc/t_tsan_signal_errno.sh +++ b/tests/usr.bin/cc/t_tsan_signal_errno.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v cc >/dev/null 2>&1 && \ - ! echo __clang__ | cc -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | cc -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi } diff --git a/tests/usr.bin/cc/t_tsan_thread_leak.sh b/tests/usr.bin/cc/t_tsan_thread_leak.sh index c25d4c4377c9..7e628291a35e 100644 --- a/tests/usr.bin/cc/t_tsan_thread_leak.sh +++ b/tests/usr.bin/cc/t_tsan_thread_leak.sh @@ -29,12 +29,16 @@ test_target() { SUPPORT='n' - if uname -m | grep -q "amd64" && command -v cc >/dev/null 2>&1 && \ - ! echo __clang__ | cc -E - | grep -q __clang__; then - # only clang with major version newer than 7 is supported - CLANG_MAJOR=`echo __clang_major__ | cc -E - | grep -o '^[[:digit:]]'` - if [ "$CLANG_MAJOR" -ge "7" ]; then - SUPPORT='y' + # Detect address space larger than 32 bits + maxaddress=`sysctl vm.maxaddress|awk '{print $3}'` + if [ $maxaddress -gt 4294967295 ]; then + if command -v cc >/dev/null 2>&1; then + if ! echo __clang__ | cc -E - | grep -q __clang__; then + SUPPORT='y' + elif ! cc -v 2>&1 | awk '/gcc version/{print $3}' | \ + awk -F '.' '($0+0) > 9 {exit 1}'; then + SUPPORT='y' + fi fi fi }