diff options
author | Dimitrios Apostolou <jimis@qt.io> | 2024-01-22 01:31:47 +0100 |
---|---|---|
committer | Dimitrios Apostolou <jimis@qt.io> | 2024-01-31 20:07:09 +0100 |
commit | c66f8407a8496f4aff861287439c230ff42d0d1a (patch) | |
tree | f2791de924ad4c77eface5100cd1fbf8521ae6b2 /coin/provisioning/common | |
parent | 710f03ffcca35bacb99cc2c0134c751fb39d2771 (diff) |
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>
Diffstat (limited to 'coin/provisioning/common')
-rwxr-xr-x | coin/provisioning/common/linux/enable_test_stacktraces.sh | 35 | ||||
-rwxr-xr-x | coin/provisioning/common/unix/common.sourced.sh | 2 |
2 files changed, 36 insertions, 1 deletions
diff --git a/coin/provisioning/common/linux/enable_test_stacktraces.sh b/coin/provisioning/common/linux/enable_test_stacktraces.sh new file mode 100755 index 00000000..ee9d4d23 --- /dev/null +++ b/coin/provisioning/common/linux/enable_test_stacktraces.sh @@ -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 diff --git a/coin/provisioning/common/unix/common.sourced.sh b/coin/provisioning/common/unix/common.sourced.sh index e93c1cba..c15d9453 100755 --- a/coin/provisioning/common/unix/common.sourced.sh +++ b/coin/provisioning/common/unix/common.sourced.sh @@ -108,7 +108,7 @@ set_common_environment () { uname_m="$(uname -m)" case "$uname_m" in x86_64|amd64) PROVISIONING_ARCH=amd64 ;; - arm64) PROVISIONING_ARCH=arm64 ;; + aarch64|arm64)PROVISIONING_ARCH=arm64 ;; i[3456]86) PROVISIONING_ARCH=x86 ;; *) fatal "Unknown architecture in uname: $uname_m" 43 ;; esac |