More work supporting prefixes.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 4 Jun 2009 15:30:23 +0000 (17:30 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 11 Jun 2009 17:59:58 +0000 (19:59 +0200)
selftest/README
selftest/Subunit.pm
selftest/selftest.pl

index 3fe6af5362a6f5767665110728c3606122c3c4aa..83a3e6fd491164608c718821e132a1954847ea3a 100644 (file)
@@ -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
 ============
index 7feb5de9a43858d88b1b8289564eee3410f6b353..ddecfe4369bab1bcfe847cb7dc23a249b4905482 100644 (file)
@@ -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;
index 43bdc7a8048c59519213a213dcaa94b357915661..38ea0df39bdbe6d9583b5634792a46e3d847a812 100755 (executable)
@@ -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;