Commit 14f37920 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Add debug flag to libvirt-tck command

* bin/libvirt-tck: Add --debug/-d
* lib/Sys/Virt/TCK.pm: Use cluck/confess under debug mode
parent c443d000
......@@ -121,6 +121,7 @@ use Pod::Usage;
# C<prove> directly'
use App::Prove;
use Carp qw(confess cluck);
my $datadir = catdir(rootdir(), qw(usr share libvirt-tck));
my $confdir = catdir(rootdir(), qw(etc libvirt-tck));
......@@ -130,12 +131,14 @@ my $verbose = 0;
my $quiet = 0;
my $help = 0;
my $force = 0;
my $debug = 0;
my $archive;
my $config = catfile($confdir, "default.cfg");
my $format = "text";
my $testdir = catdir($datadir, "tests");
if (!GetOptions("verbose" => \$verbose,
"debug" => \$debug,
"quiet" => \$quiet,
"help" => \$help,
"archive=s" => \$archive,
......@@ -148,6 +151,13 @@ if (!GetOptions("verbose" => \$verbose,
-exitval => $help ? 0 : 1);
}
if ($debug) {
warn "do debug";
$SIG{__WARN__} = sub { Carp::cluck $_[0] };
$SIG{__DIE__} = sub { Carp::confess $_[0] };
$ENV{LIBVIRT_TCK_DEBUG} = 1;
}
my $conffile;
unless (-e $config) {
print STDERR "$0: config file $config does not exist\n";
......
......@@ -20,6 +20,7 @@ use LWP::UserAgent;
use IO::Uncompress::Gunzip qw(gunzip);
use IO::Uncompress::Bunzip2 qw(bunzip2);
use XML::XPath;
use Carp qw(cluck carp);
use Test::Builder;
use Sub::Uplevel qw(uplevel);
......@@ -41,6 +42,11 @@ sub new {
$self->{autoclean} = $params{autoclean} ? $params{autoclean} :
($ENV{LIBVIRT_TCK_AUTOCLEAN} || 0);
if ($ENV{LIBVIRT_TCK_DEBUG}) {
$SIG{__WARN__} = sub { Carp::cluck $_[0]; };
$SIG{__DIE__} = sub { Carp::confess $_[0]; };
}
bless $self, $class;
return $self;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment