Skip to content

Commit 0802259

Browse files
upload_coredumps: Upload backtrace if DEBUG is set
By cloning a job with DEBUG=1 it's possible to get a backtrace on non-transactional systems. Related ticket: https://progress.opensuse.org/issues/197969
1 parent 2b0fbc9 commit 0802259

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

lib/Utils/Logging.pm

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use Utils::Systemd 'get_started_systemd_services';
2323
use File::Basename 'basename';
2424
use Mojo::File 'path';
2525
use serial_terminal 'select_serial_terminal';
26-
use version_utils 'is_tumbleweed';
26+
use version_utils qw(is_tumbleweed is_transactional);
2727

2828
our @EXPORT = qw(
2929
save_and_upload_log
@@ -178,12 +178,26 @@ sub upload_coredumps {
178178
record_info("COREDUMPS found", "we found coredumps on SUT, attempt to upload");
179179
# Record soft-failure only on selected cases to collect data
180180
record_soft_failure("poo#197969 - Coredumps are being silently ignored in openQA tests") if (is_tumbleweed || get_var("CONTAINER_RUNTIMES"));
181+
my $get_backtrace = get_var("DEBUG") && !is_transactional;
182+
if ($get_backtrace) {
183+
script_run('sed -i s/enabled=0/enabled=1/ /etc/zypp/repos.d/*-[Dd]ebug.repo');
184+
script_run('zypper -n refresh', timeout => 300);
185+
script_run('zypper -n install -y gdb', timeout => 300);
186+
script_run('echo set debuginfod enabled on > ~/.gdbinit');
187+
}
181188
foreach my $pid (@pids) {
182189
my $cmd = qq(coredumpctl info --no-pager $pid | tee info$pid.txt | awk '\$1 == "Storage:" { print \$2; exit }');
183190
my $core = script_output($cmd, timeout => 600, proceed_on_failure => 1);
184191
last unless $core;
185192
upload_logs("info$pid.txt", log_name => basename($core) . ".txt", failok => 1);
186193
upload_logs($core, failok => 1);
194+
if ($get_backtrace) {
195+
# First download debuginfo stuff to avoid polluting backtrace with download progress
196+
script_run(qq(coredumpctl debug -A '-q -ex "pagination off" -ex quit' $pid), timeout => 900);
197+
my $gdb_script = '-q -batch -ex "thread apply all bt full" -ex quit';
198+
script_run("coredumpctl debug -A '$gdb_script' $pid > backtrace$pid.txt", timeout => 900);
199+
upload_logs("backtrace$pid.txt", log_name => basename($core) . "_backtrace.txt", failok => 1);
200+
}
187201
}
188202
}
189203

variables.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ HELM_CONFIG | string | | Additional configuration file for helm |
5858
HELM_LOGIN | string | Comma-separated list of login information if required for a registry, e.g. `registry.suse.de:username:password,registry.suse.de:geekotest:notsecret`
5959
HELM_FULL_REGISTRY_PATH | string | Full path to the registry images used by the helm chart. e.g. `my.registry.com/myteam/secret_project`. Only necessary when using non-publicly available container images. |
6060
CPU_BUGS | boolean | | Into Mitigations testing
61+
DEBUG | boolean | | Enable some debugging facilities like backtraces for coredumps, etc.
6162
DESKTOP | string | | Indicates expected DM, e.g. `gnome`, `kde`, `textmode`, `xfce`, `lxde`. Does NOT prescribe installation mode. Installation is controlled by `VIDEOMODE` setting
6263
DEPENDENCY_RESOLVER_FLAG| boolean | false | Control whether the resolve_dependecy_issues will be scheduled or not before certain modules which need it.
6364
DEV_IMAGE | boolean | false | This setting is used to set variables properly when SDK or Development-Tools are required.

0 commit comments

Comments
 (0)