summaryrefslogtreecommitdiff
path: root/selftest/selftest.pl
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2009-06-05 16:55:45 +0200
committerJelmer Vernooij <jelmer@samba.org>2009-06-11 19:59:59 +0200
commitd8a77a798b5c691c76fcbadbc41c97ff1c9922f3 (patch)
tree949e80dade2618002b36173be2082c833ce3909b /selftest/selftest.pl
parent2e311fdac56f43998bb192418f617e6e7a6fc320 (diff)
downloadsamba-d8a77a798b5c691c76fcbadbc41c97ff1c9922f3.tar.gz
samba-d8a77a798b5c691c76fcbadbc41c97ff1c9922f3.tar.bz2
samba-d8a77a798b5c691c76fcbadbc41c97ff1c9922f3.zip
selftest: Properly recognize xfail testsuites.
Diffstat (limited to 'selftest/selftest.pl')
-rwxr-xr-xselftest/selftest.pl37
1 files changed, 30 insertions, 7 deletions
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 93a3ca27a9..28e0460a5a 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -129,7 +129,8 @@ use Getopt::Long;
use POSIX;
use Cwd qw(abs_path);
use lib "$RealBin";
-use Subunit;
+use Subunit qw(parse_results);
+use Subunit::Filter;
use SocketWrapper;
my $opt_help = 0;
@@ -219,12 +220,34 @@ sub run_testsuite($$$$$)
Subunit::report_time(time());
Subunit::start_testsuite($name);
- system("$cmd 2>&1 | $RealBin/filter-subunit.pl --prefix \"$name.\"");
- my $ret = $?;
- if ($ret == -1) {
- Subunit::end_testsuite($name, "error", "Unable to run $cmd: $!");
- return 0;
- } elsif ($ret & 127) {
+ open(RESULTS, "$cmd 2>&1|");
+ my $statistics = {
+ SUITES_FAIL => 0,
+
+ TESTS_UNEXPECTED_OK => 0,
+ TESTS_EXPECTED_OK => 0,
+ TESTS_UNEXPECTED_FAIL => 0,
+ TESTS_EXPECTED_FAIL => 0,
+ TESTS_ERROR => 0,
+ TESTS_SKIP => 0,
+ };
+
+ my $msg_ops = new Subunit::Filter("$name\.", []);
+
+ parse_results($msg_ops, $statistics, *RESULTS);
+
+ my $ret = 0;
+
+ unless (close(RESULTS)) {
+ if ($!) {
+ Subunit::end_testsuite($name, "error", "Unable to run $cmd: $!");
+ return 0;
+ } else {
+ $ret = $?;
+ }
+ }
+
+ if ($ret & 127) {
Subunit::end_testsuite($name, "error", sprintf("Testsuite died with signal %d, %s coredump", ($ret & 127), ($ret & 128) ? "with": "without"));
return 0;
}