Rev 11305: Fix testenv, handle stderr output,
fix upgrade.js in file:///home/jelmer/bzr.samba/4.0-perlselftest/
Jelmer Vernooij
jelmer at samba.org
Thu Feb 1 12:16:14 GMT 2007
At file:///home/jelmer/bzr.samba/4.0-perlselftest/
------------------------------------------------------------
revno: 11305
revision-id: jelmer at samba.org-20070201121601-ra9jpil2b2q895jd
parent: jelmer at samba.org-20070126152324-vgyvll2lrmezmbvw
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 4.0-perlselftest
timestamp: Thu 2007-02-01 13:16:01 +0100
message:
Fix testenv, handle stderr output, fix upgrade.js
added:
source/script/tests/testenv.sh testenv.sh-20070201114140-yqamcl9g11yeseoc-1
modified:
source/main.mk svn-v2:8991 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fmain.mk
source/script/tests/selftest.pl svn-v2:20693 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fscript%2ftests%2fselftest.pl
source/scripting/libjs/upgrade.js svn-v2:9722 at 0c0555d6-39d7-0310-84fc-f1cc0bd64818-branches%2fSAMBA_4_0-source%2fscripting%2flibjs%2fupgrade.js
=== added file 'source/script/tests/testenv.sh'
--- a/source/script/tests/testenv.sh 1970-01-01 00:00:00 +0000
+++ b/source/script/tests/testenv.sh 2007-02-01 12:16:01 +0000
@@ -0,0 +1,9 @@
+#!/bin/sh
+PREFIX=$1
+shift 1
+for I in `./script/tests/mktestsetup.sh $PREFIX`
+do
+ eval $I
+ export `echo $I | cut -d = -f 1`
+done
+xterm
=== modified file 'source/main.mk'
--- a/source/main.mk 2007-01-26 12:05:18 +0000
+++ b/source/main.mk 2007-02-01 12:16:01 +0000
@@ -298,7 +298,7 @@
$(SELFTEST) --quick --socket-wrapper $(TESTS)
testenv: all libraries
- $(SELFTEST) --socket-wrapper xterm
+ $(srcdir)/script/tests/testenv.sh
valgrindtest: valgrindtest-quick
=== modified file 'source/script/tests/selftest.pl'
--- a/source/script/tests/selftest.pl 2007-01-26 15:23:24 +0000
+++ b/source/script/tests/selftest.pl 2007-02-01 12:16:01 +0000
@@ -219,21 +219,53 @@
print "Running test $name (level 0 stdout)\n";
print "--==--==--==--==--==--==--==--==--==--==--\n";
system("date");
- print "Testing $name";
-
- my $ret = system($cmd);
-
-# print "SMBD is down! Skipping: $cmd\n";
-# print "==========================================\n";
-# print "TEST SKIPPED: $name (reason SMBD is down)\n";
-# print "==========================================\n";
-#
- print "ALL OK: $cmd\n";
- print "==========================================\n";
- print "TEST PASSED: $name\n";
- print "==========================================\n";
-
- push(@$suitesfailed, $name) if ($ret != 0);
+
+ my $expected_ret = 1;
+ my $open_tests = {};
+ open(RESULT, "$cmd|");
+ while (<RESULT>) {
+ print;
+ if (/^test: (.+)\n/) {
+ $open_tests->{$1} = 1;
+ } elsif (/^(success|failure|skip|error): (.*?)( \[)?\n/) {
+ my $result = $1;
+ if ($1 eq "success") {
+ delete $open_tests->{$2};
+ if (expecting_failure("$name/$2")) {
+ $statistics->{TESTS_UNEXPECTED_OK}++;
+ } else {
+ $statistics->{TESTS_EXPECTED_OK}++;
+ }
+ } elsif ($1 eq "failure") {
+ delete $open_tests->{$2};
+ if (expecting_failure("$name/$2")) {
+ $statistics->{TESTS_EXPECTED_FAIL}++;
+ $expected_ret = 0;
+ } else {
+ $statistics->{TESTS_UNEXPECTED_FAIL}++;
+ }
+ } elsif ($1 eq "skip") {
+ delete $open_tests->{$2};
+ } elsif ($1 eq "error") {
+ $statistics->{TESTS_ERROR}++;
+ delete $open_tests->{$2};
+ }
+ }
+ }
+ print "COMMAND: $cmd\n";
+ foreach (keys %$open_tests) {
+ print "$_ was started but never finished!\n";
+ $statistics->{TESTS_ERROR}++;
+ }
+ my $ret = close(RESULT);
+
+ print "==========================================\n";
+ if ($ret == $expected_ret) {
+ print "TEST PASSED: $name\n";
+ } else {
+ print "TEST FAILED: $name (status $ret)\n";
+ }
+ print "==========================================\n";
}
my $test_output = {};
@@ -243,7 +275,7 @@
my $err = "";
if ($#$suitesfailed+1 > 0) { $err = ", ".($#$suitesfailed+1)." errors"; }
printf "[$i/$totalsuites in " . (time() - $start)."s$err] $name\n";
- open(RESULT, "$cmd 2>/dev/null|");
+ open(RESULT, "$cmd 2>&1|");
my $expected_ret = 1;
my $open_tests = {};
$test_output->{$name} = "";
@@ -273,6 +305,7 @@
delete $open_tests->{$2};
} elsif ($1 eq "error") {
$statistics->{TESTS_ERROR}++;
+ delete $open_tests->{$2};
}
}
}
@@ -576,7 +609,7 @@
}
}
- print "FAILED ($statistics->{TESTS_UNEXPECTED_FAIL} tests in $statistics->{SUITES_FAIL} testsuites)\n";
+ print "FAILED ($statistics->{TESTS_UNEXPECTED_FAIL} failures and $statistics->{TESTS_ERROR} errors in $statistics->{SUITES_FAIL} testsuites)\n";
} else {
print <<EOF
************************
=== modified file 'source/scripting/libjs/upgrade.js'
--- a/source/scripting/libjs/upgrade.js 2007-01-11 23:09:57 +0000
+++ b/source/scripting/libjs/upgrade.js 2007-02-01 12:16:01 +0000
@@ -357,7 +357,6 @@
subobj.NTTIME = nttime;
subobj.LDAPTIME = ldaptime;
subobj.DATESTRING = datestring;
- subobj.USN = nextusn;
subobj.ROOT = findnss(nss.getpwnam, "root");
subobj.NOBODY = findnss(nss.getpwnam, "nobody");
subobj.NOGROUP = findnss(nss.getgrnam, "nogroup", "nobody");
More information about the samba-cvs
mailing list