summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--selftest/README23
-rw-r--r--selftest/Subunit.pm13
-rwxr-xr-xselftest/selftest.pl5
3 files changed, 30 insertions, 11 deletions
diff --git a/selftest/README b/selftest/README
index 3fe6af5362..83a3e6fd49 100644
--- a/selftest/README
+++ b/selftest/README
@@ -50,6 +50,8 @@ failure: <NAME> [ REASON ]
Announce that the test with the specified name failed. Optionally, it is
possible to specify a reason it failed.
+The alias "fail" will also work.
+
xfail
~~~~~
xfail: <NAME>
@@ -57,6 +59,8 @@ xfail: <NAME> [ REASON ]
Announce that the test with the specified name failed but that the failure
was expected, e.g. it's a test for a known bug that hasn't been fixed yet.
+Alternatively it is also possible to simply return "failure:" here but
+specify in the samba4-knownfailures file that it is failing.
skip
~~~~
@@ -66,14 +70,19 @@ skip: <NAME> [ REASON ]
Announce that the test with the specified name was skipped. Optionally a
reason can be specified.
-knownfail
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-knownfail: <NAME>
-knownfail: <NAME> [ REASON ]
+time
+~~~~
+time: YYYY-MM-DD HH:mm:ssZ
+
+Announce the current time. This may be used to calculate the duration of
+various tests.
-Announce that the test with the specified name was run and failed as expected.
-Alternatively it is also possible to simply return "failure:" here but
-specify in the samba4-knownfailures file that it is failing.
+prefix
+~~~~~~
+prefix: Prefix
+
+Change the global prefix for test names. To unset the prefix, specify an empty
+string.
Environments
============
diff --git a/selftest/Subunit.pm b/selftest/Subunit.pm
index 7feb5de9a4..ddecfe4369 100644
--- a/selftest/Subunit.pm
+++ b/selftest/Subunit.pm
@@ -1,5 +1,5 @@
-# Simple Perl module for parsing the Subunit protocol
-# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
+# Perl module for parsing and generating the Subunit protocol
+# Copyright (C) 2008-2009 Jelmer Vernooij <jelmer@samba.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -29,6 +29,7 @@ sub parse_results($$$$)
my $unexpected_ok = 0;
my $expected_fail = 0;
my $unexpected_fail = 0;
+ my $prefix = "";
my $unexpected_err = 0;
my $orig_open_len = $#$open_tests;
@@ -39,6 +40,8 @@ sub parse_results($$$$)
push (@$open_tests, $1);
} elsif (/^time: (\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)Z\n/) {
$msg_ops->report_time(mktime($6, $5, $4, $3, $2, $1));
+ } elsif (/^prefix: (.*)\n/) {
+ $prefix = $1;
} elsif (/^(success|successful|failure|fail|skip|knownfail|error|xfail): (.*?)( \[)?([ \t]*)\n/) {
$msg_ops->control_msg($_);
my $result = $1;
@@ -133,4 +136,10 @@ sub report_time($)
printf "time: %04d-%02d-%02d %02d:%02d:%02dZ\n", $year+1900, $mon, $mday, $hour, $min, $sec;
}
+sub prefix($)
+{
+ my ($prefix) = @_;
+ print "prefix: $prefix\n";
+}
+
1;
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 43bdc7a804..38ea0df39b 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -217,6 +217,7 @@ sub run_testsuite($$$$$)
my $pcap_file = setup_pcap($name);
Subunit::report_time(time());
+ Subunit::prefix($name);
Subunit::start_test($name);
my $ret = system("$cmd 2>&1");
@@ -226,10 +227,10 @@ sub run_testsuite($$$$$)
}
my $envlog = getlog_env($envname);
if ($envlog ne "") {
- print "ENVLOG: $envlog\n";
+ print "envlog: $envlog\n";
}
- print "CMD: $cmd\n";
+ print "command: $cmd\n";
my $exitcode = $ret >> 8;