r24873: Print smbd/nmbd log files for Samba 3.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 1 Sep 2007 23:11:48 +0000 (23:11 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:03:25 +0000 (15:03 -0500)
(This used to be commit 8dad4c5503b2987bdf44324301a067063d48495f)

source4/selftest/env/Samba3.pm

index b699fbb2b54e84de01ab2f1da7d9621260c6ccfc..22c6f59987741b81ef24c81c8102543d7495bd6f 100644 (file)
@@ -8,6 +8,7 @@ package Samba3;
 use strict;
 use Cwd qw(abs_path);
 use FindBin qw($RealBin);
+use POSIX;
 
 sub binpath($$)
 {
@@ -39,12 +40,32 @@ sub teardown_env($$)
        return 0;
 }
 
+sub getlog_env_app($$$)
+{
+       my ($self, $envvars, $name) = @_;
+
+       my $title = "$name LOG of: $envvars->{NETBIOSNAME}\n";
+       my $out = $title;
+
+       open(LOG, "<".$envvars->{$name."_TEST_LOG"});
+
+       seek(LOG, $envvars->{$name."_TEST_LOG_POS"}, SEEK_SET);
+       while (<LOG>) {
+               $out .= $_;
+       }
+       $envvars->{$name."_TEST_LOG_POS"} = tell(LOG);
+       close(LOG);
+
+       return "" if $out eq $title;
+       return $out;
+}
+
 sub getlog_env($$)
 {
        my ($self, $envvars) = @_;
 
-       # TODO...
-       return "";
+       return $self->getlog_env_app($envvars, "SMBD") .  $self->getlog_env_app($envvars, "NMBD");
 }
 
 sub check_env($$)
@@ -62,7 +83,7 @@ sub setup_env($$$)
        if ($envname eq "dc") {
                return $self->setup_dc("$path/dc");
        } else {
-               die("Samba3 can't provide environment '$envname'");
+               return undef;
        }
 }