diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-08-12 01:49:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:01:41 -0500 |
commit | a83380eecefbc9d488a404d3a461670838bd11d0 (patch) | |
tree | 150e990283094d2dfe68f97f4758b6ae4c88d99e /source4/selftest | |
parent | 4da477d4fa891703497608c6b93402c4fc278f95 (diff) | |
download | samba-a83380eecefbc9d488a404d3a461670838bd11d0.tar.gz samba-a83380eecefbc9d488a404d3a461670838bd11d0.tar.bz2 samba-a83380eecefbc9d488a404d3a461670838bd11d0.zip |
r24342: Move environments into a separate directory.
(This used to be commit e3fe7ef92bae1a870c9de9f90becb3a3c67f98fe)
Diffstat (limited to 'source4/selftest')
-rw-r--r-- | source4/selftest/env/Samba3.pm (renamed from source4/selftest/Samba3.pm) | 0 | ||||
-rw-r--r-- | source4/selftest/env/Samba4.pm (renamed from source4/selftest/Samba4.pm) | 0 | ||||
-rw-r--r-- | source4/selftest/env/Windows.pm (renamed from source4/selftest/Windows.pm) | 0 | ||||
-rwxr-xr-x | source4/selftest/selftest.pl | 54 | ||||
-rwxr-xr-x | source4/selftest/subunit-summary | 70 | ||||
-rwxr-xr-x | source4/selftest/test_blackbox.sh | 1 | ||||
-rwxr-xr-x | source4/selftest/test_nbt.sh | 2 |
7 files changed, 33 insertions, 94 deletions
diff --git a/source4/selftest/Samba3.pm b/source4/selftest/env/Samba3.pm index b12208bd9f..b12208bd9f 100644 --- a/source4/selftest/Samba3.pm +++ b/source4/selftest/env/Samba3.pm diff --git a/source4/selftest/Samba4.pm b/source4/selftest/env/Samba4.pm index 597cc5d50c..597cc5d50c 100644 --- a/source4/selftest/Samba4.pm +++ b/source4/selftest/env/Samba4.pm diff --git a/source4/selftest/Windows.pm b/source4/selftest/env/Windows.pm index d0c90d7f7b..d0c90d7f7b 100644 --- a/source4/selftest/Windows.pm +++ b/source4/selftest/env/Windows.pm diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 68eb194ab3..72fad8f2d0 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -114,8 +114,9 @@ use Getopt::Long; use POSIX; use Cwd qw(abs_path); use lib "$RealBin"; -use Samba3; -use Samba4; +use env::Samba3; +use env::Samba4; +use env::Windows; use SocketWrapper; my $opt_help = 0; @@ -209,26 +210,13 @@ sub cleanup_pcap($$$) $state->{PCAP_FILE} = undef; } -sub run_test($$$$$$) +sub parse_subunit_results($$$$) { - my ($envname, $name, $cmd, $i, $totalsuites, $msg_ops) = @_; + my ($msg_ops, $msg_state, $statistics, $fh) = @_; my $expected_ret = 1; my $open_tests = {}; - my $msg_state = { - ENVNAME => $envname, - NAME => $name, - CMD => $cmd, - INDEX => $i, - TOTAL => $totalsuites, - START_TIME => time() - }; - - setup_pcap($msg_state); - - $msg_ops->start_testsuite($msg_state); - open(RESULT, "$cmd 2>&1|"); - while (<RESULT>) { + while(<$fh>) { $msg_ops->output_msg($msg_state, $_); if (/^test: (.+)\n/) { $open_tests->{$1} = 1; @@ -237,7 +225,7 @@ sub run_test($$$$$$) my $result = $1; if ($1 eq "success") { delete $open_tests->{$2}; - if (expecting_failure("$name/$2")) { + if (expecting_failure("$msg_state->{NAME}/$2")) { $statistics->{TESTS_UNEXPECTED_OK}++; $msg_ops->end_test($msg_state, $2, $1, 1); } else { @@ -246,12 +234,12 @@ sub run_test($$$$$$) } } elsif ($1 eq "failure") { delete $open_tests->{$2}; - if (expecting_failure("$name/$2")) { + if (expecting_failure("$msg_state->{NAME}/$2")) { $statistics->{TESTS_EXPECTED_FAIL}++; $msg_ops->end_test($msg_state, $2, $1, 0); $expected_ret = 0; } else { - print "n:$name/$2\n"; + print "n:$msg_state->{NAME}/$2\n"; $statistics->{TESTS_UNEXPECTED_FAIL}++; $msg_ops->end_test($msg_state, $2, $1, 1); } @@ -271,6 +259,30 @@ sub run_test($$$$$$) $msg_ops->output_msg($msg_state, "$_ was started but never finished!"); $statistics->{TESTS_ERROR}++; } + + return $expected_ret; +} + +sub run_test($$$$$$) +{ + my ($envname, $name, $cmd, $i, $totalsuites, $msg_ops) = @_; + my $msg_state = { + ENVNAME => $envname, + NAME => $name, + CMD => $cmd, + INDEX => $i, + TOTAL => $totalsuites, + START_TIME => time() + }; + + setup_pcap($msg_state); + + open(RESULT, "$cmd 2>&1|"); + $msg_ops->start_testsuite($msg_state); + + my $expected_ret = parse_subunit_results( + $msg_ops, $msg_state, $statistics, *RESULT); + my $ret = close(RESULT); cleanup_pcap($msg_state, $expected_ret, $ret); diff --git a/source4/selftest/subunit-summary b/source4/selftest/subunit-summary deleted file mode 100755 index aec50ed02a..0000000000 --- a/source4/selftest/subunit-summary +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/perl -# Simple subunit parser -# (C) 2006 Jelmer Vernooij <jelmer@samba.org> - -use strict; -use Getopt::Long; - -my $numtests = 0; -my $numfails = 0; -my $numskips = 0; -my $numsuccess = 0; - -my $opt_help = 0; -my $opt_progress = 0; - -my $result = GetOptions ( - 'help|h|?' => \$opt_help, - 'progress' => \$opt_progress - ); - -if (not $result) { - exit(1); -} - -if ($opt_help) { - print "subunit output summarizer\n"; - print "Copyright (C) 2006 Jelmer Vernooij <jelmer\@samba.org>\n"; - print "\n"; - print "Usage: subunit-summary [OPTION]\n"; - print " --help Print this help message\n"; - print "\n"; - exit(0); -} - -while(<STDIN>) { - next unless (/^(.+): (.+?)( \[)?$/); - if ($1 eq "test") { - $numtests++; - } elsif ($1 eq "error") { - print "E" if ($opt_progress); - } elsif ($1 eq "failure") { - $numfails++; - print "F" if ($opt_progress); - } elsif ($1 eq "success") { - $numsuccess++; - print "." if ($opt_progress); - } elsif ($1 eq "skip") { - $numskips++; - print "I" if ($opt_progress); - } elsif ($1 eq "testsuite") { - if ($opt_progress) { - if ($numtests) { print "\n"; } - print "$2: "; - } - } -} - -print "\n" if ($opt_progress); - -if ($numtests == 0) { - print "No tests run\n"; - exit(0); -} - -printf("%d%%: %d tests, %d succeeded, %d failed, %d skipped\n", - ($numsuccess / $numtests * 100), - $numtests, - $numsuccess, - $numfails, - $numskips); diff --git a/source4/selftest/test_blackbox.sh b/source4/selftest/test_blackbox.sh index 1080ec3274..0f5f87614a 100755 --- a/source4/selftest/test_blackbox.sh +++ b/source4/selftest/test_blackbox.sh @@ -18,5 +18,4 @@ incdir=`dirname $0` plantest "blackbox.smbclient" dc $incdir/../../testprogs/blackbox/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" "$ADDARGS" plantest "blackbox.kinit" dc $incdir/../../testprogs/blackbox/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" "$ADDARGS" - plantest "blackbox.cifsdd" dc $incdir/../../testprogs/blackbox/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$ADDARGS" diff --git a/source4/selftest/test_nbt.sh b/source4/selftest/test_nbt.sh index ceac810922..cfc1ee31cb 100755 --- a/source4/selftest/test_nbt.sh +++ b/source4/selftest/test_nbt.sh @@ -4,8 +4,6 @@ incdir=`dirname $0` . $incdir/test_functions.sh -SCRIPTDIR=../testprogs/ejs - PATH=bin:$PATH export PATH |