1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

selftest: create pcap files for invidual env services

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Stefan Metzmacher 2019-10-30 21:53:39 +01:00
parent 4effc5585e
commit f182c9a36b
3 changed files with 15 additions and 11 deletions

View File

@ -18,11 +18,11 @@ sub new($$$$$) {
$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,
};
$self->{samba3} = new Samba3($self, $bindir, $srcdir, $server_maxtime);
$self->{samba4} = new Samba4($self, $bindir, $srcdir, $server_maxtime);
bless $self;
return $self;
}
@ -670,6 +670,8 @@ sub get_env_for_process
sub fork_and_exec
{
my ($self, $env_vars, $daemon_ctx, $STDIN_READER) = @_;
my $SambaCtx = $self;
$SambaCtx = $self->{SambaCtx} if defined($self->{SambaCtx});
unlink($daemon_ctx->{LOG_FILE});
print "STARTING $daemon_ctx->{NAME} for $ENV{ENVNAME}...";
@ -694,7 +696,7 @@ sub fork_and_exec
SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE});
if (defined($daemon_ctx->{PCAP_FILE})) {
SocketWrapper::setup_pcap($daemon_ctx->{PCAP_FILE});
$SambaCtx->setup_pcap("$daemon_ctx->{PCAP_FILE}");
}
# setup ENV variables in the child process

View File

@ -54,8 +54,9 @@ sub get_fs_specific_conf($$)
}
sub new($$) {
my ($classname, $bindir, $srcdir, $server_maxtime) = @_;
my ($classname, $SambaCtx, $bindir, $srcdir, $server_maxtime) = @_;
my $self = { vars => {},
SambaCtx => $SambaCtx,
bindir => $bindir,
srcdir => $srcdir,
server_maxtime => $server_maxtime
@ -1346,6 +1347,7 @@ sub check_or_start($$$$$) {
BINARY_PATH => $binary,
FULL_CMD => [ @full_cmd ],
LOG_FILE => $env_vars->{NMBD_TEST_LOG},
PCAP_FILE => "env-$ENV{ENVNAME}-nmbd",
ENV_VARS => $nmbd_envs,
};
if ($nmbd ne "yes") {
@ -1370,6 +1372,7 @@ sub check_or_start($$$$$) {
BINARY_PATH => $binary,
FULL_CMD => [ @full_cmd ],
LOG_FILE => $env_vars->{WINBINDD_TEST_LOG},
PCAP_FILE => "env-$ENV{ENVNAME}-winbindd",
};
if ($winbindd ne "yes") {
$daemon_ctx->{SKIP_DAEMON} = 1;
@ -1390,6 +1393,7 @@ sub check_or_start($$$$$) {
BINARY_PATH => $binary,
FULL_CMD => [ @full_cmd ],
LOG_FILE => $env_vars->{SMBD_TEST_LOG},
PCAP_FILE => "env-$ENV{ENVNAME}-smbd",
};
if ($smbd ne "yes") {
$daemon_ctx->{SKIP_DAEMON} = 1;

View File

@ -20,14 +20,15 @@ use Archive::Tar;
use File::Path 'make_path';
sub new($$$$$) {
my ($classname, $bindir, $srcdir, $server_maxtime) = @_;
my ($classname, $SambaCtx, $bindir, $srcdir, $server_maxtime) = @_;
my $self = {
vars => {},
SambaCtx => $SambaCtx,
bindir => $bindir,
srcdir => $srcdir,
server_maxtime => $server_maxtime,
target3 => new Samba3($bindir, $srcdir, $server_maxtime)
target3 => new Samba3($SambaCtx, $bindir, $srcdir, $server_maxtime)
};
bless $self;
return $self;
@ -89,6 +90,7 @@ sub check_or_start($$$)
FULL_CMD => [ @full_cmd ],
LOG_FILE => $env_vars->{SAMBA_TEST_LOG},
TEE_STDOUT => 1,
PCAP_FILE => "env-$ENV{ENVNAME}-samba",
ENV_VARS => $samba_envs,
};
my $pid = Samba::fork_and_exec($self, $env_vars, $daemon_ctx, $STDIN_READER);
@ -323,14 +325,10 @@ sub setup_dns_hub_internal($$$)
FULL_CMD => [ @full_cmd ],
LOG_FILE => $env->{DNS_HUB_LOG},
TEE_STDOUT => 1,
PCAP_FILE => "env-$ENV{ENVNAME}-dns_hub",
ENV_VARS => {},
};
my $pcap_dir = $ENV{SOCKET_WRAPPER_PCAP_DIR};
if (defined $pcap_dir) {
$daemon_ctx->{PCAP_FILE} = "$pcap_dir/env-$hostname$.pcap",
}
# use a pipe for stdin in the child processes. This allows
# those processes to monitor the pipe for EOF to ensure they
# exit when the test script exits