r24342: Move environments into a separate directory.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 12 Aug 2007 01:49:38 +0000 (01:49 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:01:41 +0000 (15:01 -0500)
(This used to be commit e3fe7ef92bae1a870c9de9f90becb3a3c67f98fe)

source4/selftest/env/Samba3.pm [moved from source4/selftest/Samba3.pm with 100% similarity]
source4/selftest/env/Samba4.pm [moved from source4/selftest/Samba4.pm with 100% similarity]
source4/selftest/env/Windows.pm [moved from source4/selftest/Windows.pm with 100% similarity]
source4/selftest/selftest.pl
source4/selftest/subunit-summary [deleted file]
source4/selftest/test_blackbox.sh
source4/selftest/test_nbt.sh

index 68eb194ab37a123289a3f16e3c5ff060d6da22f0..72fad8f2d0209be1972cf5b97c16c1c4b5f46b1e 100755 (executable)
@@ -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 (executable)
index aec50ed..0000000
+++ /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);
index 1080ec327422cef984894bcc746e13a15ea8958d..0f5f87614adc758fed47f2e722b88f6bbcb0ec86 100755 (executable)
@@ -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"
index ceac81092234b46f39159fe0939be36388b4ff8f..cfc1ee31cbeeaab087c677bb059628b799032237 100755 (executable)
@@ -4,8 +4,6 @@
 incdir=`dirname $0`
 . $incdir/test_functions.sh
 
-SCRIPTDIR=../testprogs/ejs
-
 PATH=bin:$PATH
 export PATH