Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin Enable TSan tests for GCC and >32bit address s...



details:   https://anonhg.NetBSD.org/src/rev/1fe1334d7c54
branches:  trunk
changeset: 954981:1fe1334d7c54
user:      kamil <kamil%NetBSD.org@localhost>
date:      Mon Sep 14 15:17:53 2020 +0000

description:
Enable TSan tests for GCC and >32bit address space environments

diffstat:

 tests/usr.bin/c++/t_tsan_data_race.sh            |  16 ++++++++++------
 tests/usr.bin/c++/t_tsan_heap_use_after_free.sh  |  16 ++++++++++------
 tests/usr.bin/c++/t_tsan_lock_order_inversion.sh |  16 ++++++++++------
 tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh |  16 ++++++++++------
 tests/usr.bin/c++/t_tsan_signal_errno.sh         |  16 ++++++++++------
 tests/usr.bin/c++/t_tsan_thread_leak.sh          |  16 ++++++++++------
 tests/usr.bin/c++/t_tsan_vptr_race.sh            |  16 ++++++++++------
 tests/usr.bin/cc/t_tsan_data_race.sh             |  16 ++++++++++------
 tests/usr.bin/cc/t_tsan_heap_use_after_free.sh   |  16 ++++++++++------
 tests/usr.bin/cc/t_tsan_lock_order_inversion.sh  |  16 ++++++++++------
 tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh  |  16 ++++++++++------
 tests/usr.bin/cc/t_tsan_signal_errno.sh          |  16 ++++++++++------
 tests/usr.bin/cc/t_tsan_thread_leak.sh           |  16 ++++++++++------
 13 files changed, 130 insertions(+), 78 deletions(-)

diffs (truncated from 338 to 300 lines):

diff -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/c++/t_tsan_data_race.sh
--- a/tests/usr.bin/c++/t_tsan_data_race.sh     Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/c++/t_tsan_data_race.sh     Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/c++/t_tsan_heap_use_after_free.sh
--- a/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh   Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/c++/t_tsan_heap_use_after_free.sh   Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/c++/t_tsan_lock_order_inversion.sh
--- a/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh  Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/c++/t_tsan_lock_order_inversion.sh  Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh
--- a/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh  Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/c++/t_tsan_locked_mutex_destroy.sh  Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/c++/t_tsan_signal_errno.sh
--- a/tests/usr.bin/c++/t_tsan_signal_errno.sh  Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/c++/t_tsan_signal_errno.sh  Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/c++/t_tsan_thread_leak.sh
--- a/tests/usr.bin/c++/t_tsan_thread_leak.sh   Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/c++/t_tsan_thread_leak.sh   Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/c++/t_tsan_vptr_race.sh
--- a/tests/usr.bin/c++/t_tsan_vptr_race.sh     Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/c++/t_tsan_vptr_race.sh     Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/cc/t_tsan_data_race.sh
--- a/tests/usr.bin/cc/t_tsan_data_race.sh      Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/cc/t_tsan_data_race.sh      Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/cc/t_tsan_heap_use_after_free.sh
--- a/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh    Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/cc/t_tsan_heap_use_after_free.sh    Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/cc/t_tsan_lock_order_inversion.sh
--- a/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh   Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/cc/t_tsan_lock_order_inversion.sh   Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh
--- a/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh   Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/cc/t_tsan_locked_mutex_destroy.sh   Mon Sep 14 15:17:53 2020 +0000
@@ -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 -r dd3f9e2ebb18 -r 1fe1334d7c54 tests/usr.bin/cc/t_tsan_signal_errno.sh
--- a/tests/usr.bin/cc/t_tsan_signal_errno.sh   Mon Sep 14 15:11:13 2020 +0000
+++ b/tests/usr.bin/cc/t_tsan_signal_errno.sh   Mon Sep 14 15:17:53 2020 +0000
@@ -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



Home | Main Index | Thread Index | Old Index