mirror of https://github.com/qt/qt5.git
Enable automatic gdb stacktrace in QTest, in case a test crashes
On Linux, this requires that gdb can be found in PATH, and that no kernel security settings like yama.ptrace_scope prevent it. Patch contains also a drive-by architecture detection fix for Debian arm64. Fixes: QTQAINFRA-6029 Fixes: QTQAINFRA-5940 Fixes: QTQAINFRA-6030 Fixes: QTQAINFRA-6046 Fixes: QTQAINFRA-6012 Fixes: QTQAINFRA-5930 Task-number: QTQAINFRA-5933 Change-Id: Ie6debde94c1cc5783161ffa7354b58734c372702 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Toni Saario <toni.saario@qt.io> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
710f03ffcc
commit
c66f8407a8
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#Copyright (C) 2023 The Qt Company Ltd
|
||||||
|
#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
|
||||||
|
### Enable automatic stacktraces in case of fatal errors in QTest.
|
||||||
|
# This requires that gdb can be found in PATH, and that no
|
||||||
|
# kernel security settings like yama.ptrace_scope prevent it.
|
||||||
|
|
||||||
|
|
||||||
|
PROVISIONING_DIR="$(dirname "$0")/../.."
|
||||||
|
source "$PROVISIONING_DIR/common/unix/common.sourced.sh"
|
||||||
|
|
||||||
|
|
||||||
|
f="/etc/sysctl.d/10-ptrace.conf"
|
||||||
|
if [ -f $f ]
|
||||||
|
then
|
||||||
|
echo "Modifying $f ..."
|
||||||
|
sudo sed -i '/^kernel\.yama\.ptrace_scope *= *[1-9]$/s/[1-9]$/0/' $f
|
||||||
|
# Reload the modified setting, so that we can verify it right afterwards.
|
||||||
|
sudo sysctl -p $f
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify that yama.ptrace_scope = 0, if it's supported by the kernel.
|
||||||
|
ptrace_scope_value=`sudo sysctl kernel.yama.ptrace_scope 2>/dev/null \
|
||||||
|
| sed -E 's/.*([0-9])$/\1/'`
|
||||||
|
if [ -n "$ptrace_scope_value" ] && [ "$ptrace_scope_value" != 0 ]
|
||||||
|
then
|
||||||
|
fatal "kernel.yama.ptrace_scope = $ptrace_scope_value \
|
||||||
|
which means that QTest automatic stacktraces will not work"
|
||||||
|
else
|
||||||
|
echo kernel.yama.ptrace_scope = "$ptrace_scope_value"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
$CMD_PKG_INSTALL gdb
|
|
@ -108,7 +108,7 @@ set_common_environment () {
|
||||||
uname_m="$(uname -m)"
|
uname_m="$(uname -m)"
|
||||||
case "$uname_m" in
|
case "$uname_m" in
|
||||||
x86_64|amd64) PROVISIONING_ARCH=amd64 ;;
|
x86_64|amd64) PROVISIONING_ARCH=amd64 ;;
|
||||||
arm64) PROVISIONING_ARCH=arm64 ;;
|
aarch64|arm64)PROVISIONING_ARCH=arm64 ;;
|
||||||
i[3456]86) PROVISIONING_ARCH=x86 ;;
|
i[3456]86) PROVISIONING_ARCH=x86 ;;
|
||||||
*) fatal "Unknown architecture in uname: $uname_m" 43 ;;
|
*) fatal "Unknown architecture in uname: $uname_m" 43 ;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#Copyright (C) 2023 The Qt Company Ltd
|
||||||
|
#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
BASEDIR=$(dirname "$0")
|
||||||
|
"$BASEDIR"/../common/linux/enable_test_stacktraces.sh
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#Copyright (C) 2023 The Qt Company Ltd
|
||||||
|
#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
BASEDIR=$(dirname "$0")
|
||||||
|
"$BASEDIR"/../common/linux/enable_test_stacktraces.sh
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#Copyright (C) 2023 The Qt Company Ltd
|
||||||
|
#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
BASEDIR=$(dirname "$0")
|
||||||
|
"$BASEDIR"/../common/linux/enable_test_stacktraces.sh
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#Copyright (C) 2023 The Qt Company Ltd
|
||||||
|
#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
BASEDIR=$(dirname "$0")
|
||||||
|
"$BASEDIR"/../common/linux/enable_test_stacktraces.sh
|
Loading…
Reference in New Issue