sub getlog_env($);
-sub setup_pcap($)
-{
- my ($name) = @_;
-
- return unless ($opt_socket_wrapper_pcap);
- return unless defined($ENV{SOCKET_WRAPPER_PCAP_DIR});
-
- my $fname = $name;
- $fname =~ s%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-]%_%g;
-
- my $pcap_file = "$ENV{SOCKET_WRAPPER_PCAP_DIR}/$fname.pcap";
-
- SocketWrapper::setup_pcap($pcap_file);
-
- return $pcap_file;
-}
-
-sub cleanup_pcap($$)
-{
- my ($pcap_file, $exitcode) = @_;
-
- return unless ($opt_socket_wrapper_pcap);
- return if ($opt_socket_wrapper_keep_pcap);
- return unless ($exitcode == 0);
- return unless defined($pcap_file);
-
- unlink($pcap_file);
-}
-
# expand strings from %ENV
sub expand_environment_strings($)
{
return $s;
}
+my $target;
+
sub run_testsuite($$$$$)
{
my ($envname, $name, $cmd, $i, $totalsuites) = @_;
- my $pcap_file = setup_pcap($name);
+ my $pcap_file = $target->setup_pcap($name);
Subunit::start_testsuite($name);
Subunit::progress_push();
Subunit::end_testsuite($name, "failure", "Exit code was $exitcode");
}
- cleanup_pcap($pcap_file, $exitcode);
+ $target->cleanup_pcap($pcap_file, $exitcode);
if (not $opt_socket_wrapper_keep_pcap and defined($pcap_file)) {
print "PCAP FILE: $pcap_file\n";
$ENV{SAMBA_DNS_FAKING} = 1;
}
-my $target;
my $testenv_default = "none";
if ($opt_mitkrb5 == 1) {
$server_maxtime = $ENV{SMBD_MAXTIME};
}
-$target = new Samba($bindir, $srcdir, $server_maxtime);
+$target = new Samba($bindir, $srcdir, $server_maxtime,
+ $opt_socket_wrapper_pcap,
+ $opt_socket_wrapper_keep_pcap);
unless ($opt_list) {
if ($opt_target eq "samba") {
$testenv_default = "ad_dc";
use IO::Poll qw(POLLIN);
sub new($$$$$) {
- my ($classname, $bindir, $srcdir, $server_maxtime) = @_;
+ my ($classname, $bindir, $srcdir, $server_maxtime,
+ $opt_socket_wrapper_pcap, $opt_socket_wrapper_keep_pcap) = @_;
my $self = {
samba3 => new Samba3($bindir, $srcdir, $server_maxtime),
samba4 => new Samba4($bindir, $srcdir, $server_maxtime),
+ opt_socket_wrapper_pcap => $opt_socket_wrapper_pcap,
+ opt_socket_wrapper_keep_pcap => $opt_socket_wrapper_keep_pcap,
};
bless $self;
return $self;
$ENV_NEEDS_AD_DC{$env} = ($env =~ /^ad_/);
}
+sub setup_pcap($$)
+{
+ my ($self, $name) = @_;
+
+ return unless ($self->{opt_socket_wrapper_pcap});
+ return unless defined($ENV{SOCKET_WRAPPER_PCAP_DIR});
+
+ my $fname = $name;
+ $fname =~ s%[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\-]%_%g;
+
+ my $pcap_file = "$ENV{SOCKET_WRAPPER_PCAP_DIR}/$fname.pcap";
+
+ SocketWrapper::setup_pcap($pcap_file);
+
+ return $pcap_file;
+}
+
+sub cleanup_pcap($$$)
+{
+ my ($self, $pcap_file, $exitcode) = @_;
+
+ return unless ($self->{opt_socket_wrapper_pcap});
+ return if ($self->{opt_socket_wrapper_keep_pcap});
+ return unless ($exitcode == 0);
+ return unless defined($pcap_file);
+
+ unlink($pcap_file);
+}
+
sub setup_env($$$)
{
my ($self, $envname, $path) = @_;