From 5c5d45ae4953c40d122419751e6038c074b161a9 Mon Sep 17 00:00:00 2001 From: Tim Ruehsen Date: Sat, 11 Apr 2015 17:14:56 +0200 Subject: [PATCH] Added GDB support to Perl tests * WgetTests.pm (run): Check GDB_TESTS environment variable. --- tests/WgetTests.pm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/WgetTests.pm b/tests/WgetTests.pm index 16451663..3427a1bb 100644 --- a/tests/WgetTests.pm +++ b/tests/WgetTests.pm @@ -120,10 +120,20 @@ sub run ($cmdline =~ m{^/.*}msx) ? $cmdline : "$self->{_workdir}/$cmdline"; my $valgrind = $ENV{VALGRIND_TESTS}; - if (!defined $valgrind || $valgrind eq q{} || $valgrind == 0) + if (!defined $valgrind) { + $valgrind = 0; + } - # Valgrind not requested - leave $cmdline as it is + my $gdb = $ENV{GDB_TESTS}; + if (!defined $gdb) + { + $gdb = 0; + } + + if ($gdb == 1) + { + $cmdline = 'gdb --args ' . $cmdline; } elsif ($valgrind == 1) { @@ -132,7 +142,7 @@ sub run . ' --error-exitcode=301 --leak-check=yes --track-origins=yes ' . $cmdline; } - else + elsif ($valgrind ne q{} && $valgrind != 0) { $cmdline = "$valgrind $cmdline"; }